Document

The Document class represents a Flying Logic document. Every script has a global variable document that in an instance of Document representing the current document.

Fields

Field

Type

Description

title

string

The title of the document.

author

string

The author of the document.

comment

string

The comments of the document.

keywords

string

The keywords of the document.

edgeWeightsVisible

boolean

The edge weights visible setting.

confidenceVisible

boolean

The confidence visible setting.

annotationNumbersVisible

boolean

The annotation numbers visible setting.

edgeAnnotationsVisible

boolean

The edge annotations visible setting.

entityIDVisible

boolean

The entity ID visible setting.

addEntityAsSuccessor

boolean

The add entity as successor setting.

projectManagementVisible

boolean

The project management visible setting.

layoutIncrementally

boolean

The layout incrementally setting.

browseAnnotations

boolean

The browse annotations setting.

printShowSelectionHalo

boolean

The show selection halo when printing setting.

canvasView

Application.GRAPH_VIEW or Application.CHART_VIEW

The current kind of canvas view.

startDate

Date or None

The start date of project when project management is enabled, otherwise None. This field is read-only if using finish-to-start scheduling, with the following exception: setting this variables to None disables project management.

actualStartDate

Date

The start date of the earliest task, which may be earlier than project start date because of the task having a preferred start or finish date. Read only.

finishDate

Date or None

The finish date of project as a Date instance when project management is enabled, otherwise None. The field is read-only if using finish-to-start scheduling, with the following exception: setting this variable to None disables project management.

startTime

integer

Returns the number of hours into the work day that the project begins.

finishTime

integer

Returns the number of hours into the work day that the project ends.

standardCalendar

Workweek or None

The standard calendar is the Workweek instance uses for all tasks not assigned a resource when project management is enabled, otherwise None. Note that this variable always returns a deep copy, not the current instance. Modifications will not be saved unless you set the copy. For example: stdCalendar = document.standardCalendar; stdCalendar.workdays = Workweek.MONDAY_MASK ^ theWeek.workdays; document.standardCalendar = stdCalendar

scheduleBasis

Application.SCHEDULE_FROM_START_DATE (default) or Application.SCHEDULE_FROM_END_DATE

The direction of project scheduling

workweek

This field is deprecated. Use standardCalendar instead.

calendars

list of Workweek

A read-only list of all defined calendars. These are copies. To make permanent changes call the method updateCalendar. List may be empty.

resources

list of Resource

A read-only list of all defined resources. These are copies. To make permanent changes call the method updateResource. List may be empty.

leftHeader

string

The left header text.

middleHeader

string

The middle header text.

rightHeader

string

The right header text

leftFooter

string

The left footer text

middleFooter

string

The middle footer text

rightFooter

string

The right footer text

orientation

The layout orientation of the graph.

bias

The layout bias of the graph.

graphCompactness

Compactness Type

The layout compactness of the graph.

defaultEntityClass

EntityClass

The default entity class, usually Generic. Read only.

selectedEntityClass

EntityClass

The current entity class of newly-created entities when not explicitly specified

defaultJunctorOperator

VertexOperator

The current operator of newly-created junctors.

entityOperator

VertexOperator

The current operator of newly-created entities.

entityTitleWidth

number

The entity title width multiplier in range 1.0 to 8.0.

entityTitleFont

FontSpec or None (default)

The document-wide entity title font. This FontSpec can have a size of FontSpec.AUTOSIZE.

entityClassFont

FontSpec or None (default)

The document-wide entity class name font.

groupTitleFont

FontSpec or None (default)

The document-wide group title font.

defaultAnnotationFont

FontSpec or None (default)

The document-wide default annotation font.

documentPath

string or None

Read only. The path to the file from which the document was loaded, or None if the document has never been saved.

hoistedGroup

Group or None

The currently hoisted group.

hasSelection

boolean

Read only. True if any elements in the graph are selected, otherwise False.

selection

list of GraphElement

The current selection in the graph.

all

list of GraphElement

The entire graph.

orderedVertices

list of VertexElem

All vertices as a list, earliest predecessor first, in acyclic order; i.e., ignoring back edges.

reverseOrderedVertices

list of VertexElem

All vertices as a list, latest successor first, in acyclic order; i.e., ignoring back edges. The reverseOrderedVertices list is not necessarily the reverse of the orderedVertices list because of how groups and unconnected entities are handled.

domains

list of Domain

Read only. All the domains in the document.

customSymbols

list of Symbol

Read only. All the custom Symbols in the document.

pageSize

tuple (width, height)

