Package adams.flow.sink
Class AbstractTextualDisplay
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,TextSupporter,VariablesInspectionHandler,VariableChangeListener,Actor,ClearableDisplay,DisplayTypeSupporter,ErrorHandler,FlowControlSubMenuSupporter,HeadlessExecutionSupporter,InputConsumer,TextSupplier,MenuBarProvider,SendToActionSupporter,Serializable,Comparable
- Direct Known Subclasses:
ContainerDisplay,Display,EmailViewer,HistoryDisplay,PropertiesDisplay,ReportDisplay,SpreadSheetDisplay
public abstract class AbstractTextualDisplay extends AbstractDisplay implements MenuBarProvider, TextSupplier, SendToActionSupporter, ClearableDisplay, FlowControlSubMenuSupporter
Ancestor for actors that display textual stuff.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_AlwaysClearwhether to always clear the display before a token is processed.protected TextFileChooserm_FileChooserthe filedialog for loading/saving flows.protected Fontm_Fontthe font to use.protected JMenuBarm_MenuBarthe menu bar, if used.protected JMenuItemm_MenuItemFileClearthe "clear" menu item.protected JMenuItemm_MenuItemFileClosethe "exit" menu item.protected JMenuItemm_MenuItemFileSaveAsthe "save as" menu item.protected JMenuItemm_MenuItemFlowPauseResumethe "pause/resume" menu item.protected JMenuItemm_MenuItemFlowStopthe "stop" menu item.protected booleanm_ShowFlowControlSubMenuwhether to show flow control sub-menu.protected AbstractTextWriterm_Writerthe text writer to use.-
Fields inherited from class adams.flow.core.AbstractDisplay
BACKUP_INPUT, m_CreateFrame, m_DisplayType, m_Frame, m_Height, m_InputToken, m_KeepOpen, m_Panel, m_ResetGUIWaiting, m_ShortTitle, m_Updating, m_Width, m_X, m_Y
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description AbstractTextualDisplay()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringalwaysClearTipText()Returns the tip text for this property.protected booleancanPauseOrResume()Returns whether the flow can be paused/resumed.voidcleanUp()Cleans up after the execution has finished.protected voidcleanUpGUI()Removes all graphical components.voidclear()Clears the display.protected voidclose()Closes the dialog or frame.protected JMenucreateFileMenu()Creates the "File" menu.protected JMenucreateFlowMenu()Creates the flow control sub-menu.protected JMenuBarcreateMenuBar()Assembles the menu bar.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecuteHeadless()Executes the flow item in headless mode.StringfontTipText()Returns the tip text for this property.booleangetAlwaysClear()Returns whether the display is always cleared before processing a token.StringgetCustomSupplyTextMenuItemCaption()Returns the text for the menu item.ExtensionFileFiltergetCustomTextFileFilter()Returns a custom file filter for the file chooser.protected FontgetDefaultFont()Returns the default font for the dialog.protected TextFileChoosergetFileChooser()Returns (and initializes if necessary) the file chooser.FontgetFont()Returns the currently set font of the dialog.JMenuBargetMenuBar()Creates a menu bar (singleton per panel object).StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.Class[]getSendToClasses()Returns the classes that the supporter generates.ObjectgetSendToItem(Class[] cls)Returns the object to send.booleangetShowFlowControlSubMenu()Returns whether to show a flow control sub-menu in the menubar.AbstractTextWritergetWriter()Returns the writer.booleanhasSendToItem(Class[] cls)Checks whether something to send is available.protected intindexOfMenuItem(JMenu menu, JMenuItem menuitem)Determines the index of the menu item in the specified menu.protected voidinitialize()Initializes the members.protected booleanisPaused()Returns whether the flow is currently paused.protected voidpauseResumeFlow()Pauses or resumes the flow.protected voidpreDisplay(Token token)Before the token is displayed.protected voidsaveAs()Saves the setups.voidsetAlwaysClear(boolean value)Sets whether to always clear the display before processing a token.voidsetFont(Font value)Sets the font of the dialog.voidsetShowFlowControlSubMenu(boolean value)Sets whether to show a flow control sub-menu in the menubar.voidsetWriter(AbstractTextWriter value)Sets the writer.StringshowFlowControlSubMenuTipText()Returns the tip text for this property.protected voidstopFlow()Stops the flow.abstract StringsupplyText()Returns the text to save.booleansupportsClear()Whether "clear" is supported and shows up in the menu.booleansupportsHeadlessExecution()Returns whether headless execution is supported.protected voidupdateMenu()updates the enabled state of the menu items.voidwrapUp()Cleans up after the execution has finished.StringwriterTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.sink.AbstractDisplay
display, newDisplayRunnable, postDisplay
-
Methods inherited from class adams.flow.core.AbstractDisplay
backupState, cleanUpGUIKeepOpen, clearPanel, closeDisplay, createFrame, createTitle, currentInput, deregisterInWrapUp, deregisterWindow, deregisterWithEditor, displayTypeTipText, doCreateFrame, doExecute, getCreateFrame, getDefaultDisplayType, getDefaultHeight, getDefaultShortTitle, getDefaultWidth, getDefaultX, getDefaultY, getDisplayType, getFrame, getFrameDefaultCloseOperation, getHeight, getKeepOpen, getPanel, getShortTitle, getWidth, getX, getY, hasInput, heightTipText, input, newPanel, postCreateFrame, preCreateFrame, registerWindow, registerWithEditor, reset, restoreState, setCreateFrame, setDisplayType, setHeight, setKeepOpen, setShortTitle, setWidth, setX, setY, shortTitleTipText, stopExecution, widthTipText, xTipText, yTipText
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, preExecute, pruneBackup, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.flow.core.InputConsumer
accepts, currentInput, hasInput, input
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_Writer
protected AbstractTextWriter m_Writer
the text writer to use.
-
m_ShowFlowControlSubMenu
protected boolean m_ShowFlowControlSubMenu
whether to show flow control sub-menu.
-
m_Font
protected Font m_Font
the font to use.
-
m_AlwaysClear
protected boolean m_AlwaysClear
whether to always clear the display before a token is processed.
-
m_MenuBar
protected JMenuBar m_MenuBar
the menu bar, if used.
-
m_MenuItemFileClear
protected JMenuItem m_MenuItemFileClear
the "clear" menu item.
-
m_MenuItemFileSaveAs
protected JMenuItem m_MenuItemFileSaveAs
the "save as" menu item.
-
m_MenuItemFileClose
protected JMenuItem m_MenuItemFileClose
the "exit" menu item.
-
m_MenuItemFlowPauseResume
protected JMenuItem m_MenuItemFlowPauseResume
the "pause/resume" menu item.
-
m_MenuItemFlowStop
protected JMenuItem m_MenuItemFlowStop
the "stop" menu item.
-
m_FileChooser
protected transient TextFileChooser m_FileChooser
the filedialog for loading/saving flows.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractDisplay
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractDisplay
-
getFileChooser
protected TextFileChooser getFileChooser()
Returns (and initializes if necessary) the file chooser.- Returns:
- the file chooser
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractDisplay- Returns:
- null if no info available, otherwise short string
-
setWriter
public void setWriter(AbstractTextWriter value)
Sets the writer.- Parameters:
value- the writer
-
getWriter
public AbstractTextWriter getWriter()
Returns the writer.- Returns:
- the writer
-
writerTipText
public String writerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowFlowControlSubMenu
public void setShowFlowControlSubMenu(boolean value)
Sets whether to show a flow control sub-menu in the menubar.- Specified by:
setShowFlowControlSubMenuin interfaceFlowControlSubMenuSupporter- Parameters:
value- true if to show
-
getShowFlowControlSubMenu
public boolean getShowFlowControlSubMenu()
Returns whether to show a flow control sub-menu in the menubar.- Specified by:
getShowFlowControlSubMenuin interfaceFlowControlSubMenuSupporter- Returns:
- true if to show
-
showFlowControlSubMenuTipText
public String showFlowControlSubMenuTipText()
Returns the tip text for this property.- Specified by:
showFlowControlSubMenuTipTextin interfaceFlowControlSubMenuSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultFont
protected Font getDefaultFont()
Returns the default font for the dialog.- Returns:
- the default font
-
setFont
public void setFont(Font value)
Sets the font of the dialog.- Parameters:
value- the font
-
getFont
public Font getFont()
Returns the currently set font of the dialog.- Returns:
- the font
-
fontTipText
public String fontTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAlwaysClear
public void setAlwaysClear(boolean value)
Sets whether to always clear the display before processing a token. Only available if supportsClear() returns true.- Parameters:
value- if true the display is always cleared- See Also:
supportsClear()
-
getAlwaysClear
public boolean getAlwaysClear()
Returns whether the display is always cleared before processing a token. Only available if supportsClear() returns true.- Returns:
- true if the display is always cleared
-
alwaysClearTipText
public String alwaysClearTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
createFileMenu
protected JMenu createFileMenu()
Creates the "File" menu.- Returns:
- the generated menu
-
createFlowMenu
protected JMenu createFlowMenu()
Creates the flow control sub-menu.- Returns:
- the menu
-
indexOfMenuItem
protected int indexOfMenuItem(JMenu menu, JMenuItem menuitem)
Determines the index of the menu item in the specified menu.- Parameters:
menu- the menu to search inmenuitem- the menu item to get the index for- Returns:
- the index, -1 if not found
-
createMenuBar
protected JMenuBar createMenuBar()
Assembles the menu bar.- Returns:
- the menu bar
-
getMenuBar
public JMenuBar getMenuBar()
Creates a menu bar (singleton per panel object). Can be used in frames.- Specified by:
getMenuBarin interfaceMenuBarProvider- Returns:
- the menu bar
-
updateMenu
protected void updateMenu()
updates the enabled state of the menu items.
-
supportsClear
public boolean supportsClear()
Whether "clear" is supported and shows up in the menu.
Default implementation returns "false".- Specified by:
supportsClearin interfaceClearableDisplay- Returns:
- true if supported
-
clear
public void clear()
Clears the display.
Default implementation does nothing.- Specified by:
clearin interfaceClearableDisplay
-
saveAs
protected void saveAs()
Saves the setups.
-
close
protected void close()
Closes the dialog or frame.
-
canPauseOrResume
protected boolean canPauseOrResume()
Returns whether the flow can be paused/resumed.- Returns:
- true if pause/resume available
-
isPaused
protected boolean isPaused()
Returns whether the flow is currently paused.- Returns:
- true if currently paused
-
pauseResumeFlow
protected void pauseResumeFlow()
Pauses or resumes the flow.
-
stopFlow
protected void stopFlow()
Stops the flow.
-
getCustomSupplyTextMenuItemCaption
public String getCustomSupplyTextMenuItemCaption()
Returns the text for the menu item.- Specified by:
getCustomSupplyTextMenuItemCaptionin interfaceTextSupplier- Returns:
- the menu item text, null for default
-
getCustomTextFileFilter
public ExtensionFileFilter getCustomTextFileFilter()
Returns a custom file filter for the file chooser.
Default implementation returns null.- Specified by:
getCustomTextFileFilterin interfaceTextSupplier- Returns:
- the file filter, null if to use default one
-
supplyText
public abstract String supplyText()
Returns the text to save.- Specified by:
supplyTextin interfaceTextSupplier- Specified by:
supplyTextin interfaceTextSupporter- Returns:
- the text, null if no text available
-
preDisplay
protected void preDisplay(Token token)
Before the token is displayed.- Overrides:
preDisplayin classAbstractDisplay- Parameters:
token- the token to display
-
supportsHeadlessExecution
public boolean supportsHeadlessExecution()
Returns whether headless execution is supported.- Specified by:
supportsHeadlessExecutionin interfaceHeadlessExecutionSupporter- Overrides:
supportsHeadlessExecutionin classAbstractDisplay- Returns:
- true if supported
-
doExecuteHeadless
protected String doExecuteHeadless()
Executes the flow item in headless mode.- Overrides:
doExecuteHeadlessin classAbstractDisplay- Returns:
- null if everything is fine, otherwise error message
-
cleanUpGUI
protected void cleanUpGUI()
Removes all graphical components.- Overrides:
cleanUpGUIin classAbstractDisplay
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished. Also removes graphical components.- Specified by:
cleanUpin interfaceActor- Specified by:
cleanUpin interfaceCleanUpHandler- Overrides:
cleanUpin classAbstractDisplay
-
getSendToClasses
public Class[] getSendToClasses()
Returns the classes that the supporter generates.- Specified by:
getSendToClassesin interfaceSendToActionSupporter- Returns:
- the classes
-
hasSendToItem
public boolean hasSendToItem(Class[] cls)
Checks whether something to send is available.- Specified by:
hasSendToItemin 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:
getSendToItemin interfaceSendToActionSupporter- Parameters:
cls- the classes to retrieve the item for- Returns:
- the item to send
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractDisplay
-
-