Package adams.flow.transformer
Class ConfirmationDialog
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ErrorHandler
,InputConsumer
,InteractiveActor
,InteractiveActorWithCustomParentComponent
,OutputProducer
,StopModeSupporter
,Serializable
,Comparable
public class ConfirmationDialog extends AbstractInteractiveTransformer
Pops up a confirmation dialog, prompting the user to select 'yes', 'no' or 'cancel'.
If no custom tokens are used, the current token is only forwarded when the user selects 'yes'. Otherwise the token simply gets dropped.
In case of custom tokens, depending on the user's selection, either the user-defined 'yes', 'no' or 'cancel' string get forwarded as string tokens.
Closing the dialog gets interpreted as selecting the 'cancel' button.
Input/output:
- accepts:
adams.flow.core.Unknown
- generates:
adams.flow.core.Unknown
-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: ConfirmationDialog
-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 execution at this level gets stopped in case this actor encounters an error; the error gets propagated; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false
-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:
-stop-mode <GLOBAL|STOP_RESTRICTOR> (property: stopMode) The stop mode to use. default: GLOBAL
-parent-component-actor <adams.flow.core.CallableActorReference> (property: parentComponentActor) The (optional) callable actor to use as parent component instead of the flow panel. default: unknown
-use-outer-window <boolean> (property: useOuterWindow) If enabled, the outer window (dialog/frame) is used instead of the component of the callable actor. default: false
-title <java.lang.String> (property: title) The title to prompt the user with (variables get expanded). default: Confirm
-message <java.lang.String> (property: message) The message to prompt the user with (variables get expanded). default: Continue with processing of token?
-custom-tokens <boolean> (property: useCustomTokens) If enabled, custom string tokens are forwarded based on the selection the user makes; otherwise the current token gets forwarded when the user selects 'yes' and nothing for 'no'. default: false
-yes-token <java.lang.String> (property: yesToken) The string to forward as token if the user chooses 'yes' in case custom tokens are enabled. default:
-no-token <java.lang.String> (property: noToken) The string to forward as token if the user chooses 'no' in case custom tokens are enabled. default:
-cancel-token <java.lang.String> (property: cancelToken) The string to forward as token if the user chooses 'cancel' (or closes the dialog) in case custom tokens are enabled. default:
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CANCEL_OPTION
protected String
m_CancelToken
the "cancel" token.protected GUIHelper.DialogCommunication
m_Comm
for communicating with the input dialog.protected String
m_Message
the message for the user.protected String
m_NoToken
the "no" token.protected String
m_Title
the dialog title.protected boolean
m_UseCustomTokens
whether to forward a custom token instead of the one currently passed through.protected String
m_YesToken
the "yes" token.static String
NO_OPTION
static String
YES_OPTION
-
Fields inherited from class adams.flow.transformer.AbstractInteractiveTransformer
m_CallableActor, m_CustomStopMessage, m_Helper, m_ParentComponentActor, m_ParentComponentActorConfigured, m_StopFlowIfCanceled, m_StopMode, m_UseOuterWindow
-
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 ConfirmationDialog()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.String
cancelTokenTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.String
doInteract()
Performs the interaction with the user.String
doInteractHeadless()
Performs the interaction with the user in a headless environment.Class[]
generates()
Returns the class of objects that it generates.String
getCancelToken()
Returns the string that gets forwarded as token in case the user chooses 'cancel' as option (or closes the dialog), in case custom tokens are enabled.String
getMessage()
Returns the message the user is prompted with.String
getNoToken()
Returns the string that gets forwarded as token in case the user chooses 'no' as option, in case custom tokens are enabled.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
getTitle()
Returns the title the user is prompted with.boolean
getUseCustomTokens()
Returns whether custom string tokens are forwared instead of current one.String
getYesToken()
Returns the string that gets forwarded as token in case the user chooses 'yes' as option, in case custom tokens are enabled.String
globalInfo()
Returns a string describing the object.String
messageTipText()
Returns the tip text for this property.String
noTokenTipText()
Returns the tip text for this property.void
setCancelToken(String value)
Sets the string to forward as string token in case the user chooses 'cancel' (or closes the dialog), in case custom tokens are enabled.void
setMessage(String value)
Sets the message to prompt the user with.void
setNoToken(String value)
Sets the string to forward as string token in case the user chooses 'no', in case custom tokens are enabled.void
setTitle(String value)
Sets the title to prompt the user with.void
setUseCustomTokens(boolean value)
Sets whether to use forward custom string tokens instead of current one.void
setYesToken(String value)
Sets the string to forward as string token in case the user chooses 'yes', in case custom tokens are enabled.void
stopExecution()
Stops the execution.boolean
supportsHeadlessInteraction()
Returns whether headless interaction is supported.String
titleTipText()
Returns the tip text for this property.String
useCustomTokensTipText()
Returns the tip text for this property.String
yesTokenTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.AbstractInteractiveTransformer
customStopMessageTipText, deregisterWindow, doExecute, findCallableActor, getActualParentComponent, getCustomStopMessage, getParentComponentActor, getStopFlowIfCanceled, getStopMode, getUseOuterWindow, initialize, parentComponentActorTipText, registerWindow, reset, setCustomStopMessage, setParentComponentActor, setStopFlowIfCanceled, setStopMode, setUseOuterWindow, stopFlowIfCanceledTipText, stopModeTipText, useOuterWindowTipText
-
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, cleanUp, 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, 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
cleanUp, 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.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
-
YES_OPTION
public static final String YES_OPTION
- See Also:
- Constant Field Values
-
NO_OPTION
public static final String NO_OPTION
- See Also:
- Constant Field Values
-
CANCEL_OPTION
public static final String CANCEL_OPTION
- See Also:
- Constant Field Values
-
m_Title
protected String m_Title
the dialog title.
-
m_Message
protected String m_Message
the message for the user.
-
m_UseCustomTokens
protected boolean m_UseCustomTokens
whether to forward a custom token instead of the one currently passed through.
-
m_YesToken
protected String m_YesToken
the "yes" token.
-
m_NoToken
protected String m_NoToken
the "no" token.
-
m_CancelToken
protected String m_CancelToken
the "cancel" token.
-
m_Comm
protected GUIHelper.DialogCommunication m_Comm
for communicating with the input dialog.
-
-
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 classAbstractInteractiveTransformer
-
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
-
setTitle
public void setTitle(String value)
Sets the title to prompt the user with.- Parameters:
value
- the title
-
getTitle
public String getTitle()
Returns the title the user is prompted with.- Returns:
- the title
-
titleTipText
public String titleTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMessage
public void setMessage(String value)
Sets the message to prompt the user with.- Parameters:
value
- the message
-
getMessage
public String getMessage()
Returns the message the user is prompted with.- Returns:
- the message
-
messageTipText
public String messageTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseCustomTokens
public void setUseCustomTokens(boolean value)
Sets whether to use forward custom string tokens instead of current one.- Parameters:
value
- if true custom tokens get forwarded
-
getUseCustomTokens
public boolean getUseCustomTokens()
Returns whether custom string tokens are forwared instead of current one.- Returns:
- true if custom tokens get forwarded
-
useCustomTokensTipText
public String useCustomTokensTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setYesToken
public void setYesToken(String value)
Sets the string to forward as string token in case the user chooses 'yes', in case custom tokens are enabled.- Parameters:
value
- the yes token- See Also:
getUseCustomTokens()
-
getYesToken
public String getYesToken()
Returns the string that gets forwarded as token in case the user chooses 'yes' as option, in case custom tokens are enabled.- Returns:
- the yes token
- See Also:
getUseCustomTokens()
-
yesTokenTipText
public String yesTokenTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNoToken
public void setNoToken(String value)
Sets the string to forward as string token in case the user chooses 'no', in case custom tokens are enabled.- Parameters:
value
- the no token- See Also:
getUseCustomTokens()
-
getNoToken
public String getNoToken()
Returns the string that gets forwarded as token in case the user chooses 'no' as option, in case custom tokens are enabled.- Returns:
- the no token
- See Also:
getUseCustomTokens()
-
noTokenTipText
public String noTokenTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCancelToken
public void setCancelToken(String value)
Sets the string to forward as string token in case the user chooses 'cancel' (or closes the dialog), in case custom tokens are enabled.- Parameters:
value
- the cancel token- See Also:
getUseCustomTokens()
-
getCancelToken
public String getCancelToken()
Returns the string that gets forwarded as token in case the user chooses 'cancel' as option (or closes the dialog), in case custom tokens are enabled.- Returns:
- the cancel token
- See Also:
getUseCustomTokens()
-
cancelTokenTipText
public String cancelTokenTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Returns:
- adams.flow.core.Unknown.class
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Returns:
- the class fo the generated objects
-
doInteract
public String doInteract()
Performs the interaction with the user.- Specified by:
doInteract
in interfaceInteractiveActor
- Specified by:
doInteract
in classAbstractInteractiveTransformer
- Returns:
- null if successfully interacted, otherwise error message
-
supportsHeadlessInteraction
public boolean supportsHeadlessInteraction()
Returns whether headless interaction is supported.- Specified by:
supportsHeadlessInteraction
in interfaceInteractiveActor
- Overrides:
supportsHeadlessInteraction
in classAbstractInteractiveTransformer
- Returns:
- true if interaction in headless environment is possible
-
doInteractHeadless
public String doInteractHeadless()
Performs the interaction with the user in a headless environment.- Specified by:
doInteractHeadless
in interfaceInteractiveActor
- Overrides:
doInteractHeadless
in classAbstractInteractiveTransformer
- Returns:
- null if successfully interacted, otherwise error message
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
-