Read only. The currently calculated page size when printing in points.

exportPath

string

The directory that should be displayed in a file dialog involved in an export operation for this document, defaults to the user’s home directory.

imageExportAttributes

dictionary

A dictionary with the current image export attributes (see Image Export Type)

chartFrame

tuple (x, y, width, height)

Read only. The frame of the chart table.

chartCornerFrame

tuple (x, y, width, height)

Read only. The frame of the β€œcorner” of chart table where the headers reside.

chartRowFrame

tuple (x, y, width, height)

Read only. The frame of the row header of chart table.

chartColumnFrame

tuple (x, y, width, height)

Read only. The frame of the columns of data in the chart table.

chartColumnLines

tuple

Read only. A tuple containing the x-position of all vertical lines in chart table.

chartHeaderTitles

dictionary

Read only. A dictionary of the strings of the header labels. (See Chart Part Type).

chartHeaderRects

dictionary

Read only. A dictionary of the frames of the header labels as tuples (x, y, width, height). (See Chart Part Type).

zoomFraction

number

The current zoom value for the canvas. Values greater than 1.0 indicate the canvas is zoomed-in, values less than 1.0 indicate the canvas is zoomed-out.

Methods

modifyAttribute( list, name, value )

Modify a particular built-in attribute name (a string) to value for every instance of GraphElem in list, throwing an exception if any instance does not support the given name. The following attributes can be set with this method:

  • weight

  • weightVisible

  • annotationVisible

  • operator

  • entityClass

  • symbol

  • color

  • confidence

  • completion

  • parent

  • collapsed

  • deepCollapsed (This represents a pseudo-attribute that can deep collapse a group.)

  • startDate

  • finishDate

  • endDate (Deprecated. Use finishDate instead.)

  • effort

  • resource

The attributes title and annotation cannot be set via this method.

modifyUserAttribute( list, name, value )

Modify a particular user defined attribute name to value for every instance of GraphElem in list.

hoistGroupFromSelection( )

Hoists the first group found in the current selection. If there are more than one group in the selection, it is ambiguous which will be hoisted.

hoistGroupToParent( )

If a group is hoisted, its parent group is hoisted instead, otherwise does nothing.

isSelected( elem )

Returns True if the GraphElem elem is selected, otherwise False.

selectAll( )

Selects every element in the graph.

clearSelection( )

Deselects every element in the graph.

addEntity( )

Adds a new entity to the graph with class defaultEntityClass. If only one entity is currently selected, the new entity is connected to that selected entity per the setting of addEntityAsSuccessor. Returns a list of new elements, Entity instance first.

addEntity( entityclass )

Adds a new entity to the graph with class entityclass. If only one entity is currently selected, the new entity is connected to that selected entity per the setting of addEntityAsSuccessor. Returns a list of new elements, Entity instance first.

addEntityToTarget( vertexElem )

Adds a new entity to the graph with class selectedEntityClass. The newly created entity is connected to the given vertexElem per the setting of addEntityAsSuccessor. If vertexElem is None, does not connect the new entity to any element. Returns a list of new elements, Entity instance first.

addEntityToTarget( entityclass, vertexElem )

Adds a new entity to the graph with class entityclass. The newly created entity is connected to the given vertexElem per the setting of addEntityAsSuccessor. If vertexElem is None, does not connect the new entity to any element. Returns a list of new elements, Entity instance first.

insertEntity( )

Inserts a new entity to the graph with class selectedEntityClass, but only if a single edge is selected, otherwise an exception is thrown. Returns a list of new elements, Entity instance first.

insertEntity( entityclass )

Inserts a new entity to the graph with class entityclass, but only if a single edge is selected, otherwise an exception is thrown. Returns a list of new elements, Entity instance first.

insertEntityOnEdge( edge )

Inserts a new entity to the graph with class selectedEntityClass on the given edge. Throws an exception if edge is None. Returns a list of new elements, Entity instance first.

insertEntityOnEdge( entityclass, edge )

Inserts a new entity to the graph with class entityclass on the given edge. Throws an exception if edge is None. Returns a list of new elements, Entity instance first.

getDomainByName( name )

Return the Domain instance with the given name or None.

getEntityClassByName( name_or_tuple )

Return the EntityClass instance based on one of two matching criteria: if name_or_tuple is a string, then the parameter is the name of an entity class to find (preference is given to a custom entity class if the are duplicate names); otherwise, if name_or_tuple is a tuple, then the parameter must be the tuple (domain_name, entity_class_name) identifying an entity class (see also the Domain class method getEntityClassByName.)

