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 |
| string | The title of the document. |
| string | The author of the document. |
| string | The comments of the document. |
| string | The keywords of the document. |
| boolean | The edge weights visible setting. |
| boolean | The confidence visible setting. |
| boolean | The annotation numbers visible setting. |
| boolean | The edge annotations visible setting. |
| boolean | The entity ID visible setting. |
| boolean | The add entity as successor setting. |
| boolean | The project management visible setting. |
| boolean | The layout incrementally setting. |
| boolean | The browse annotations setting. |
| boolean | The show selection halo when printing setting. |
|
| The current kind of canvas view. |
|
| The start date of project when project management is enabled, otherwise |
|
| 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. |
|
| The finish date of project as a Date instance when project management is enabled, otherwise |
| integer | Returns the number of hours into the work day that the project begins. |
| integer | Returns the number of hours into the work day that the project ends. |
|
| The standard calendar is the |
|
| The direction of project scheduling |
| This field is deprecated. Use | |
| list of | A read-only list of all defined calendars. These are copies. To make permanent changes call the method |
| list of | A read-only list of all defined resources. These are copies. To make permanent changes call the method |
| string | The left header text. |
| string | The middle header text. |
| string | The right header text |
| string | The left footer text |
| string | The middle footer text |
| string | The right footer text |
| The layout orientation of the graph. | |
| The layout bias of the graph. | |
| Compactness Type | The layout compactness of the graph. |
|
| The default entity class, usually |
|
| The current entity class of newly-created entities when not explicitly specified |
|
| The current operator of newly-created junctors. |
|
| The current operator of newly-created entities. |
| number | The entity title width multiplier in range 1.0 to 8.0. |
|
| The document-wide entity title font. This |
|
| The document-wide entity class name font. |
|
| The document-wide group title font. |
|
| The document-wide default annotation font. |
| string or | Read only. The path to the file from which the document was loaded, or |
|
| The currently hoisted group. |
| boolean | Read only. True if any elements in the graph are selected, otherwise False. |
| list of | The current selection in the graph. |
| list of | The entire graph. |
| list of | All vertices as a list, earliest predecessor first, in acyclic order; i.e., ignoring back edges. |
| list of | All vertices as a list, latest successor first, in acyclic order; i.e., ignoring back edges. The |
| list of | Read only. All the domains in the document. |
| list of | Read only. All the custom Symbols in the document. |
| tuple (width, height) | Read only. The currently calculated page size when printing in points. |
| 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. |
| dictionary | A dictionary with the current image export attributes (see Image Export Type) |
| tuple (x, y, width, height) | Read only. The frame of the chart table. |
| tuple (x, y, width, height) | Read only. The frame of the βcornerβ of chart table where the headers reside. |
| tuple (x, y, width, height) | Read only. The frame of the row header of chart table. |
| tuple (x, y, width, height) | Read only. The frame of the columns of data in the chart table. |
| tuple | Read only. A tuple containing the x-position of all vertical lines in chart table. |
| dictionary | Read only. A dictionary of the strings of the header labels. (See Chart Part Type). |
| dictionary | Read only. A dictionary of the frames of the header labels as tuples (x, y, width, height). (See Chart Part Type). |
| 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) tovalue
for every instance of GraphElem inlist
, 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
(Deprecated. Use
endDatefinishDate
instead.)
effort
resource
The attributes
title
andannotation
cannot be set via this method.
modifyUserAttribute( list, name, value )
Modify a particular user defined attribute
name
tovalue
for every instance of GraphElem inlist
.
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, otherwiseFalse
.
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 ofaddEntityAsSuccessor
. 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 ofaddEntityAsSuccessor
. 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 givenvertexElem
per the setting ofaddEntityAsSuccessor
. IfvertexElem
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 givenvertexElem
per the setting ofaddEntityAsSuccessor
. IfvertexElem
isNone
, 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 ifedge
isNone
. 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 ifedge
isNone
. 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, ifname_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 methodgetEntityClassByName
.)Examples:
print( )
Prints a document after displaying the print preferences dialog.
print( ask )
Prints a document. Displays the print preferences dialog if
ask
isTrue
.
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
isTrue
, 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 ofdomain
.
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:
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 therect
tuple. Ifpath
isNone
, the user is asked to select a file. Ifpath
orrect
isNone
, the Image Viewer dialog is shown. Therect
tuple is (left, top, width, height).
newSymbolFromObject( obj, rect )
Creates a new symbol from
obj
, whereobj
can either be an instance ofjava.awt.Image
,javax.swing.ImageIcon
or a string of a SVG XML document, clipped to therect
tuple. Therect
tuple is (left, top, width, height).
deleteSymbol( symbol )
Deletes the symbol, fixing-up all entity classes and entities as needed.
isCustomSymbol( symbol )
Returns
True
ifsymbol
is custom (not built-in).
connect( fromElem, toElem )
Connects an edge from the
fromElem
to thetoElem
, 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, wherepart
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. Ifpath
isNone
, 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. Ifpath
isNone
, the user is asked to select a file.
exportDocument( kind, path, params )
Exports a document to a file of
kind
atpath
with settings in theparams
dictionary. Ifpath
isNone
, the user is asked to select a file. Thekind
is one of the Export Types in the Application class. The keys and values inparams
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
atpath
with settings in theparams
dictionary. Ifpath
isNone
, the user is asked to select a file. Thekind
is one of the Import Types. The keys and values inparams
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
andunits
parameters must not beNone
, butabbreviation
andcalendar
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 isNone
, 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 beNone
, If a calendar withname
already exists, the value βCopy ofβ prepended to name is used. Theworkdays
parameter must be a combination of day and week values and cannot be zero. Theworkhours
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
orNone
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
isTrue
and the document has been modified.
find( match, options )
Finds all graph elements that correspond to
match
with the givenoptions
(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:
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 iscom.arciem.symbol.FlowchartSymbolGenerator:pentagon
. If name is βinheritβ or βnoneβ, the predefined special symbol valuesApplication.INHERIT_SYMBOL
andApplication.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 methodendCoalesceUndo
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 byflags
(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 FontSpecspec
. Returns a tuple (x, y, width, height).
truncateWithEllipsis(string, spec, width)
If the given
string
rendered the given FontSpecspec
does not fit inwidth
, 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
, orNone
if no such font.
inHoist( elem )
Returns
True
if the given GraphElemelem
is in the current hoist; i.e., the current hoisted group is an ancestor of elem. Otherwise, returnsFalse
.
Last updated