drawio

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LayoutAuto           = "auto"
	LayoutNone           = "none"
	LayoutHorizontalFlow = "horizontalflow"
	LayoutVerticalFlow   = "verticalflow"
	LayoutHorizontalTree = "horizontaltree"
	LayoutVerticalTree   = "verticaltree"
	LayoutOrganic        = "organic"
	LayoutCircle         = "circle"
)

Standard layout styles for draw.io.

View Source
const BidirectionalConnectionStyle = "curved=1;endArrow=blockThin;endFill=1;fontSize=11;startArrow=blockThin;startFill=1;"
View Source
const DefaultConnectionStyle = "curved=1;endArrow=blockThin;endFill=1;fontSize=11;"

DefaultConnectionStyle is the default style for connecting nodes.

View Source
const DefaultParentStyle = "" /* 129-byte string literal not displayed */

DefaultParentStyle is the default style for parent-child relationships.

Variables

This section is empty.

Functions

func AWSShape

func AWSShape(group string, title string) string

AWSShape returns the shape for a desired service TODO: Add error handling for unfound shapes

func AllAWSShapes

func AllAWSShapes() map[string]map[string]string

AllAWSShapes returns the full map of shapes

func CreateCSV

func CreateCSV(drawIOHeader Header, headerRow []string, contents []map[string]string, filename string)

CreateCSV creates the CSV complete with the header

func GetContentsFromFileAsStringMaps

func GetContentsFromFileAsStringMaps(filename string) []map[string]string

GetContentsFromFileAsStringMaps returns the CSV contents as a slice of string maps

func GetHeaderAndContentsFromFile

func GetHeaderAndContentsFromFile(filename string) (map[string]int, [][]string)

GetHeaderAndContentsFromFile returns the headers of a CSV in a reverse map (name:column-id) and the remaining rows It filters away all of the comments

Types

type Connection

type Connection struct {
	From   string `json:"from"`
	To     string `json:"to"`
	Invert bool   `json:"invert"`
	Label  string `json:"label"`
	Style  string `json:"style"`
}

Connection is a representation Draw.IO CSV import connection value.

func NewConnection

func NewConnection() Connection

NewConnection creates a new connection object using default values

type Header struct {
	// contains filtered or unexported fields
}

Header is a representation of the Draw.IO CSV import header.

func DefaultHeader

func DefaultHeader() Header

DefaultHeader returns a header with: label: %Name%, style: %Image%, ignore: Image

func NewHeader

func NewHeader(label string, style string, ignore string) Header

NewHeader returns a header with the provided label, style, and ignore label: Node label with placeholders and HTML. style: Node style (placeholders (defined as '%name%') are replaced once). ignore: Comma-separated list of ignored columns for metadata. (These can be used for connections and styles but will not be added as metadata.)

func (*Header) AddConnection

func (header *Header) AddConnection(connection Connection)

AddConnection adds a connection object to the header

func (*Header) GetSpacing

func (header *Header) GetSpacing() (nodespacing, levelspacing, edgespacing int)

GetSpacing retrieves the current spacing values nodespacing: Spacing between nodes levelspacing: Spacing between levels of hierarchical layouts edgespacing: Spacing between parallel edges

func (*Header) IsSet

func (header *Header) IsSet() bool

IsSet checks if a header is configured

func (*Header) SetHeightAndWidth

func (header *Header) SetHeightAndWidth(height, width string)

SetHeightAndWidth sets the height and width values of the nodes Possible values are a number (in px), auto or an @ sign followed by a column name that contains the value for the width. Default for both is auto.

func (*Header) SetIdentity

func (header *Header) SetIdentity(columnname string)

SetIdentity uses the given column name as the identity for cells (updates existing cells).

func (*Header) SetLayout

func (header *Header) SetLayout(layout string)

SetLayout sets the layout

func (*Header) SetLeftAndTopColumns

func (header *Header) SetLeftAndTopColumns(left, top string)

SetLeftAndTopColumns lets you set the column names storing x (left) and y (top) coordinates When using anything other than none for layout, this will be ignored

func (header *Header) SetLink(columnname string)

SetLink sets the column to be renamed to link attribute (used as link)

func (*Header) SetNamespace

func (header *Header) SetNamespace(namespace string)

SetNamespace adds a prefix to the identity of cells to make sure they do not collide with existing cells (whose IDs are numbers from 0..n, sometimes with a GUID prefix in the context of realtime collaboration). This should be ignored by draw.io when identity is used, but regardless it is always ignored. Only left in here in case it is fixed. Default is csvimport-

func (*Header) SetPadding

func (header *Header) SetPadding(padding int)

SetPadding is for setting the padding when width and/or height are set to auto

func (*Header) SetParent

func (header *Header) SetParent(parent, parentStyle string)

SetParent sets the parent information. Requires identity to be set as well parent: Uses the given column name as the parent reference for cells (refers to the identity column). Set to - to remove. Default is unused parentStyle: Parent style for nodes with child nodes (placeholders defined with %columnname% are replaced once). Only used when parent is defined. Default is value of DefaultParentStyle

func (*Header) SetSpacing

func (header *Header) SetSpacing(nodespacing, levelspacing, edgespacing int)

SetSpacing sets the spacing between the nodes at different levels nodespacing: Spacing between nodes. Default is 40. levelspacing: Spacing between levels of hierarchical layouts. Default is 100. edgespacing: Spacing between parallel edges. Default is 40. Use 0 to disable.

func (*Header) String

func (header *Header) String() string

String returns a formatted string for the header

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL