Class FlowPanel

    • Field Detail

      • m_Properties

        protected static Properties m_Properties
        the properties.
      • m_LastFlow

        protected Actor m_LastFlow
        the last flow that was run.
      • m_CurrentFile

        protected File m_CurrentFile
        the filename of the current flow.
      • m_CurrentWorker

        protected FlowWorker m_CurrentWorker
        the current worker.
      • m_CurrentThread

        protected Thread m_CurrentThread
        the current worker thread.
      • m_RunningSwingWorker

        protected boolean m_RunningSwingWorker
        whether a swingworker is currently running.
      • m_SplitPaneTrees

        protected BaseSplitPane m_SplitPaneTrees
        the split pane for the trees (edit/debug).
      • m_SplitPaneEditor

        protected BaseSplitPane m_SplitPaneEditor
        the split pane to use for tree and notification area.
      • m_Tree

        protected Tree m_Tree
        the tree displaying the flow structure.
      • m_DebugTree

        protected Tree m_DebugTree
        the tree displaying the debug flow structure.
      • m_PanelDebugTree

        protected JPanel m_PanelDebugTree
        the panel with the debug tree.
      • m_LastVariableSearch

        protected String m_LastVariableSearch
        the last variable search performed.
      • m_PanelStorage

        protected StoragePanel m_PanelStorage
        the panel with the variables.
      • m_TitleGenerator

        protected TitleGenerator m_TitleGenerator
        for generating the title of the dialog/frame.
      • m_Title

        protected String m_Title
        the current title.
      • m_Status

        protected String m_Status
        the current status.
      • m_Headless

        protected boolean m_Headless
        whether to execute the flow in headless mode.
      • m_RunGC

        protected boolean m_RunGC
        whether to perform a GC after the flow execution.
      • m_CheckOnSave

        protected boolean m_CheckOnSave
        whether to check before saving.
      • m_CheckLargeFlowsOnSave

        protected Boolean m_CheckLargeFlowsOnSave
        whether to check large flows before saving.
      • m_PanelBottom

        protected BasePanel m_PanelBottom
        the bottom panel.
      • m_LastReader

        protected FlowReader m_LastReader
        the last flow reader used.
      • m_LastWriter

        protected FlowWriter m_LastWriter
        the last flow writer used.
      • m_FlowFileMonitor

        protected MultiMonitor m_FlowFileMonitor
        for monitoring file changes.
      • m_Logger

        protected Logger m_Logger
        the logger instance.
    • Constructor Detail

      • FlowPanel

        public FlowPanel()
        Initializes the panel with no owner.
      • FlowPanel

        public FlowPanel​(FlowMultiPagePane owner)
        Initializes the panel with an owner.
        Parameters:
        owner - the owning tabbed pane
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class UndoPanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class BasePanel
      • finishInit

        protected void finishInit()
        Finishes up the initialization.
        Overrides:
        finishInit in class BasePanel
      • getOwner

        public FlowMultiPagePane getOwner()
        Returns the editor this panel belongs to.
        Returns:
        the editor, null if none set
      • getKnownParent

        public Container getKnownParent()
        Returns the component that acts as this component's parent.
        Specified by:
        getKnownParent in interface KnownParentSupporter
        Returns:
        the parent, null if not available
      • setPageIcon

        public void setPageIcon​(String icon)
        Sets the page icon.
        Specified by:
        setPageIcon in interface MultiPageIconSupporter
        Parameters:
        icon - the name of the icon, null to unset it
      • getEditor

        public FlowEditorPanel getEditor()
        Returns the editor this panel belongs to.
        Returns:
        the editor, null if none set
      • setHeadless

        public void setHeadless​(boolean value)
        Sets whether to execute the flow in headless mode.
        Parameters:
        value - if true the flow gets executed in headless mode
      • isHeadless

        public boolean isHeadless()
        Returns whether the flow gets executed in headless mode.
        Specified by:
        isHeadless in interface FlowWorkerHandler
        Returns:
        true if the flow gets executed in headless mode
      • setRunGC

        public void setRunGC​(boolean value)
        Sets whether to run the GC after the flow finished executing.
        Parameters:
        value - if true GC gets called
      • getRunGC

        public boolean getRunGC()
        Returns whether the GC gets called after the flow execution.
        Specified by:
        getRunGC in interface FlowWorkerHandler
        Returns:
        true if to run GC
      • setCheckOnSave

        public void setCheckOnSave​(boolean value)
        Sets whether to perform a check before saving the flow.
        Parameters:
        value - true if to check before saving
      • getCheckOnSave

        public boolean getCheckOnSave()
        Returns whether to perform a check before saving the flow.
        Returns:
        true if to check before saving
      • updateWidgets

        public void updateWidgets()
        Updates the enabled state of the widgets.
      • update

        public void update()
        updates the enabled state etc. of all the GUI elements.
        Specified by:
        update in interface FlowWorkerHandler
      • setTitle

        public void setTitle​(String value)
        Sets the title for this flow.
        Parameters:
        value - the title
      • getTitle

        public String getTitle()
        Returns the base title of the flow.
        Returns:
        the title
      • generateTitle

        public String generateTitle()
        Generates the title to use.
        Returns:
        the title
      • updateTitle

        public void updateTitle()
        Updates the title of the dialog/frame if the title generator is enabled.
        See Also:
        getTitleGenerator()
      • reset

        public void reset​(Actor actor)
        Resets the GUI to default values.
        Parameters:
        actor - the actor to instantiate
      • setCurrentFile

        public void setCurrentFile​(File value)
        Sets the current file.
        Parameters:
        value - the file
      • updateCurrentFile

        public void updateCurrentFile​(File file)
        Just updates the current file.
        Parameters:
        file - the file
      • getCurrentFile

        public File getCurrentFile()
        Returns the current file in use.
        Returns:
        the current file, can be null
      • getTitleGenerator

        public TitleGenerator getTitleGenerator()
        Returns the title generator in use.
        Returns:
        the generator
      • load

        public void load​(FlowReader reader,
                         File file)
        Loads a flow.
        Parameters:
        reader - the reader to use
        file - the flow to load
      • load

        public void load​(FlowReader reader,
                         File file,
                         boolean execute)
        Loads a flow and optionally executes it.
        Parameters:
        reader - the reader to use
        file - the flow to load
        execute - whether to execute the flow once loaded
      • load

        public void load​(FlowReader reader,
                         File file,
                         boolean execute,
                         SwingWorker action)
        Loads a flow and optionally executes it.
        Parameters:
        reader - the reader to use
        file - the flow to load
        execute - whether to execute the flow once loaded
        action - the SwingWorker to execute once the flow has been loaded, can be null
      • setCurrentFlow

        public void setCurrentFlow​(Actor flow)
        Sets the flow to work on.
        Parameters:
        flow - the flow to use
      • setCurrentFlow

        public void setCurrentFlow​(Node flow)
        Sets the flow to work on.
        Parameters:
        flow - the flow to use
      • getCurrentFlow

        public Actor getCurrentFlow()
        Returns the current 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 getCurrentRoot() instead.
        Returns:
        the current flow
        See Also:
        getCurrentRoot()
      • getCurrentFlow

        public Actor getCurrentFlow​(StringBuilder errors)
        Returns the current 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 getCurrentRoot() instead.
        Parameters:
        errors - for storing potential errors, use null to ignore
        Returns:
        the current flow
        See Also:
        getCurrentRoot()
      • getCurrentRoot

        public Actor getCurrentRoot()
        Returns the current root actor without its children.
        Returns:
        the current root actor
        See Also:
        getCurrentFlow()
      • getRunningFlow

        public Actor getRunningFlow()
        Returns the currently running flow.
        Returns:
        the running flow, null if none running right now
        See Also:
        isRunning()
      • setLastFlow

        public void setLastFlow​(Actor actor)
        Sets the flow that was last executed.
        Specified by:
        setLastFlow in interface FlowWorkerHandler
        Parameters:
        actor - the flow
      • getLastFlow

        public Actor getLastFlow()
        Returns the last executed flow (if any).
        Specified by:
        getLastFlow in interface FlowWorkerHandler
        Returns:
        the flow, null if not available
      • getLastReader

        public FlowReader getLastReader()
        Returns the last flow reader in use.
        Returns:
        the reader, null if not available
      • getLastWriter

        public FlowWriter getLastWriter()
        Returns the last flow writer in use.
        Returns:
        the writer, null if not available
      • setModified

        public void setModified​(boolean value)
        Sets whether the flow is modified or not.
        Parameters:
        value - true if the flow is to be flagged as modified
      • isModified

        public boolean isModified()
        Returns whether the flow is flagged as modified.
        Specified by:
        isModified in interface FlowWorkerHandler
        Returns:
        true if the flow is modified
      • canRevert

        public boolean canRevert()
        Returns whether a revert action is possible.
        Returns:
        true if possible
      • revert

        public void revert()
        Reverts a flow.
      • save

        public void save​(FlowWriter writer,
                         File file)
        Saves the flow.
        Parameters:
        writer - the writer to use
        file - the file to save the flow to
      • importFlow

        public void importFlow​(OptionConsumer consumer,
                               File file)
        Imports a flow.
        Parameters:
        consumer - the consumer to use
        file - the file to import
      • exportFlow

        public void exportFlow​(OptionProducer producer,
                               File file)
        Exports the flow.
        Parameters:
        producer - the producer to use
        file - the file to export to
      • run

        public void run()
        Executes the flow.
      • run

        public void run​(boolean showNotification,
                        boolean debug)
        Executes the flow.
        Parameters:
        showNotification - whether to show notifications about errors/stopped/finished
        debug - whether to run in debug mode
      • finishedExecution

        public void finishedExecution()
        Finishes up the execution, setting the worker to null.
        Specified by:
        finishedExecution in interface FlowWorkerHandler
      • isRunning

        public boolean isRunning()
        Returns whether a flow is currently running.
        Returns:
        true if a flow is being executed
      • isStopping

        public boolean isStopping()
        Returns whether a flow is currently being stopped.
        Returns:
        true if a flow is currently being stopped
      • isPaused

        public boolean isPaused()
        Returns whether a flow is currently running.
        Returns:
        true if a flow is being executed
      • isSwingWorkerRunning

        public boolean isSwingWorkerRunning()
        Returns whether a swing worker is currently running.
        Returns:
        true if a swing worker is being executed
      • pauseAndResume

        public boolean pauseAndResume()
        Pauses/resumes the flow.
        Returns:
        true if paused, otherwise false
      • stop

        public void stop()
        Stops the flow. Does not cleanUp.
        See Also:
        stop(boolean)
      • stop

        public void stop​(boolean cleanUp)
        Stops the flow.
        Parameters:
        cleanUp - whether to clean up as well
      • kill

        public void kill()
        Kills the flow.
      • cleanUp

        public void cleanUp()
        Cleans up the last flow that was run.
        Specified by:
        cleanUp in interface CleanUpHandler
      • close

        public void close()
        Cleans up and closes the tab.
      • addUndoPoint

        public void addUndoPoint​(String statusMsg,
                                 String undoComment)
        Adds an undo point, if possible.
        Parameters:
        statusMsg - the status message to display while adding the undo point
        undoComment - the comment for the undo point
      • addUndoPoint

        public void addUndoPoint​(String comment)
        Adds an undo point with the given comment.
        Specified by:
        addUndoPoint in interface UndoHandlerWithQuickAccess
        Parameters:
        comment - the comment for the undo point
      • 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
      • processActorsPrompt

        public void processActorsPrompt​(ActorProcessor processor)
        If a single actor is selected, user gets prompted whether to only process below this actor instead of full flow.
        Parameters:
        processor - the processor to use, null if to prompt user
      • processActors

        public void processActors​(ActorProcessor processor)
        Processes the actors with the specified actor processor.
        Parameters:
        processor - the processor to use, null if to prompt user
      • processSelectedActor

        public void processSelectedActor​(ActorProcessor processor)
        Processes the selected actor with a user-specified actor processor. NB: The options of the selected actor will get processed.
        Parameters:
        processor - the processor to use, null if to prompt user
      • enableBreakpoints

        public void enableBreakpoints​(boolean enable)
        Enables/disables all breakpoints in the flow (before execution).
        Parameters:
        enable - if true then breakpoints get enabled
      • showVariables

        public void showVariables()
        Displays the variables in the currently running flow.
      • showStorage

        public void showStorage()
        Displays the storage in the currently running flow.
      • closeStorage

        public void closeStorage()
        Closes the storage dialog if currently open.
      • setZoom

        public void setZoom​(double value)
        Sets the zoom to use.
        Parameters:
        value - the zoom, 1.0 is default
      • getZoom

        public double getZoom()
        Returns the current zoom.
        Returns:
        the zoom, 1.0 is default
      • getStatus

        public String getStatus()
        Returns the current status.
        Returns:
        the status, if any
      • showStatus

        public void showStatus​(boolean left,
                               String msg)
        Displays a message.
        Specified by:
        showStatus in interface StatusMessageHandlerExt
        Parameters:
        left - whether to show the message on the left or right
        msg - the message to display
      • grabFocus

        public void grabFocus()
        Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. This component must be displayable, visible, and focusable for the request to be granted.
        Overrides:
        grabFocus in class JComponent
      • requestFocus

        public void requestFocus()
        The tree requests the focus.
        Overrides:
        requestFocus in class JComponent
      • getDebugTree

        public Tree getDebugTree()
        Returns the debug tree.
        Returns:
        the debug tree
      • isDebugTreeVisible

        public boolean isDebugTreeVisible()
        Returns whether the debug tree is visible.
        Returns:
        true if visible
      • setDebugTreeVisible

        public void setDebugTreeVisible​(boolean value)
        Sets whether the debug tree is visible.
        Parameters:
        value - true if visible
      • hasSendToItem

        public boolean hasSendToItem​(Class[] cls)
        Checks whether something to send is available.
        Specified by:
        hasSendToItem in interface SendToActionSupporter
        Parameters:
        cls - the classes to retrieve the item for
        Returns:
        true if an object is available for sending
      • getSendToItem

        public Object getSendToItem​(Class[] cls)
        Returns the object to send.
        Specified by:
        getSendToItem in interface SendToActionSupporter
        Parameters:
        cls - the classes to retrieve the item for
        Returns:
        the item to send
      • redraw

        public void redraw()
        Redraws the tree.
      • getTabHandlers

        public List<AbstractTabHandler> getTabHandlers()
        Returns the tab handlers.
        Returns:
        the handlers
      • getTabHandler

        public <T> T getTabHandler​(Class<T> cls)
        Returns the tab handlers.
        Returns:
        the handlers
      • showNotification

        public void showNotification​(JComponent comp,
                                     String icon)
        Displays the notification component.
        Specified by:
        showNotification in interface FlowWorkerHandler
        Parameters:
        comp - the component to display
        icon - the icon to display, null for none
      • isInputEnabled

        public boolean isInputEnabled()
        Returns whether the flow accepts input.
        Returns:
        true if user can change flow
      • startBackgroundTask

        public boolean startBackgroundTask​(Runnable runnable,
                                           String statusMsg,
                                           boolean clearMsg)
        For starting background tasks. Block user from running other background tasks till finished.
        Parameters:
        runnable - the task to execute
        statusMsg - the status message to display
        clearMsg - whether to clear the message at the end; use false if your task displays a message in the status bar
        Returns:
        true if successfully started, false if another task is currently running
      • getProperties

        public static Properties getProperties()
        Returns the properties that define the editor.
        Returns:
        the properties
      • configureUI

        public static void configureUI​(Tree tree)
        Configures the UI of the tree with parameters from the properties.
        Parameters:
        tree - the tree to configure
        See Also:
        getProperties()