Package adams.gui.flow
Class FlowPanel
-
- All Implemented Interfaces:
CleanUpHandler
,LoggingSupporter
,StatusMessageHandler
,StatusMessageHandlerExt
,KnownParentSupporter
,MultiPageIconSupporter
,UndoHandler
,UndoHandlerWithQuickAccess
,UndoListener
,FlowTreeHandler
,FlowWorkerHandler
,SendToActionSupporter
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
public class FlowPanel extends UndoPanel implements StatusMessageHandlerExt, SendToActionSupporter, FlowTreeHandler, MultiPageIconSupporter, FlowWorkerHandler, UndoHandlerWithQuickAccess, KnownParentSupporter, LoggingSupporter
A panel for setting up, modifying, saving and loading "simple" flows.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected Boolean
m_CheckLargeFlowsOnSave
whether to check large flows before saving.protected boolean
m_CheckOnSave
whether to check before saving.protected File
m_CurrentFile
the filename of the current flow.protected Thread
m_CurrentThread
the current worker thread.protected FlowWorker
m_CurrentWorker
the current worker.protected Tree
m_DebugTree
the tree displaying the debug flow structure.protected MultiMonitor
m_FlowFileMonitor
for monitoring file changes.protected boolean
m_Headless
whether to execute the flow in headless mode.protected Actor
m_LastFlow
the last flow that was run.protected FlowReader
m_LastReader
the last flow reader used.protected String
m_LastVariableSearch
the last variable search performed.protected FlowWriter
m_LastWriter
the last flow writer used.protected Logger
m_Logger
the logger instance.protected FlowMultiPagePane
m_Owner
the owner.protected BasePanel
m_PanelBottom
the bottom panel.protected JPanel
m_PanelDebugTree
the panel with the debug tree.protected FlowPanelNotificationArea
m_PanelNotification
the panel for showing notifications.protected StoragePanel
m_PanelStorage
the panel with the variables.protected VariableManagementPanel
m_PanelVariables
the panel with the variables.protected static Properties
m_Properties
the properties.protected RecentFilesHandlerWithCommandline<JMenu>
m_RecentFilesHandler
the recent files handler.protected boolean
m_RunGC
whether to perform a GC after the flow execution.protected boolean
m_RunningSwingWorker
whether a swingworker is currently running.protected BaseSplitPane
m_SplitPaneEditor
the split pane to use for tree and notification area.protected BaseSplitPane
m_SplitPaneTrees
the split pane for the trees (edit/debug).protected String
m_Status
the current status.protected List<AbstractTabHandler>
m_TabHandlers
the tab handlers.protected String
m_Title
the current title.protected TitleGenerator
m_TitleGenerator
for generating the title of the dialog/frame.protected Tree
m_Tree
the tree displaying the flow structure.static String
PREFIX_FLOW
the prefix for the title of custom set flows.static String
PREFIX_NEW
the prefix for the title of new tabs.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description FlowPanel()
Initializes the panel with no owner.FlowPanel(FlowMultiPagePane owner)
Initializes the panel with an owner.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUndoPoint(String comment)
Adds an undo point with the given comment.void
addUndoPoint(String statusMsg, String undoComment)
Adds an undo point, if possible.boolean
canRevert()
Returns whether a revert action is possible.void
cleanUp()
Cleans up the last flow that was run.void
clearNotification()
Removes the notification.void
close()
Cleans up and closes the tab.void
closeStorage()
Closes the storage dialog if currently open.static void
configureUI(Tree tree)
Configures the UI of the tree with parameters from the properties.void
enableBreakpoints(boolean enable)
Enables/disables all breakpoints in the flow (before execution).void
exportFlow(OptionProducer producer, File file)
Exports the flow.void
finishedExecution()
Finishes up the execution, setting the worker to null.protected void
finishInit()
Finishes up the initialization.String
generateTitle()
Generates the title to use.boolean
getCheckOnSave()
Returns whether to perform a check before saving the flow.File
getCurrentFile()
Returns the current file in use.Actor
getCurrentFlow()
Returns the current flow.Actor
getCurrentFlow(StringBuilder errors)
Returns the current flow.Actor
getCurrentRoot()
Returns the current root actor without its children.Tree
getDebugTree()
Returns the debug tree.FlowEditorPanel
getEditor()
Returns the editor this panel belongs to.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.Container
getKnownParent()
Returns the component that acts as this component's parent.Actor
getLastFlow()
Returns the last executed flow (if any).FlowReader
getLastReader()
Returns the last flow reader in use.FlowWriter
getLastWriter()
Returns the last flow writer in use.Logger
getLogger()
Returns the logger in use.FlowMultiPagePane
getOwner()
Returns the editor this panel belongs to.static Properties
getProperties()
Returns the properties that define the editor.RecentFilesHandlerWithCommandline<JMenu>
getRecentFilesHandler()
Returns the recent files handler to use.boolean
getRunGC()
Returns whether the GC gets called after the flow execution (or is being cleaned up).Actor
getRunningFlow()
Returns the currently running flow.Class[]
getSendToClasses()
Returns the classes that the supporter generates.Object
getSendToItem(Class[] cls)
Returns the object to send.BaseSplitPane
getSplitPane()
Returns the split pane.String
getStatus()
Returns the current status.StoragePanel
getStoragePanel()
Returns the panel with the storage items.<T> T
getTabHandler(Class<T> cls)
Returns the tab handlers.List<AbstractTabHandler>
getTabHandlers()
Returns the tab handlers.String
getTitle()
Returns the base title of the flow.TitleGenerator
getTitleGenerator()
Returns the title generator in use.Tree
getTree()
Returns the tree.VariableManagementPanel
getVariablesPanel()
Returns the panel with the variables.double
getZoom()
Returns the current zoom.void
grabFocus()
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window.boolean
hasSendToItem(Class[] cls)
Checks whether something to send is available.void
importFlow(OptionConsumer consumer, File file)
Imports a flow.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.boolean
isDebugTreeVisible()
Returns whether the debug tree is visible.boolean
isHeadless()
Returns whether the flow gets executed in headless mode.boolean
isInputEnabled()
Returns whether the flow accepts input.boolean
isLoggingEnabled()
Returns whether logging is enabled.boolean
isModified()
Returns whether the flow is flagged as modified.boolean
isPaused()
Returns whether a flow is currently running.boolean
isRunning()
Returns whether a flow is currently running.boolean
isStopping()
Returns whether a flow is currently being stopped.boolean
isSwingWorkerRunning()
Returns whether a swing worker is currently running.void
kill()
Kills the flow.void
load(FlowReader reader, File file)
Loads a flow.void
load(FlowReader reader, File file, boolean execute)
Loads a flow and optionally executes it.void
load(FlowReader reader, File file, boolean execute, SwingWorker action)
Loads a flow and optionally executes it.boolean
pauseAndResume()
Pauses/resumes the flow.void
processActors(ActorProcessor processor)
Processes the actors with the specified actor processor.void
processActorsPrompt(ActorProcessor processor)
If a single actor is selected, user gets prompted whether to only process below this actor instead of full flow.void
processSelectedActor(ActorProcessor processor)
Processes the selected actor with a user-specified actor processor.void
redo()
performs a redo if possible.void
redraw()
Redraws the tree.void
requestFocus()
The tree requests the focus.void
reset(Actor actor)
Resets the GUI to default values.void
revert()
Reverts a flow.void
run()
Executes the flow.void
run(boolean showNotification, boolean debug)
Executes the flow.void
save(FlowWriter writer, File file)
Saves the flow.void
setCheckOnSave(boolean value)
Sets whether to perform a check before saving the flow.void
setCurrentFile(File value)
Sets the current file.void
setCurrentFlow(Actor flow)
Sets the flow to work on.void
setCurrentFlow(Node flow)
Sets the flow to work on.void
setDebugTreeVisible(boolean value)
Sets whether the debug tree is visible.void
setHeadless(boolean value)
Sets whether to execute the flow in headless mode.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.void
setLastFlow(Actor actor)
Sets the flow that was last executed.void
setModified(boolean value)
Sets whether the flow is modified or not.void
setPageIcon(String icon)
Sets the page icon.void
setRecentFilesHandler(RecentFilesHandlerWithCommandline<JMenu> value)
Sets the recent files handler to use.void
setRunGC(boolean value)
Sets whether to run the GC after the flow finished executing (or is being cleaned up).void
setTitle(String value)
Sets the title for this flow.void
setZoom(double value)
Sets the zoom to use.void
showNotification(String msg, FlowPanelNotificationArea.NotificationType type)
Displays the notification text.void
showNotification(JComponent comp, String icon)
Displays the notification component.void
showStatus(boolean left, String msg)
Displays a message.void
showStatus(String msg)
Displays a message.void
showStorage()
Displays the storage in the currently running flow.void
showVariables()
Displays the variables in the currently running flow.boolean
startBackgroundTask(Runnable runnable, String statusMsg, boolean clearMsg)
For starting background tasks.void
stop()
Stops the flow.void
stop(boolean cleanUp)
Stops the flow.void
undo()
performs an undo if possible.void
undoOccurred(UndoEvent e)
An undo event occurred.void
update()
updates the enabled state etc.void
updateCurrentFile(File file)
Just updates the current file.void
updateTitle()
Updates the title of the dialog/frame if the title generator is enabled.void
updateWidgets()
Updates the enabled state of the widgets.-
Methods inherited from class adams.gui.core.UndoPanel
getUndo, isUndoSupported, setUndo
-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.gui.core.UndoHandler
getUndo, isUndoSupported, setUndo
-
-
-
-
Field Detail
-
PREFIX_NEW
public static final String PREFIX_NEW
the prefix for the title of new tabs.- See Also:
- Constant Field Values
-
PREFIX_FLOW
public static final String PREFIX_FLOW
the prefix for the title of custom set flows.- See Also:
- Constant Field Values
-
m_Properties
protected static Properties m_Properties
the properties.
-
m_Owner
protected FlowMultiPagePane m_Owner
the owner.
-
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_RecentFilesHandler
protected RecentFilesHandlerWithCommandline<JMenu> m_RecentFilesHandler
the recent files handler.
-
m_LastVariableSearch
protected String m_LastVariableSearch
the last variable search performed.
-
m_PanelVariables
protected VariableManagementPanel m_PanelVariables
the panel with the variables.
-
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_TabHandlers
protected List<AbstractTabHandler> m_TabHandlers
the tab handlers.
-
m_PanelBottom
protected BasePanel m_PanelBottom
the bottom panel.
-
m_PanelNotification
protected FlowPanelNotificationArea m_PanelNotification
the panel for showing notifications.
-
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 classUndoPanel
-
finishInit
protected void finishInit()
Finishes up the initialization.- Overrides:
finishInit
in classBasePanel
-
getOwner
public FlowMultiPagePane getOwner()
Returns the editor this panel belongs to.- Returns:
- the editor, null if none set
-
getLogger
public Logger getLogger()
Returns the logger in use.- Specified by:
getLogger
in interfaceLoggingSupporter
- Returns:
- the logger
-
isLoggingEnabled
public boolean isLoggingEnabled()
Returns whether logging is enabled.- Specified by:
isLoggingEnabled
in interfaceLoggingSupporter
- Returns:
- true if at least
Level.INFO
-
getKnownParent
public Container getKnownParent()
Returns the component that acts as this component's parent.- Specified by:
getKnownParent
in interfaceKnownParentSupporter
- Returns:
- the parent, null if not available
-
setPageIcon
public void setPageIcon(String icon)
Sets the page icon.- Specified by:
setPageIcon
in interfaceMultiPageIconSupporter
- 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 interfaceFlowWorkerHandler
- 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 (or is being cleaned up).- Parameters:
value
- if true GC gets called
-
getRunGC
public boolean getRunGC()
Returns whether the GC gets called after the flow execution (or is being cleaned up).- Specified by:
getRunGC
in interfaceFlowWorkerHandler
- 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 interfaceFlowWorkerHandler
-
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 usefile
- 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 usefile
- the flow to loadexecute
- 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 usefile
- the flow to loadexecute
- whether to execute the flow once loadedaction
- 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 interfaceFlowWorkerHandler
- Parameters:
actor
- the flow
-
getLastFlow
public Actor getLastFlow()
Returns the last executed flow (if any).- Specified by:
getLastFlow
in interfaceFlowWorkerHandler
- 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 interfaceFlowWorkerHandler
- 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 usefile
- the file to save the flow to
-
importFlow
public void importFlow(OptionConsumer consumer, File file)
Imports a flow.- Parameters:
consumer
- the consumer to usefile
- the file to import
-
exportFlow
public void exportFlow(OptionProducer producer, File file)
Exports the flow.- Parameters:
producer
- the producer to usefile
- 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/finisheddebug
- whether to run in debug mode
-
finishedExecution
public void finishedExecution()
Finishes up the execution, setting the worker to null.- Specified by:
finishedExecution
in interfaceFlowWorkerHandler
-
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 interfaceCleanUpHandler
-
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 pointundoComment
- the comment for the undo point
-
addUndoPoint
public void addUndoPoint(String comment)
Adds an undo point with the given comment.- Specified by:
addUndoPoint
in interfaceUndoHandlerWithQuickAccess
- Parameters:
comment
- the comment for the undo point
-
undo
public void undo()
performs an undo if possible.- Specified by:
undo
in interfaceUndoHandlerWithQuickAccess
-
redo
public void redo()
performs a redo if possible.- Specified by:
redo
in interfaceUndoHandlerWithQuickAccess
-
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
-
getVariablesPanel
public VariableManagementPanel getVariablesPanel()
Returns the panel with the variables.- Specified by:
getVariablesPanel
in interfaceFlowWorkerHandler
- Returns:
- the panel, null if not available
-
getStoragePanel
public StoragePanel getStoragePanel()
Returns the panel with the storage items.- Specified by:
getStoragePanel
in interfaceFlowWorkerHandler
- Returns:
- always null
-
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(String msg)
Displays a message.- Specified by:
showStatus
in interfaceStatusMessageHandler
- Parameters:
msg
- the message to display
-
showStatus
public void showStatus(boolean left, String msg)
Displays a message.- Specified by:
showStatus
in interfaceStatusMessageHandlerExt
- Parameters:
left
- whether to show the message on the left or rightmsg
- the message to display
-
undoOccurred
public void undoOccurred(UndoEvent e)
An undo event occurred.- Specified by:
undoOccurred
in interfaceUndoListener
- Parameters:
e
- the event
-
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 classJComponent
-
requestFocus
public void requestFocus()
The tree requests the focus.- Overrides:
requestFocus
in classJComponent
-
getSplitPane
public BaseSplitPane getSplitPane()
Returns the split pane.- Specified by:
getSplitPane
in interfaceFlowWorkerHandler
- Returns:
- the split pane
-
getTree
public Tree getTree()
Returns the tree.- Specified by:
getTree
in interfaceFlowTreeHandler
- Returns:
- the tree
-
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
-
setRecentFilesHandler
public void setRecentFilesHandler(RecentFilesHandlerWithCommandline<JMenu> value)
Sets the recent files handler to use.- Parameters:
value
- the handler to use
-
getRecentFilesHandler
public RecentFilesHandlerWithCommandline<JMenu> getRecentFilesHandler()
Returns the recent files handler to use.- Returns:
- the handler in use, null if none set
-
getSendToClasses
public Class[] getSendToClasses()
Returns the classes that the supporter generates.- Specified by:
getSendToClasses
in interfaceSendToActionSupporter
- Returns:
- the classes
-
hasSendToItem
public boolean hasSendToItem(Class[] cls)
Checks whether something to send is available.- Specified by:
hasSendToItem
in interfaceSendToActionSupporter
- 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 interfaceSendToActionSupporter
- 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(String msg, FlowPanelNotificationArea.NotificationType type)
Displays the notification text.- Specified by:
showNotification
in interfaceFlowWorkerHandler
- Parameters:
msg
- the text to displaytype
- the type of notification (info/warning/error)
-
showNotification
public void showNotification(JComponent comp, String icon)
Displays the notification component.- Specified by:
showNotification
in interfaceFlowWorkerHandler
- Parameters:
comp
- the component to displayicon
- the icon to display, null for none
-
clearNotification
public void clearNotification()
Removes the notification.- Specified by:
clearNotification
in interfaceFlowWorkerHandler
-
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 executestatusMsg
- the status message to displayclearMsg
- 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()
-
-