Package adams.flow.control
Class Inspect
-
- 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
public class Inspect extends AbstractInteractiveTransformerDialog
Allows the user to inspect tokens with the specified viewer.
Inspection can be done interactively, allowing the user to drop tokens, or non-interactively, with the viewer updating whenever a token passes through.
Of course, this actor should only be used during development for debugging purposes as can slow down the execution significantly depending on how expensive the view generation is.
Input/output:
- accepts:
java.lang.Object
- generates:
java.lang.Object
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: Inspect
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console. default: false
-short-title <boolean> (property: shortTitle) If enabled uses just the name for the title instead of the actor's full name. default: false
-width <int> (property: width) The width of the dialog. default: 800 minimum: 1
-height <int> (property: height) The height of the dialog. default: 600 minimum: 1
-x <int> (property: x) The X position of the dialog (>=0: absolute, -1: left, -2: center, -3: right ). default: -1 minimum: -3
-y <int> (property: y) The Y position of the dialog (>=0: absolute, -1: top, -2: center, -3: bottom ). default: -1 minimum: -3
-stop-if-canceled <boolean> (property: stopFlowIfCanceled) If enabled, the flow gets stopped in case the user cancels the dialog. default: false
-custom-stop-message <java.lang.String> (property: customStopMessage) The custom stop message to use in case a user cancelation stops the flow (default is the full name of the actor) default:
-provider <adams.flow.sink.DisplayPanelProvider> (property: panelProvider) The actor for generating the viewer. default: adams.flow.sink.Display -writer adams.data.io.output.NullWriter
-label-skip <java.lang.String> (property: labelSkip) The label to use for the skip button; let '_' precede the character that should trigger the button via 'Alt+<char>' (Windows/Linux). default: _Skip
-label-accept <java.lang.String> (property: labelAccept) The label to use for the accept button; let '_' precede the character that should trigger the button via 'Alt+<char>' (Windows/Linux). default: _Accept
-close-dialog <boolean> (property: closeDialog) If enabled, the dialog gets closed after the skip or accept button has been clicked. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Accepted
whether the token was accepted.protected BaseButton
m_ButtonAccept
the button for accepting the token.protected BaseButton
m_ButtonSkip
the button for skipping the token.protected BaseButton
m_ButtonToggle
the button for turning on/off the interactive state of the viewer.protected boolean
m_CloseDialog
whether to close the dialog after skipping/accepting.protected boolean
m_Interactive
whether the dialog is interactive.protected String
m_LabelAccept
the label for the accept button.protected String
m_LabelSkip
the label for the skip button.protected DisplayPanelProvider
m_PanelProvider
the actor to use for generating panels.protected boolean
m_Skipped
whether the token was skipped.protected Boolean
m_Waiting
whether we're currenlty waiting on the user.static String
TEXT_INTERACTIVE
the interactive text for the button.static String
TEXT_NONINTERACTIVE
the non-interactive text for the button.-
Fields inherited from class adams.flow.transformer.AbstractInteractiveTransformerDialog
m_CustomStopMessage, m_Dialog, m_Height, m_LastPosition, m_LastSize, m_Panel, m_ShortTitle, m_StopFlowIfCanceled, m_StopMode, m_Width, m_X, m_Y
-
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 Inspect()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.void
clearPanel()
Clears the content of the panel.String
closeDialogTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected BaseDialog
doCreateDialog(BasePanel panel)
Creates the actual dialog.String
doInteract()
Performs the interaction with the user.protected void
forceVariables(Variables value)
Updates the Variables instance in use.Class[]
generates()
Returns the class that the consumer accepts.boolean
getCloseDialog()
Returns whether to close the dialog after clicking skip/accept.String
getLabelAccept()
Returns the label to use for the accept button ('_' precedes the character to use as accelerator).String
getLabelSkip()
Returns the label to use for the skip button ('_' precedes the character to use as accelerator).DisplayPanelProvider
getPanelProvider()
Returns the panel provider in use for generating the panels.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.String
labelAcceptTipText()
Returns the tip text for this property.String
labelSkipTipText()
Returns the tip text for this property.protected BasePanel
newPanel()
Creates the panel to display in the dialog.String
panelProviderTipText()
Returns the tip text for this property.void
setCloseDialog(boolean value)
Sets whether to close the dialog after clicking skip/accept.void
setLabelAccept(String value)
Sets the label to use for the accept button ('_' precedes the character to use as accelerator).void
setLabelSkip(String value)
Sets the label to use for the skip button ('_' precedes the character to use as accelerator).void
setPanelProvider(DisplayPanelProvider value)
Sets the panel provider to use for generating the panels.String
setUp()
Initializes the item for flow execution.void
stopExecution()
Stops the execution.protected void
updateButtons(boolean beforeDisplay)
Updates the button state.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.transformer.AbstractInteractiveTransformerDialog
cleanUp, cleanUpGUI, createDialog, createTitle, customStopMessageTipText, deregisterWindow, doExecute, doInteractHeadless, getCustomStopMessage, getDefaultHeight, getDefaultWidth, getDefaultX, getDefaultY, getDialog, getHeight, getPanel, getShortTitle, getStopFlowIfCanceled, getStopMode, getWidth, getX, getY, heightTipText, initialize, postCreateDialog, preCreateDialog, registerWindow, reset, setCustomStopMessage, setHeight, setShortTitle, setStopFlowIfCanceled, setStopMode, setWidth, setX, setY, shortTitleTipText, stopFlowIfCanceledTipText, stopModeTipText, supportsHeadlessInteraction, widthTipText, xTipText, yTipText
-
Methods inherited from class adams.flow.transformer.AbstractTransformer
backupState, currentInput, execute, hasInput, hasPendingOutput, input, output, postExecute, restoreState
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, equals, finalUpdateVariables, findVariables, findVariables, 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, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, 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, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
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
-
TEXT_INTERACTIVE
public static final String TEXT_INTERACTIVE
the interactive text for the button.- See Also:
- Constant Field Values
-
TEXT_NONINTERACTIVE
public static final String TEXT_NONINTERACTIVE
the non-interactive text for the button.- See Also:
- Constant Field Values
-
m_PanelProvider
protected DisplayPanelProvider m_PanelProvider
the actor to use for generating panels.
-
m_LabelSkip
protected String m_LabelSkip
the label for the skip button.
-
m_LabelAccept
protected String m_LabelAccept
the label for the accept button.
-
m_CloseDialog
protected boolean m_CloseDialog
whether to close the dialog after skipping/accepting.
-
m_ButtonToggle
protected BaseButton m_ButtonToggle
the button for turning on/off the interactive state of the viewer.
-
m_ButtonSkip
protected BaseButton m_ButtonSkip
the button for skipping the token.
-
m_ButtonAccept
protected BaseButton m_ButtonAccept
the button for accepting the token.
-
m_Interactive
protected boolean m_Interactive
whether the dialog is interactive.
-
m_Accepted
protected boolean m_Accepted
whether the token was accepted.
-
m_Skipped
protected boolean m_Skipped
whether the token was skipped.
-
m_Waiting
protected Boolean m_Waiting
whether we're currenlty waiting on the user.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractInteractiveTransformerDialog
-
setPanelProvider
public void setPanelProvider(DisplayPanelProvider value)
Sets the panel provider to use for generating the panels.- Parameters:
value
- the panel provider to use
-
getPanelProvider
public DisplayPanelProvider getPanelProvider()
Returns the panel provider in use for generating the panels.- Returns:
- the panel provider in use
-
panelProviderTipText
public String panelProviderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelSkip
public void setLabelSkip(String value)
Sets the label to use for the skip button ('_' precedes the character to use as accelerator).- Parameters:
value
- the label
-
getLabelSkip
public String getLabelSkip()
Returns the label to use for the skip button ('_' precedes the character to use as accelerator).- Returns:
- the label
-
labelSkipTipText
public String labelSkipTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelAccept
public void setLabelAccept(String value)
Sets the label to use for the accept button ('_' precedes the character to use as accelerator).- Parameters:
value
- the label
-
getLabelAccept
public String getLabelAccept()
Returns the label to use for the accept button ('_' precedes the character to use as accelerator).- Returns:
- the label
-
labelAcceptTipText
public String labelAcceptTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCloseDialog
public void setCloseDialog(boolean value)
Sets whether to close the dialog after clicking skip/accept.- Parameters:
value
- true if to close
-
getCloseDialog
public boolean getCloseDialog()
Returns whether to close the dialog after clicking skip/accept.- Returns:
- true if to close
-
closeDialogTipText
public String closeDialogTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
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 classAbstractInteractiveTransformerDialog
- Returns:
- null if no info available, otherwise short string
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Returns:
- the Class of objects that can be processed
-
generates
public Class[] generates()
Returns the class that the consumer accepts.- Returns:
- the Class of objects that can be processed
-
forceVariables
protected void forceVariables(Variables value)
Updates the Variables instance in use.
Use with caution!- Overrides:
forceVariables
in classAbstractActor
- Parameters:
value
- the instance to use
-
clearPanel
public void clearPanel()
Clears the content of the panel.- Specified by:
clearPanel
in classAbstractInteractiveTransformerDialog
-
newPanel
protected BasePanel newPanel()
Creates the panel to display in the dialog.- Specified by:
newPanel
in classAbstractInteractiveTransformerDialog
- Returns:
- the panel
-
doCreateDialog
protected BaseDialog doCreateDialog(BasePanel panel)
Creates the actual dialog.- Overrides:
doCreateDialog
in classAbstractInteractiveTransformerDialog
- Parameters:
panel
- the panel to display in the dialog- Returns:
- the created dialog
-
updateButtons
protected void updateButtons(boolean beforeDisplay)
Updates the button state.- Parameters:
beforeDisplay
- true if token is not yet displayed
-
doInteract
public String doInteract()
Performs the interaction with the user.- Specified by:
doInteract
in interfaceInteractiveActor
- Overrides:
doInteract
in classAbstractInteractiveTransformerDialog
- Returns:
- null if successfully interacted, otherwise error message
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractInteractiveTransformerDialog
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractTransformer
-
-