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 Stringm_CustomStopMessagethe custom stop message to use if flow gets stopped due to cancelation.protected BaseDialogm_Dialogthe dialog that's being displayed.protected intm_Heightthe height of the dialog.protected Pointm_LastPositionthe last position.protected Dimensionm_LastSizethe last dimension.protected BasePanelm_Panelthe panel to display.protected booleanm_ShortTitlewhether to use just the actor name or the full name as title.protected booleanm_StopFlowIfCanceledwhether to stop the flow if canceled.protected StopModem_StopModehow to perform the stop.protected intm_Widththe width of the dialog.protected intm_Xthe X position of the dialog.protected intm_Ythe 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 voidcleanUp()Cleans up after the execution has finished.protected voidcleanUpGUI()Removes all graphical components.abstract voidclearPanel()Clears the content of the panel.protected BaseDialogcreateDialog(BasePanel panel)Creates and initializes a dialog with the just created panel.protected StringcreateTitle()Creates a title for the dialog.StringcustomStopMessageTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected voidderegisterWindow(Window window)Deregisters the window with the flow.protected BaseDialogdoCreateDialog(BasePanel panel)Creates the actual dialog.protected StringdoExecute()Executes the flow item.StringdoInteract()Performs the interaction with the user.StringdoInteractHeadless()Performs the interaction with the user in a headless environment.StringgetCustomStopMessage()Returns the custom message to use when stopping the flow.protected intgetDefaultHeight()Returns the default height for the dialog.protected intgetDefaultWidth()Returns the default width for the dialog.protected intgetDefaultX()Returns the default X position for the dialog.protected intgetDefaultY()Returns the default Y position for the dialog.BaseDialoggetDialog()Returns the dialog.intgetHeight()Returns the currently set height of the dialog.BasePanelgetPanel()Returns the panel.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.booleangetShortTitle()Returns whether to use just the name of the actor or the full name.booleangetStopFlowIfCanceled()Returns whether to stop the flow if dialog canceled.StopModegetStopMode()Returns the stop mode.intgetWidth()Returns the currently set width of the dialog.intgetX()Returns the currently set X position of the dialog.intgetY()Returns the currently set Y position of the dialog.StringheightTipText()Returns the tip text for this property.protected voidinitialize()Initializes the members.protected abstract BasePanelnewPanel()Creates the panel to display in the dialog.protected voidpostCreateDialog(BaseDialog dialog, BasePanel panel)Hook method after the dialog got created.protected voidpreCreateDialog(BasePanel panel)Hook method before the dialog gets created.protected voidregisterWindow(Window window, String title)Registers the window with the flow.protected voidreset()Resets the object.voidsetCustomStopMessage(String value)Sets the custom message to use when stopping the flow.voidsetHeight(int value)Sets the height of the dialog.voidsetShortTitle(boolean value)Sets whether to use just the name of the actor or the full name.voidsetStopFlowIfCanceled(boolean value)Sets whether to stop the flow if dialog canceled.voidsetStopMode(StopMode value)Sets the stop mode.voidsetWidth(int value)Sets the width of the dialog.voidsetX(int value)Sets the X position of the dialog.voidsetY(int value)Sets the Y position of the dialog.StringshortTitleTipText()Returns the tip text for this property.voidstopExecution()Stops the execution.StringstopFlowIfCanceledTipText()Returns the tip text for this property.StringstopModeTipText()Returns the tip text for this property.booleansupportsHeadlessInteraction()Returns whether headless interaction is supported.StringwidthTipText()Returns the tip text for this property.StringxTipText()Returns the tip text for this property.StringyTipText()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:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
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 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:
setStopFlowIfCanceledin 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:
getStopFlowIfCanceledin interfaceInteractiveActor- Returns:
- true if the flow gets stopped if dialog canceled
-
stopFlowIfCanceledTipText
public String stopFlowIfCanceledTipText()
Returns the tip text for this property.- Specified by:
stopFlowIfCanceledTipTextin 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:
setCustomStopMessagein interfaceInteractiveActor- Parameters:
value- the stop message
-
getCustomStopMessage
public String getCustomStopMessage()
Returns the custom message to use when stopping the flow.- Specified by:
getCustomStopMessagein interfaceInteractiveActor- Returns:
- the stop message
-
customStopMessageTipText
public String customStopMessageTipText()
Returns the tip text for this property.- Specified by:
customStopMessageTipTextin 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:
setStopModein interfaceStopModeSupporter- Parameters:
value- the mode
-
getStopMode
public StopMode getStopMode()
Returns the stop mode.- Specified by:
getStopModein interfaceStopModeSupporter- Returns:
- the mode
-
stopModeTipText
public String stopModeTipText()
Returns the tip text for this property.- Specified by:
stopModeTipTextin 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:
resetin classAbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein 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:
doInteractin interfaceInteractiveActor- Returns:
- null if successfully interacted, otherwise error message
-
supportsHeadlessInteraction
public boolean supportsHeadlessInteraction()
Returns whether headless interaction is supported.- Specified by:
supportsHeadlessInteractionin 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:
doInteractHeadlessin interfaceInteractiveActor- Returns:
- null if successfully interacted, otherwise error message
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein 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:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractActor
-
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 classAbstractActor
-
-