Package adams.flow.transformer
Class AbstractInteractiveTransformerDialog
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.transformer.AbstractTransformer
-
- adams.flow.transformer.AbstractInteractiveTransformerDialog
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ErrorHandler
,InputConsumer
,InteractiveActor
,OutputProducer
,StopModeSupporter
,Serializable
,Comparable
- Direct Known Subclasses:
CompareObjectLocations
,ImageAnnotator
,ImageLabeler
,ImageObjectAnnotator
,ImageSegmentationAnnotator
,Inspect
,PixelSelector
,ProcessActor
,RemoveOutliers
,SelectArraySubset
,SpreadSheetCellSelector
,SpreadSheetSelectSubset
public abstract class AbstractInteractiveTransformerDialog extends AbstractTransformer implements InteractiveActor
Ancestor for graphical actors that are interactive.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_CustomStopMessage
the custom stop message to use if flow gets stopped due to cancelation.protected BaseDialog
m_Dialog
the dialog that's being displayed.protected int
m_Height
the height of the dialog.protected Point
m_LastPosition
the last position.protected Dimension
m_LastSize
the last dimension.protected BasePanel
m_Panel
the panel to display.protected boolean
m_ShortTitle
whether to use just the actor name or the full name as title.protected boolean
m_StopFlowIfCanceled
whether to stop the flow if canceled.protected StopMode
m_StopMode
how to perform the stop.protected int
m_Width
the width of the dialog.protected int
m_X
the X position of the dialog.protected int
m_Y
the Y position of the dialog.-
Fields inherited from class adams.flow.transformer.AbstractTransformer
BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken
-
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
-
Fields inherited from interface adams.flow.core.InteractiveActor
INTERACTION_CANCELED
-
-
Constructor Summary
Constructors Constructor Description AbstractInteractiveTransformerDialog()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up after the execution has finished.protected void
cleanUpGUI()
Removes all graphical components.abstract void
clearPanel()
Clears the content of the panel.protected BaseDialog
createDialog(BasePanel panel)
Creates and initializes a dialog with the just created panel.protected String
createTitle()
Creates a title for the dialog.String
customStopMessageTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected void
deregisterWindow(Window window)
Deregisters the window with the flow.protected BaseDialog
doCreateDialog(BasePanel panel)
Creates the actual dialog.protected String
doExecute()
Executes the flow item.String
doInteract()
Performs the interaction with the user.String
doInteractHeadless()
Performs the interaction with the user in a headless environment.String
getCustomStopMessage()
Returns the custom message to use when stopping the flow.protected int
getDefaultHeight()
Returns the default height for the dialog.protected int
getDefaultWidth()
Returns the default width for the dialog.protected int
getDefaultX()
Returns the default X position for the dialog.protected int
getDefaultY()
Returns the default Y position for the dialog.BaseDialog
getDialog()
Returns the dialog.int
getHeight()
Returns the currently set height of the dialog.BasePanel
getPanel()
Returns the panel.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.boolean
getShortTitle()
Returns whether to use just the name of the actor or the full name.boolean
getStopFlowIfCanceled()
Returns whether to stop the flow if dialog canceled.StopMode
getStopMode()
Returns the stop mode.int
getWidth()
Returns the currently set width of the dialog.int
getX()
Returns the currently set X position of the dialog.int
getY()
Returns the currently set Y position of the dialog.String
heightTipText()
Returns the tip text for this property.protected void
initialize()
Initializes the members.protected abstract BasePanel
newPanel()
Creates the panel to display in the dialog.protected void
postCreateDialog(BaseDialog dialog, BasePanel panel)
Hook method after the dialog got created.protected void
preCreateDialog(BasePanel panel)
Hook method before the dialog gets created.protected void
registerWindow(Window window, String title)
Registers the window with the flow.protected void
reset()
Resets the object.void
setCustomStopMessage(String value)
Sets the custom message to use when stopping the flow.void
setHeight(int value)
Sets the height of the dialog.void
setShortTitle(boolean value)
Sets whether to use just the name of the actor or the full name.void
setStopFlowIfCanceled(boolean value)
Sets whether to stop the flow if dialog canceled.void
setStopMode(StopMode value)
Sets the stop mode.void
setWidth(int value)
Sets the width of the dialog.void
setX(int value)
Sets the X position of the dialog.void
setY(int value)
Sets the Y position of the dialog.String
shortTitleTipText()
Returns the tip text for this property.void
stopExecution()
Stops the execution.String
stopFlowIfCanceledTipText()
Returns the tip text for this property.String
stopModeTipText()
Returns the tip text for this property.boolean
supportsHeadlessInteraction()
Returns whether headless interaction is supported.String
widthTipText()
Returns the tip text for this property.String
xTipText()
Returns the tip text for this property.String
yTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.AbstractTransformer
backupState, currentInput, execute, hasInput, hasPendingOutput, input, output, postExecute, restoreState, wrapUp
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, equals, 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, 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, toCommandLine, variableChanged, wrapUp
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.flow.core.InputConsumer
accepts
-
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.flow.core.OutputProducer
generates
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_ShortTitle
protected boolean m_ShortTitle
whether to use just the actor name or the full name as title.
-
m_Width
protected int m_Width
the width of the dialog.
-
m_Height
protected int m_Height
the height of the dialog.
-
m_X
protected int m_X
the X position of the dialog.
-
m_Y
protected int m_Y
the Y position of the dialog.
-
m_Panel
protected BasePanel m_Panel
the panel to display.
-
m_Dialog
protected BaseDialog m_Dialog
the dialog that's being displayed.
-
m_StopFlowIfCanceled
protected boolean m_StopFlowIfCanceled
whether to stop the flow if canceled.
-
m_CustomStopMessage
protected String m_CustomStopMessage
the custom stop message to use if flow gets stopped due to cancelation.
-
m_StopMode
protected StopMode m_StopMode
how to perform the stop.
-
m_LastPosition
protected transient Point m_LastPosition
the last position.
-
m_LastSize
protected transient Dimension m_LastSize
the last dimension.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractActor
- Returns:
- null if no info available, otherwise short string
-
getDefaultX
protected int getDefaultX()
Returns the default X position for the dialog.- Returns:
- the default X position
-
getDefaultY
protected int getDefaultY()
Returns the default Y position for the dialog.- Returns:
- the default Y position
-
getDefaultWidth
protected int getDefaultWidth()
Returns the default width for the dialog.- Returns:
- the default width
-
getDefaultHeight
protected int getDefaultHeight()
Returns the default height for the dialog.- Returns:
- the default height
-
setShortTitle
public void setShortTitle(boolean value)
Sets whether to use just the name of the actor or the full name.- Parameters:
value
- if true just the name will get used, otherwise the full name
-
getShortTitle
public boolean getShortTitle()
Returns whether to use just the name of the actor or the full name.- Returns:
- true if just the name used, otherwise full name
-
shortTitleTipText
public String shortTitleTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWidth
public void setWidth(int value)
Sets the width of the dialog.- Parameters:
value
- the width
-
getWidth
public int getWidth()
Returns the currently set width of the dialog.- Returns:
- the width
-
widthTipText
public String widthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setHeight
public void setHeight(int value)
Sets the height of the dialog.- Parameters:
value
- the height
-
getHeight
public int getHeight()
Returns the currently set height of the dialog.- Returns:
- the height
-
heightTipText
public String heightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setX
public void setX(int value)
Sets the X position of the dialog.- Parameters:
value
- the X position
-
getX
public int getX()
Returns the currently set X position of the dialog.- Returns:
- the X position
-
xTipText
public String xTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setY
public void setY(int value)
Sets the Y position of the dialog.- Parameters:
value
- the Y position
-
getY
public int getY()
Returns the currently set Y position of the dialog.- Returns:
- the Y position
-
yTipText
public String yTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStopFlowIfCanceled
public void setStopFlowIfCanceled(boolean value)
Sets whether to stop the flow if dialog canceled.- Specified by:
setStopFlowIfCanceled
in interfaceInteractiveActor
- Parameters:
value
- if true flow gets stopped if dialog canceled
-
getStopFlowIfCanceled
public boolean getStopFlowIfCanceled()
Returns whether to stop the flow if dialog canceled.- Specified by:
getStopFlowIfCanceled
in interfaceInteractiveActor
- Returns:
- true if the flow gets stopped if dialog canceled
-
stopFlowIfCanceledTipText
public String stopFlowIfCanceledTipText()
Returns the tip text for this property.- Specified by:
stopFlowIfCanceledTipText
in interfaceInteractiveActor
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCustomStopMessage
public void setCustomStopMessage(String value)
Sets the custom message to use when stopping the flow.- Specified by:
setCustomStopMessage
in interfaceInteractiveActor
- Parameters:
value
- the stop message
-
getCustomStopMessage
public String getCustomStopMessage()
Returns the custom message to use when stopping the flow.- Specified by:
getCustomStopMessage
in interfaceInteractiveActor
- Returns:
- the stop message
-
customStopMessageTipText
public String customStopMessageTipText()
Returns the tip text for this property.- Specified by:
customStopMessageTipText
in interfaceInteractiveActor
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStopMode
public void setStopMode(StopMode value)
Sets the stop mode.- Specified by:
setStopMode
in interfaceStopModeSupporter
- Parameters:
value
- the mode
-
getStopMode
public StopMode getStopMode()
Returns the stop mode.- Specified by:
getStopMode
in interfaceStopModeSupporter
- Returns:
- the mode
-
stopModeTipText
public String stopModeTipText()
Returns the tip text for this property.- Specified by:
stopModeTipText
in interfaceStopModeSupporter
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
reset
protected void reset()
Resets the object. Removes graphical components as well.- Overrides:
reset
in classAbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractActor
-
clearPanel
public abstract void clearPanel()
Clears the content of the panel.
-
newPanel
protected abstract BasePanel newPanel()
Creates the panel to display in the dialog.- Returns:
- the panel
-
getPanel
public BasePanel getPanel()
Returns the panel.- Returns:
- the panel, null if not available
-
createTitle
protected String createTitle()
Creates a title for the dialog. Default implementation only returns the full name of the actor.- Returns:
- the title of the dialog
-
preCreateDialog
protected void preCreateDialog(BasePanel panel)
Hook method before the dialog gets created.
Default implementation does nothing.- Parameters:
panel
- the panel to display in the dialog
-
doCreateDialog
protected BaseDialog doCreateDialog(BasePanel panel)
Creates the actual dialog.- Parameters:
panel
- the panel to display in the dialog- Returns:
- the created dialog
-
postCreateDialog
protected void postCreateDialog(BaseDialog dialog, BasePanel panel)
Hook method after the dialog got created.
Default implementation does nothing.- Parameters:
dialog
- the dialog that got just createdpanel
- the panel displayed in the frame
-
createDialog
protected BaseDialog createDialog(BasePanel panel)
Creates and initializes a dialog with the just created panel.- Parameters:
panel
- the panel to use in the dialog- Returns:
- the created dialog
-
getDialog
public BaseDialog getDialog()
Returns the dialog.- Returns:
- the dialog, null if not available
-
registerWindow
protected void registerWindow(Window window, String title)
Registers the window with the flow.- Parameters:
window
- the windowtitle
- the title
-
deregisterWindow
protected void deregisterWindow(Window window)
Deregisters the window with the flow.- Parameters:
window
- the window
-
doInteract
public String doInteract()
Performs the interaction with the user.
Default implementation simply displays the dialog and returns always null.- Specified by:
doInteract
in interfaceInteractiveActor
- Returns:
- null if successfully interacted, otherwise error message
-
supportsHeadlessInteraction
public boolean supportsHeadlessInteraction()
Returns whether headless interaction is supported.- Specified by:
supportsHeadlessInteraction
in interfaceInteractiveActor
- Returns:
- true if interaction in headless environment is possible
-
doInteractHeadless
public String doInteractHeadless()
Performs the interaction with the user in a headless environment.
Default implementation always returns null.- Specified by:
doInteractHeadless
in interfaceInteractiveActor
- Returns:
- null if successfully interacted, otherwise error message
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
cleanUpGUI
protected void cleanUpGUI()
Removes all graphical components.
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished. Also removes graphical components.- Specified by:
cleanUp
in interfaceActor
- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractActor
-
-