Class TreeOperations

    • Field Detail

      • m_Owner

        protected Tree m_Owner
        the tree to operate on.
    • Constructor Detail

      • TreeOperations

        public TreeOperations​(Tree owner)
        Initializes the object.
        Parameters:
        owner - the tree to operate on
    • Method Detail

      • getOwner

        public Tree getOwner()
        Returns the owning tree.
        Returns:
        the tree
      • checkForStandalones

        public boolean checkForStandalones​(Actor actor,
                                           Node parent)
        Checks whether standalones can be placed beneath the parent actor. If the actor isn't a standalone, this method returns true, of course. In case the actor is a standalone and the parent doesn't allow standalones to be placed, an error message pops up and informs the user.
        Parameters:
        actor - the actor to place beneath the parent
        parent - the parent to place the actor beneath
        Returns:
        true if actor can be placed, false if not
      • checkForStandalones

        public boolean checkForStandalones​(Actor[] actors,
                                           Node parent)
        Checks whether standalones can be placed beneath the parent actor. If the actors contain no standalones, this method returns true, of course. In case the actors contain a standalone and the parent doesn't allow standalones to be placed, an error message pops up and informs the user.
        Parameters:
        actors - the actors to place beneath the parent
        parent - the parent to place the actor beneath
        Returns:
        true if actor can be placed, false if not
      • configureFilter

        public AbstractItemFilter configureFilter​(TreePath path,
                                                  TreeOperations.InsertPosition position)
        Configures a filter for the ClassTree.
        Parameters:
        path - the path where to insert the actor
        position - where to add the actor, if null "editing" an existing actor is assumed
        Returns:
        the configured filter
      • addActor

        public void addActor​(TreePath path,
                             Actor actor,
                             TreeOperations.InsertPosition position)
        Brings up the GOE dialog for adding an actor if no actor supplied, otherwise just adds the given actor at the position specified by the path.
        Parameters:
        path - the path to the actor to add the new actor sibling
        actor - the actor to add, if null a GOE dialog is presented
        position - where to insert the actor
      • addActor

        public void addActor​(TreePath path,
                             Actor actor,
                             TreeOperations.InsertPosition position,
                             boolean record)
        Brings up the GOE dialog for adding an actor if no actor supplied, otherwise just adds the given actor at the position specified by the path.
        Parameters:
        path - the path to the actor to add the new actor sibling
        actor - the actor to add, if null a GOE dialog is presented
        position - where to insert the actor
        record - whether to record the addition
      • addActor

        public void addActor​(TreePath path,
                             Actor actor,
                             TreeOperations.InsertPosition position,
                             boolean record,
                             TreeOperations.ActorDialog dialogType)
        Brings up the GOE dialog for adding an actor if no actor supplied, otherwise just adds the given actor at the position specified by the path.
        Parameters:
        path - the path to the actor to add the new actor sibling
        actor - the actor to add, if null a GOE dialog is presented
        position - where to insert the actor
        record - whether to record the addition
        dialogType - the dialog type to use
      • pasteNodes

        public void pasteNodes​(TreePath path,
                               Node[] nodes,
                               TreeOperations.InsertPosition position)
        For pasting nodes.
        Parameters:
        path - the path to the actor to add the new actor sibling
        nodes - the nodes to paste
        position - how to insert the nodes
      • favoriteActor

        public void favoriteActor​(TreePath path,
                                  TreeOperations.InsertPosition position,
                                  boolean record)
        Lets the user select an actor from a dialog of favorites.
        Parameters:
        path - the path to the actor to add the new actor sibling
        position - where to insert the actor
        record - whether to record the addition
      • editActor

        public void editActor​(TreePath path)
        Brings up the GOE dialog for editing the selected actor.
        Parameters:
        path - the path to the actor
      • renameActor

        public void renameActor​(TreePath path)
        Renames an actor.
        Parameters:
        path - the path to the actor
      • renameActor

        public void renameActor​(TreePath path,
                                String newName)
        Renames an actor.
        Parameters:
        path - the path to the actor
        newName - the new name for the actor
      • cleanUpActorName

        public void cleanUpActorName​(TreePath[] paths)
        Cleans up the names of actors.
        Parameters:
        paths - the paths to the actors
      • encloseActor

        public void encloseActor​(TreePath[] paths,
                                 ActorHandler handler)
        Encloses the selected actors in the specified actor handler.
        Parameters:
        paths - the (paths to the) actors to wrap in the control actor
        handler - the handler to use
      • pullUpActors

        public void pullUpActors​(TreePath path)
        Pulls up the actors of the selected mutable actor.
        Parameters:
        path - the (paths to the) actors to wrap in the control actor
      • swapActor

        public void swapActor​(TreePath sourcePath,
                              Actor target)
        Swaps the actor handler of the node with the new node, keeping the children intact, as well as some basic options.
        Parameters:
        sourcePath - the path to the actor to swap out
        target - the new handler to use
      • suggestActors

        public Actor[] suggestActors​(TreePath path,
                                     TreeOperations.InsertPosition position)
        Tries to figure what actors fit best in the tree at the given position.
        Parameters:
        path - the path where to insert the actors
        position - how the actors are to be inserted
        Returns:
        the actors
      • configureSuggestionContext

        public ActorSuggestion.SuggestionData configureSuggestionContext​(TreePath[] paths)
        Returns the context for making external actor suggestions.
        Parameters:
        paths - the paths of the actors to externalize
        Returns:
        the context
      • suggestExternalActors

        public Actor[] suggestExternalActors​(TreePath[] paths)
        Tries to figure what external actors fit best using the given selection of actors.
        Parameters:
        paths - the paths of the actors to externalize
        Returns:
        the actors
      • getProcessActorsDialog

        public GenericObjectEditorDialog getProcessActorsDialog​(String title)
        Returns the dialog for processing actors.
        Parameters:
        title - the title for the dialog, null for default
        Returns:
        the dialog
      • processActor

        public void processActor​(TreePath path,
                                 ActorProcessor processor)
        Processes the specified actor with the specified actor processor. NB: The options of the specified actor will get processed.
        Parameters:
        path - the path of the actor, if null the root actor is used
        processor - the processor to use, null if to prompt user
      • processActor

        public void processActor​(TreePath path,
                                 ActorProcessor processor,
                                 Runnable after)
        Processes the specified actor with the specified actor processor. NB: The options of the specified actor will get processed.
        Parameters:
        path - the path of the actor, if null the root actor is used
        processor - the processor to use, null if to prompt user
        after - runnable to execute after actors have been processed, null for none
      • createCallableActor

        public void createCallableActor​(TreePath path,
                                        Class handler)
        Turns the selected actor into a callable actor using the specified enclosing handler type.
        Parameters:
        path - the (path to the) actor to turn into callable actor
        handler - the callable actors handler
      • editFlow

        public void editFlow​(TreePath path)
        Brings up a flow window for editing the selected external actor's flow.
        Parameters:
        path - the path to the node
      • externalizeActor

        public void externalizeActor​(TreePath[] paths,
                                     Actor suggestion)
        Opens a new FlowEditor window with the currently selected sub-flow. Checks for callable actors and diplays confirmation dialog if so.
        Parameters:
        paths - the (paths to the) actors to externalize
        suggestion - the suggested actor to replace with
      • externalizeActor

        public void externalizeActor​(TreePath path,
                                     Actor suggestion)
        Opens a new FlowEditor window with the currently selected sub-flow. Checks for callable actors and diplays confirmation dialog if so.
        Parameters:
        path - the (path to the) actor to externalize
        suggestion - the suggested actor to replace with
      • externalizeActor

        protected void externalizeActor​(TreePath path,
                                        boolean checkCallActors,
                                        Actor suggestion)
        Opens a new FlowEditor window with the currently selected sub-flow.
        Parameters:
        path - the (path to the) actor to externalize
        checkCallActors - whether to check for callable actors
        suggestion - the suggested actor to replace with
      • chooseBooleanCondition

        protected BooleanCondition chooseBooleanCondition​(BooleanCondition defCond)
        Lets the user choose a boolean condition.
        Parameters:
        defCond - the default condition, can be null
        Returns:
        the boolean condition or null if dialog canceled
      • makeConditional

        public void makeConditional​(TreePath path)
        Turns the selected actor into its conditional equivalent.
        Parameters:
        path - the (path to the) actor to turn into its conditional equivalent
      • makeTimed

        public void makeTimed​(TreePath path)
        Turns the selected actor into its timed equivalent.
        Parameters:
        path - the (path to the) actor to turn into its timed equivalent
      • makeInteractive

        public void makeInteractive​(TreePath[] paths)
        Turns the selected Setvariable standalines into a subflow with EnterManyValues for prompting the user.
        Parameters:
        paths - the (paths to the) actors to turn interactive
      • inspectMemoryDetails

        public void inspectMemoryDetails​(TreePath path,
                                         Flow flow)
        Displays the memory consumption of the selected actor, broken by class.
        Parameters:
        path - the path of the actor
        flow - the running flow
      • inspectMemorySize

        public void inspectMemorySize​(TreePath path,
                                      Flow flow)
        Displays the memory consumption of the selected subtree (just the size).
        Parameters:
        path - the path of the actor
        flow - the running flow
      • getActorFromClipboard

        public static Actor getActorFromClipboard()
        Returns the actor stored on the clipboard.
        Returns:
        the actor or null if none available
      • hasNodesOnClipboard

        public static boolean hasNodesOnClipboard()
        Checks whether any nodes in nested listed form are on the clipboard.
        Returns:
        true if nodes available
      • getListsFromClipboard

        public static List[] getListsFromClipboard()
        Returns the nested lists stored on the clipboard.
        Returns:
        the nodes or null if none available
      • cleanUp

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