Examples:

entityclass = document.getEntityClassByName('Goal')
entityclass = document.getEntityClassByName( ('Prerequisite Tree', 'Milestone' ) )

print( )

Prints a document after displaying the print preferences dialog.

print( ask )

Prints a document. Displays the print preferences dialog if ask is True.

focusCanvas( )

Changes the current keyboard focus to the graph canvas.

cut( )

Performs a cut operation on the selected elements in the graph.

copy( )

Performs a copy operation on the selected elements in the graph.

paste( )

Pastes the graph elements from the last, still active, copy operation to the document.

deleteSelection( recurse )

Deletes the currently selected graph elements. If recurse is True, also deletes nested elements in selected groups.

newDomain( name )

Returns a new Domain instance with the given name.

deleteDomain( domain )

Deletes the given domain, automatically changing the class of any entity in the graph to defaultEntityClass if that entity’s class was part of domain.

deleteEntityClass ( entityclass )

Deletes the given entity class, automatically changing the class of any entity in the graph to defaultEntityClass if that entity’s class was entityclass. This is same operation as:

entityclass.getDomain().deleteEntityClass(entityclass)

newGroup( )

Creates a new group containing all currently selected elements and returns a list of new elements, Group instance first.

newGroup( children )

Creates a new group containing all elements in children, which must be a list, and returns a list of new elements, Group instance first.

newSymbol( path, rect )

Creates a new symbol from the file at path clipped to the rect tuple. If path is None, the user is asked to select a file. If path or rect is None, the Image Viewer dialog is shown. The rect tuple is (left, top, width, height).

newSymbolFromObject( obj, rect )

Creates a new symbol from obj, where obj can either be an instance of java.awt.Image, javax.swing.ImageIcon or a string of a SVG XML document, clipped to the rect tuple. The rect tuple is (left, top, width, height).

deleteSymbol( symbol )

Deletes the symbol, fixing-up all entity classes and entities as needed.

isCustomSymbol( symbol )

Returns True if symbol is custom (not built-in).

connect( fromElem, toElem )

Connects an edge from the fromElem to the toElem, where the elements must be an entity, junctor or edge. Returns a list of new elements.

reconnect( edge, part, element )

Reconnects one end of edge to a new element, where part indicates which end (see Edge Part Type in Application class). Returns a list of new elements.

saveDocument( )

Saves the document, asking the user to select a file only if the document has never been saved.

saveDocumentAs( path )

Saves the document to the file at path, creating the file if necessary. If path is None, the user is asked to select a file.

saveDocumentAsTemplate( path )

Saves the document as a template to the file at path, creating the file if necessary. If path is None, the user is asked to select a file.

exportDocument( kind, path, params )

Exports a document to a file of kind at path with settings in the params dictionary. If path is None, the user is asked to select a file. The kind is one of the Export Types in the Application class. The keys and values in params are export kind dependent (see Image Export Type, OPML ExportType, and XSLT Import-Export Type for possible keys and values).

importDocument( kind, path, params )

Imports a document from a file of kind at path with settings in the params dictionary. If path is None, the user is asked to select a file. The kind is one of the Import Types. The keys and values in params are export kind dependent (only XSLT import used params, XSLT Import/Export Types for possible keys and values). Returns either a new Document instance, if the import creates a new document, or this Document if not.

createResource( )

Creates and returns a new Resource instance with default values. If you change the values you must call updateResource.

createResource( name, abbreviation, units, calendar )

Creates and returns a new Resource instance with the given values. The name and units parameters must not be None, but abbreviation and calendar can. If a resource with name already exists, the value β€œCopy of” prepended to name is used. For a default units supply the value 1.0. If calendar is None, the standard calendar is assigned to the new resource.

copyResource( resource )

Returns a copy of the given resource with name changed by prepending β€œCopy of”.

updateResource( resource )

Updates a Resource instance. Changes to resource instance do not take full effect until this method is called.

removeResource( resource )

Removes the given resource from the document.

resourceByName( name )

Return the Resource instance with the given name or None if these is no such resource.

createCalendar( )

Creates and returns a new Workweek instance with default values. If you change the values you must call updateCalendar.

createCalendar( name, workdays, workhours )

Creates and returns a new Workweek instance with the given values. The name parameter must not be None, If a calendar with name already exists, the value β€œCopy of” prepended to name is used. The workdays parameter must be a combination of day and week values and cannot be zero. The workhours parameter must be between 1.0 and 23.0.

copyCalendar( calendar )

