Class Tree

    • Field Detail

      • m_Self

        protected Tree m_Self
        the tree itself.
      • m_Owner

        protected FlowPanel m_Owner
        the owner.
      • m_Modified

        protected boolean m_Modified
        whether the setup was modified or not.
      • m_File

        protected File m_File
        the file this actor is based on (if at all).
      • m_LastSearchString

        protected String m_LastSearchString
        the last search string used.
      • m_ActorNameColor

        protected String m_ActorNameColor
        the HTML color string of the actor names (e.g., 'black' or '#000000').
      • m_ActorNameSize

        protected String m_ActorNameSize
        the HTML font tag size of the actor names (e.g., '3' or '-1').
      • m_QuickInfoColor

        protected String m_QuickInfoColor
        the HTML color string of the quick info (e.g., 'green' or '#008800').
      • m_QuickInfoSize

        protected String m_QuickInfoSize
        the HTML font tag size of the quick info (e.g., '3' or '-2').
      • m_AnnotationsColor

        protected String m_AnnotationsColor
        the HTML color string of the annotations (e.g., 'blue' or '#0000FF').
      • m_AnnotationsSize

        protected String m_AnnotationsSize
        the HTML font tag size of the annotations (e.g., '3' or '-2').
      • m_InputOutputColor

        protected String m_InputOutputColor
        the HTML color string of the input/output info (e.g., 'green' or '#008800').
      • m_InputOutputSize

        protected String m_InputOutputSize
        the HTML font tag size of the input/output info (e.g., '3' or '-2').
      • m_PlaceholdersColor

        protected String m_PlaceholdersColor
        the HTML color string of the placeholders (e.g., 'navy' or '#0000FF').
      • m_PlaceholdersSize

        protected String m_PlaceholdersSize
        the HTML font tag size of the placeholders (e.g., '3' or '-2').
      • m_VariableHighlightBackground

        protected String m_VariableHighlightBackground
        the background HTML color string of the variable highlights (e.g., 'red' or '#FFDD88').
      • m_BookmarkHighlightBackground

        protected String m_BookmarkHighlightBackground
        the background HTML color string of the bookmark highlights (e.g., 'orange' or '#FFDD00').
      • m_ShowQuickInfo

        protected boolean m_ShowQuickInfo
        whether to display the quick info or not.
      • m_ShowAnnotations

        protected boolean m_ShowAnnotations
        whether to show the annotations or not.
      • m_ShowInputOutput

        protected boolean m_ShowInputOutput
        whether to display the input/output info or not.
      • m_InputOutputPrefixes

        protected String[] m_InputOutputPrefixes
        the input/output class prefixes to remove.
      • m_CurrentEditingNode

        protected Node m_CurrentEditingNode
        the node that is currently being edited.
      • m_CurrentEditingParent

        protected Node m_CurrentEditingParent
        the parent of the currently edited node or node to be added.
      • m_LastTemplate

        protected AbstractActorTemplate m_LastTemplate
        the last template that was added via 'Add template'.
      • m_LastTemplateInsertPosition

        protected TreeOperations.InsertPosition m_LastTemplateInsertPosition
        the position of the last template that was added via 'Add template'.
      • m_IgnoreNameChanges

        protected boolean m_IgnoreNameChanges
        whether to ignore name changes of actors (suppressing application of post-processors).
      • m_RecordAdd

        protected boolean m_RecordAdd
        whether to record the adding of actors to improve suggestions.
      • m_RecordEnclose

        protected boolean m_RecordEnclose
        whether to record the enclosing of actors to improve suggestions.
      • m_AllowNodePopup

        protected boolean m_AllowNodePopup
        whether to allow the popup menu.
      • m_AllowNodeQuickAction

        protected boolean m_AllowNodeQuickAction
        whether to allow the quick action menu.
      • m_AllowKeyboardShortcuts

        protected boolean m_AllowKeyboardShortcuts
        whether to allow keyboard shortcuts.
      • m_Operations

        protected TreeOperations m_Operations
        for complex operations.
      • m_NodePopupCache

        protected List<Object> m_NodePopupCache
        the classes for the tree popup.
      • m_Debug

        protected boolean m_Debug
        whether it is a debug flow (ie copy).
    • Constructor Detail

      • Tree

        public Tree​(FlowPanel owner)
        Initializes the tree.
        Parameters:
        owner - the owning panel
      • Tree

        public Tree​(FlowPanel owner,
                    Actor root)
        Initializes the tree.
        Parameters:
        owner - the owning panel
        root - the root actor, can be null
    • Method Detail

      • initialize

        protected void initialize()
        Further initialization of the tree.
        Overrides:
        initialize in class DragAndDropTree
      • getOperations

        public TreeOperations getOperations()
        Returns the object for handling complex operations.
        Returns:
        the tree operations
      • setSelectionModel

        public void setSelectionModel​(TreeSelectionModel selectionModel)
        Sets the tree's selection model. When a null value is specified an empty selectionModel is used, which does not allow selections.
        Overrides:
        setSelectionModel in class JTree
        Parameters:
        selectionModel - the TreeSelectionModel to use, or null to disable selections
        See Also:
        TreeSelectionModel
      • buildTree

        public void buildTree​(Actor root)
        Builds the tree with the given root.
        Parameters:
        root - the root actor, can be null
      • buildTree

        public void buildTree​(Node root)
        Builds the tree with the given root node.
        Parameters:
        root - the root node, can be null
      • getExpandedFullNames

        public List<String> getExpandedFullNames()
        Returns the full actor names of expanded nodes.
        Returns:
        the full names
      • setExpandedFullNames

        public void setExpandedFullNames​(List<String> names)
        Sets the expanded state of the nodes located via their full names.
        Parameters:
        names - the full names
      • getSelectionFullNames

        public List<String> getSelectionFullNames()
        Returns the full names list of nodes that are selected.
        Returns:
        the full names
      • setSelectionFullNames

        public void setSelectionFullNames​(List<String> names)
        Sets the selected nodes based on their full names.
        Parameters:
        names - the full names
      • updateActorName

        public boolean updateActorName​(Node node,
                                       boolean force)
        Ensures that the name of the actor stored in the node is unique among its siblings. For FixedNameActorHandler parents, the desired name is determined.
        Parameters:
        node - the actor to check
        force - whether to force the updating
        Returns:
        true if the actor's name was modified
      • setOwner

        public void setOwner​(FlowPanel value)
        Sets the owning panel.
        Parameters:
        value - the owner, null if not available
      • getOwner

        public FlowPanel getOwner()
        Returns the owning panel.
        Returns:
        the panel, null if not available
      • getEditor

        public FlowEditorPanel getEditor()
        Returns the owning editor.
        Returns:
        the editor, null if not available
      • setAllowNodePopup

        public void setAllowNodePopup​(boolean value)
        Sets whether to allow the node popup.
        Parameters:
        value - true if to allow
      • getAllowNodePopup

        public boolean getAllowNodePopup()
        Returns whether the node popup is allowed.
        Returns:
        true if allowed
      • setAllowNodeQuickAction

        public void setAllowNodeQuickAction​(boolean value)
        Sets whether to allow the node quick action menu.
        Parameters:
        value - true if to allow
      • getAllowNodeQuickAction

        public boolean getAllowNodeQuickAction()
        Returns whether the node quick action menu is allowed.
        Returns:
        true if allowed
      • setAllowKeyboardShortcuts

        public void setAllowKeyboardShortcuts​(boolean value)
        Sets whether to allow keyboard shortcuts.
        Parameters:
        value - true if to allow
      • getAllowKeyboardShortcuts

        public boolean getAllowKeyboardShortcuts()
        Returns whether the keyboard shortcuts are allowed.
        Returns:
        true if allowed
      • setActorNameColor

        public void setActorNameColor​(String value)
        Sets the HTML color string for the actor names.
        Parameters:
        value - the HTML color string
      • getActorNameColor

        public String getActorNameColor()
        Returns the HTML color string for the actor names.
        Returns:
        the HTML color string
      • setActorNameSize

        public void setActorNameSize​(String value)
        Sets the HTML font tag size string for the actor names.
        Parameters:
        value - the HTML font tag size string
      • getActorNameSize

        public String getActorNameSize()
        Returns the HTML font tag size string for the actor names.
        Returns:
        the HTML font tag size string
      • setAnnotationsColor

        public void setAnnotationsColor​(String value)
        Sets the HTML color string for the annotations.
        Parameters:
        value - the HTML color string
      • getAnnotationsColor

        public String getAnnotationsColor()
        Returns the HTML color string for the annotations.
        Returns:
        the HTML color string
      • setAnnotationsSize

        public void setAnnotationsSize​(String value)
        Sets the HTML font tag size string for the annotations.
        Parameters:
        value - the HTML font tag size string
      • getAnnotationsSize

        public String getAnnotationsSize()
        Returns the HTML font tag size string for the annotations.
        Returns:
        the HTML font tag size string
      • setQuickInfoColor

        public void setQuickInfoColor​(String value)
        Sets the HTML color string for the quick info.
        Parameters:
        value - the HTML color string
      • getQuickInfoColor

        public String getQuickInfoColor()
        Returns the HTML color string for the quick info.
        Returns:
        the HTML color string
      • setQuickInfoSize

        public void setQuickInfoSize​(String value)
        Sets the HTML font tag size string for the quick info.
        Parameters:
        value - the HTML font tag size string
      • getQuickInfoSize

        public String getQuickInfoSize()
        Returns the HTML font tag size string for the quick info.
        Returns:
        the HTML font tag size string
      • setInputOutputColor

        public void setInputOutputColor​(String value)
        Sets the HTML color string for the input/output information.
        Parameters:
        value - the HTML color string
      • getInputOutputColor

        public String getInputOutputColor()
        Returns the HTML color string for the input/output information.
        Returns:
        the HTML color string
      • setInputOutputSize

        public void setInputOutputSize​(String value)
        Sets the HTML font tag size string for the input/output information.
        Parameters:
        value - the HTML font tag size string
      • getInputOutputSize

        public String getInputOutputSize()
        Returns the HTML font tag size string for the input/output information.
        Returns:
        the HTML font tag size string
      • setPlaceholdersColor

        public void setPlaceholdersColor​(String value)
        Sets the HTML color string for the placeholders.
        Parameters:
        value - the HTML color string
      • getPlaceholdersColor

        public String getPlaceholdersColor()
        Returns the HTML color string for the placeholders.
        Returns:
        the HTML color string
      • setPlaceholdersSize

        public void setPlaceholdersSize​(String value)
        Sets the HTML font tag size string for the quick info.
        Parameters:
        value - the HTML font tag size string
      • getPlaceholdersSize

        public String getPlaceholdersSize()
        Returns the HTML font tag size string for the placeholders.
        Returns:
        the HTML font tag size string
      • setVariableHighlightBackground

        public void setVariableHighlightBackground​(String value)
        Sets the HTML background color string for the variable highlights.
        Parameters:
        value - the HTML color string
      • getVariableHighlightBackground

        public String getVariableHighlightBackground()
        Returns the HTML background color string for the variable highlights.
        Returns:
        the HTML color string
      • setBookmarkHighlightBackground

        public void setBookmarkHighlightBackground​(String value)
        Sets the HTML background color string for the bookmark highlights.
        Parameters:
        value - the HTML color string
      • getBookmarkHighlightBackground

        public String getBookmarkHighlightBackground()
        Returns the HTML background color string for the bookmark highlights.
        Returns:
        the HTML color string
      • setIgnoreNameChanges

        public void setIgnoreNameChanges​(boolean value)
        Sets whether to ignore name changes of actors and don't prompt a dialog with the user having the option to update the name throughout the glow.
        Parameters:
        value - if true then name changes are ignored
      • getIgnoreNameChanges

        public boolean getIgnoreNameChanges()
        Returns whether name changes of actors are ignored and no dialog is prompting the user whether to propagate the changes throughout the flow.
        Returns:
        true if the name changes are ignored
      • setRecordAdd

        public void setRecordAdd​(boolean value)
        Sets whether to record the adding of actors in order to improve the suggestions.
        Parameters:
        value - true if to record
      • getRecordAdd

        public boolean getRecordAdd()
        Returns whether to record the adding of actors in order to improve the suggestions.
        Returns:
        true if to record
      • setRecordEnclose

        public void setRecordEnclose​(boolean value)
        Sets whether to record the enclosing of actors in order to improve the suggestions.
        Parameters:
        value - true if to record
      • getRecordEnclose

        public boolean getRecordEnclose()
        Returns whether to record the enclosing of actors in order to improve the suggestions.
        Returns:
        true if to record
      • setKeyboardActions

        public void setKeyboardActions​(List<AbstractKeyboardAction> value)
        Sets the keyboard actions to use.
        Parameters:
        value - the actions
      • getKeyboardActions

        public List<AbstractKeyboardAction> getKeyboardActions()
        Returns the keyboard actions in use.
        Returns:
        the actions
      • nodeStructureChanged

        public void nodeStructureChanged​(Node node)
        Shortcut method for notifying model about node structure change.
        Parameters:
        node - the node the triggered the structural change
      • canPasteActor

        protected boolean canPasteActor()
        Checks whether an actor can be pasted.
        Returns:
        true if pasting is possible
      • canRemoveActors

        protected boolean canRemoveActors​(TreePath[] paths)
        Checks whether the specified actors can be removed, e.g., "cut" and placed on the clipboard.
        Parameters:
        paths - the paths to the actors
        Returns:
        true if the actors can be removed
      • getTreeState

        protected StateContainer getTreeState​(MouseEvent e)
        Returns the state to be used for the popup menu.
        Parameters:
        e - the event
        Returns:
        the state, null if no popup possible
      • getTreeState

        protected StateContainer getTreeState​(TreePath[] paths,
                                              Node currNode)
        Returns the state to be used for the popup menu or keyboard shortcuts.
        Parameters:
        paths - the selected paths to work with
        currNode - the currently active node
        Returns:
        the state
      • showNodePopupMenu

        public void showNodePopupMenu​(MouseEvent e)
        Shows a popup if possible for the given mouse event.
        Parameters:
        e - the event
      • createNodePopupMenu

        public BasePopupMenu createNodePopupMenu​(MouseEvent e)
        Generates a popup if possible for the given mouse event.
        Parameters:
        e - the event
        Returns:
        the popup menu, null if not possible
      • showNodeQuickActionMenu

        public void showNodeQuickActionMenu​(MouseEvent e)
        Shows a quick action popup if possible for the given mouse event.
        Parameters:
        e - the event
      • createNodeQuickActionMenu

        public BasePopupMenu createNodeQuickActionMenu​(MouseEvent e)
        Generates a quick action popup if possible for the given mouse event.
        Parameters:
        e - the event
        Returns:
        the popup menu, null if not possible
      • addUndoPoint

        public void addUndoPoint​(String comment)
        Adds an undo point with the given comment.
        Parameters:
        comment - the comment for the undo point
      • toggleEnabledState

        public void toggleEnabledState​(TreePath[] paths)
        Toggles the enabled state of actors.
        Parameters:
        paths - the paths to the actors
      • getNearestActor

        protected Actor getNearestActor​(Node parent,
                                        int startIndex,
                                        boolean forward)
        Returns the nearest actor in the children of the provided parent node that is not disabled.
        Parameters:
        parent - the parent node to search
        startIndex - the starting index in the children
        forward - whether to search forward or backwards
        Returns:
        the nearest actor, null if none found
      • addActorChangeListener

        public void addActorChangeListener​(ActorChangeListener l)
        Adds the listener to the internal list of listeners.
        Parameters:
        l - the listener to add
      • removeActorChangeListener

        public void removeActorChangeListener​(ActorChangeListener l)
        Removes the listener from the internal list of listeners.
        Parameters:
        l - the listener to remove
      • notifyActorChangeListeners

        public void notifyActorChangeListeners​(ActorChangeEvent e)
        Notifies all listeners.
        Parameters:
        e - the event to send
      • setActor

        public void setActor​(Actor value)
        Sets the flow actor to display.
        Parameters:
        value - the flow actor
      • getActor

        public Actor getActor()
        Returns the underlying flow.

        WARNING: Recreates an actor hierarchy based on the tree. Method gets very slow for large flows. If you only need the root actor, then use getRootActor() instead.
        Returns:
        the flow or null if none stored yet
        See Also:
        getRootActor(), Node.getFullActor()
      • getActor

        public Actor getActor​(StringBuilder errors)
        Returns the underlying flow.

        WARNING: Recreates an actor hierarchy based on the tree. Method gets very slow for large flows. If you only need the root actor, then use getRootActor() instead.
        Parameters:
        errors - for storing any errors, use null to ignore
        Returns:
        the flow or null if none stored yet
        See Also:
        getRootActor(), Node.getFullActor()
      • getRootActor

        public Actor getRootActor()
        Returns the top-level actor (without any children).
        Returns:
        the flow or null if none stored yet
        See Also:
        getActor()
      • getRootNode

        public Node getRootNode()
        Returns the root node.
        Returns:
        the root, null if not available
      • getCommandLines

        public List<String> getCommandLines()
        Returns the nested commandlines of the actors. Node level equals the number of leading blanks.
        Returns:
        the nested commandlines
      • isFlow

        public boolean isFlow()
        Returns whether the actor is of type Flow or not.
        Returns:
        true if actor is a Flow
      • setModified

        public void setModified​(boolean value)
        Sets whether the tree is modified or not.
        Parameters:
        value - true if tree is modified
        See Also:
        isDebug()
      • isModified

        public boolean isModified()
        Returns whether the tree is modified.
        Returns:
        true if modified
      • setFile

        public void setFile​(File value)
        Sets the file this flow is associated with.
        Parameters:
        value - the associated file, null if not associated with a file
      • getFile

        public File getFile()
        Returns the file this flow is associated with.
        Returns:
        the file, null if not associated with file
      • getSelectionRows

        public int[] getSelectionRows()
        Returns the selected rows. Sorted from smallest to largest row.
        Overrides:
        getSelectionRows in class JTree
        Returns:
        the selected rows, 0-length array if none selected
      • getSelectionPaths

        public TreePath[] getSelectionPaths()
        Returns the paths of all selected values. Sorted from smallest to largest selection row.
        Overrides:
        getSelectionPaths in class JTree
        Returns:
        an array of TreePath objects indicating the selected nodes, or empty array if nothing is currently selected
      • getSelectedNode

        public Node getSelectedNode()
        Returns the currently selected node.
        Returns:
        the selected node, null if none selected
      • getSelectedActor

        public Actor getSelectedActor()
        Returns the currently selected actor.
        Returns:
        the selected actor, null if none selected
      • getSelectedActors

        public Actor[] getSelectedActors()
        Returns the currently selected actors.
        Returns:
        the selected actors, 0-length array if none selected
      • getSelectedFullName

        public String getSelectedFullName()
        Returns the full name of the currently selected actor.
        Returns:
        the full name of the selected actor, null if none selected
      • setSelectedFullName

        public boolean setSelectedFullName​(String name)
        Sets the selected node using its full name.
        Parameters:
        name - the full name
        Returns:
        true if located and selected
      • locate

        protected Node locate​(Node parent,
                              ActorPath path)
        Tries to locate the node specified by the path parts.
        Parameters:
        parent - the parent to start with
        path - the path elements to traverse (below the parent)
        Returns:
        the located node or null if none found
      • locate

        public Node locate​(String path)
        Locates the node in the tree based on the specified path.
        Parameters:
        path - the path of the node to locate
        Returns:
        the located node or null if none found
      • locateAndDisplay

        public void locateAndDisplay​(String path)
        Locates and selects the node in the tree based on the specified path. Does not focus the tree.
        Parameters:
        path - the path of the node to locate
      • locateAndDisplay

        public void locateAndDisplay​(String path,
                                     boolean focus)
        Locates and selects the node in the tree based on the specified path.
        Parameters:
        path - the path of the node to locate
        focus - whether to focus the tree
      • getPath

        public TreePath getPath​(Node node)
        Tries to find the node in the tree and returns the path to it.
        Parameters:
        node - the node to look for
        Returns:
        the path if the node was found, null otherwise
      • find

        public void find()
        Searches for actor names in the tree.
      • setLastSearchString

        public void setLastSearchString​(String value)
        Sets the last search string in use.
        Parameters:
        value - the search string
      • getLastSearchString

        public String getLastSearchString()
        Returns the last search string in use.
        Returns:
        the search string
      • setShowQuickInfo

        public void setShowQuickInfo​(boolean value)
        Sets whether to show the quick info or not.
        Parameters:
        value - if true then the quick info will be displayed
      • getShowQuickInfo

        public boolean getShowQuickInfo()
        Returns whether the quick info is shown or not.
        Returns:
        true if the quick info is shown
      • setShowAnnotations

        public void setShowAnnotations​(boolean value)
        Sets whether to show the annotations or not.
        Parameters:
        value - if true then the annotations will be displayed
      • getShowAnnotations

        public boolean getShowAnnotations()
        Returns whether the annotations are shown or not.
        Returns:
        true if the annotations are shown
      • setShowInputOutput

        public void setShowInputOutput​(boolean value)
        Sets whether to show the input/output information or not.
        Parameters:
        value - if true then the input/output information will be displayed
      • getShowInputOutput

        public boolean getShowInputOutput()
        Returns whether the input/output information is shown or not.
        Returns:
        true if the input/output information is shown
      • setInputOutputPrefixes

        public void setInputOutputPrefixes​(String[] value)
        Sets the class name prefixes to remove from the input/output info.
        Parameters:
        value - the prefixes
      • getInputOutputPrefixes

        public String[] getInputOutputPrefixes()
        Returns the class name prefixes to remove from the input/output info.
        Returns:
        the prefixes
      • setScaleFactor

        public void setScaleFactor​(double value)
        Sets the scale factor for the text/icons.
        Parameters:
        value - the scale factor (1.0 is actual size)
      • getScaleFactor

        public double getScaleFactor()
        Returns the scale factor for the text/icons.
        Returns:
        the scale factor (1.0 is actual size)
      • setState

        public void setState​(Tree.TreeState value)
        Sets the current state of the tree (tree, expansions, modified).
        Parameters:
        value - the state to use
      • getState

        public Tree.TreeState getState()
        Returns the current state of the tree (tree, expansions, modified). Is used for undo/redo.
        Returns:
        the current state
      • isDragEnabled

        protected boolean isDragEnabled()
        Returns whether dragging is enabled.
        Overrides:
        isDragEnabled in class DragAndDropTree
        Returns:
        always true
      • isDropEnabled

        protected boolean isDropEnabled()
        Returns whether dropping is enabled.
        Overrides:
        isDropEnabled in class DragAndDropTree
        Returns:
        always true
      • canStartDrag

        protected boolean canStartDrag​(BaseTreeNode source)
        Checks whether the source node can be dragged at all.

        The parent of the source node must a MutableActorHandler
        Parameters:
        source - the source node that is about to be dragged
        Returns:
        true if the source node can be dragged
      • enableBreakpoints

        protected void enableBreakpoints​(Node parent,
                                         boolean enable)
        Enables/disables all breakpoint actors.
        Parameters:
        parent - the parent node to start recursion from
        enable - if true all breakpoint actors get enabled, otherwise disabled
      • enableBreakpoints

        public void enableBreakpoints​(boolean enable)
        Enables/disables all breakpoint actors.
        Parameters:
        enable - if true all breakpoint actors get enabled, otherwise disabled
      • setEditable

        public void setEditable​(boolean value)
        Sets the tree editable or read-only. Also, forces the tree to redraw.
        Overrides:
        setEditable in class JTree
        Parameters:
        value - if false the tree will be read-only
      • getCurrentEditingNode

        public Node getCurrentEditingNode()
        Returns the node currently being edited.
        Returns:
        the node, null if none being edited
      • getCurrentEditingParent

        public Node getCurrentEditingParent()
        Returns the parent of the node currently being edited or being added.
        Returns:
        the node, null if none being edited/added
      • updateCurrentEditing

        public void updateCurrentEditing​(Node parent,
                                         Node node)
        Updates the current editing position.
        Parameters:
        parent - the parent of the current node
        node - the current node
      • refreshTabs

        public void refreshTabs()
        Refreshes the tabs.
      • setDebug

        public void setDebug​(boolean value)
        Sets the debug flag.
        Parameters:
        value - true if it is a debug flow, ie copy
      • isDebug

        public boolean isDebug()
        Returns the debug flag.
        Returns:
        true if it is a debug flow, ie copy
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface CleanUpHandler