Returns a copy of the given calendar with name changed by prepending β€œCopy of”.

updateCalendar( calendar )

Updates a Workweek instance. Changes to calendar instance do not take full effect until this method is called.

removeCalendar( calendar )

Removes the given calendar from the document.

calendarByName( name )

Return the Workweek instance with the given name or None if these is no such calendar.

resetStartTime( )

Resets the project start time to the start of the work day. Only applies when finish-to-start scheduling is set.

resetFinishTime( )

Resets the project finish time to the end of the work day. Only applies when start-to-finish scheduling is set.

closeDocument( ask )

Closes the document, asking the user for permission if ask is True and the document has been modified.

find( match, options )

Finds all graph elements that correspond to match with the given options (see Find Types in Application class).

selectSuccessors( )

API 1.14

Selects the immediate successors of all current selected entities and junctors, including any edge in-between. This functionality is different than in previous API versions and is now found in the selectAllSuccessors method documented below.

selectAllSuccessors( )

API 1.14

Selects the successors of all current selected entities and junctors (and their successors) including any edge in-between each.

selectPredecessors( )

API 1.14

Selects the immediate predecessors of all current selected entities and junctors, including any edge in-between. This functionality is different than in previous API versions and is now found in the selectAllPredecessors method documented below.

selectAllPredecessors( )

API 1.14

Selects the predecessors of all current selected entities and junctors (and their predecessors) including any edge in-between each.

selectEdgeHeadEntity( )

Selects the head entity of all current selected edges, including any edge or junctor in-between.

selectEdgeTailEntity( )

Selects the head entity of all current selected edges, including any edge or junctor in-between.

selectPathsBetweenEntities( )

API 1.14

Selects all elements between two selected entities.

reverseSelectedEdges( )

The head and tail elements of edge selected edge are swapped.

swapSelectedElements( )

If the two selected elements are of the same type, swaps them.

swapSelectedForwardAndBackEdges( )

Swaps the selected forward and back edges.

redactSelection( )

Redact the selected elements.

redactAll( )

Redact all elements.

importDomain( path )

Imports the domain from the file at path.

saveDomainsAsDefaults( )

Saves the current custom domains as the defaults for future new documents.

eraseProjectManagement( )

Erases all project management information from the document, the same affect as:

document.startData = None

isSymbolInUse( symbol )

Return True if a symbol is being used by an EntityClass or Entity.

getSymbolByName( name )

Returns the a Symbol instance matching the given name. Symbol names are a generator name and an ID code separated by a colon. For example, the blue pentagon symbol is com.arciem.symbol.FlowchartSymbolGenerator:pentagon. If name is β€œinherit” or β€œnone”, the predefined special symbol values Application.INHERIT_SYMBOL and Application.NO_SYMBOL, respectively. A table with the names of the builtin symbols can be found in Graphic Symbol Names.

undo( )

Perform an undo operation if possible.

redo( )

Perform a redo operation if possible.

beginCoalesceUndo( name )

Causes all changes to a document in a script to be coalesced into one undo record under the given name. This is done internally for each document accessed by a script, but can still be called to change the undo record’s name. The method endCoalesceUndo is called internally when the script terminates.

endCoalesceUndo( )

Closes and appends the current undo record to the undo stack, but only if there is anything to undo. A new undo record is automatically started, but it’s name can be changed by calling beginCoalesceUndo.

operateAll()

Immediately performs a re-calculation of driven confidence values and project management data. These re-calculations are normally deferred until the script ends or endCoalesceUndo is called as they can take a significant amount of time on large documents.

operate( operator, flags )

Operate on each element in a graph in acyclic order using operator, an instance of a class derived from GraphOperator, with the types and order of elements determined by flags (see Operate Types in Application class.)

formatDate( date )

Returns a string representing the given date as formatted for a start or finish date.

calcFont( spec )

Calculates the ascent, descent and uppercaseHeight fields of the given FontSpec spec derived from the document environment.

getStringBounds( string, spec )

Calculates the bounds of the given string rendered with the given FontSpec spec. Returns a tuple (x, y, width, height).

truncateWithEllipsis(string, spec, width)

If the given string rendered the given FontSpec spec does not fit in width, returns the string truncated and an ellipsis added. Return the original string is it would fit.

findStaticFont( name )

Returns a FontSpec for the given UI usage name, or None if no such font.

inHoist( elem )

Returns True if the given GraphElem elem is in the current hoist; i.e., the current hoisted group is an ancestor of elem. Otherwise, returns False.

Last updated