Package adams.flow.sink
Class Screenshot
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ErrorHandler
,InputConsumer
,Serializable
,Comparable
public class Screenshot extends AbstractGraphicsGenerator
Actor that takes screenshots of graphical components.
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: Screenshot
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-title <java.lang.String> (property: title) The title of the dialog. default: Screenshot
-suffix <java.lang.String> (property: suffix) An optional suffix for the filename, inserted before the extension. default:
-width <int> (property: width) The width of the dialog. default: 800
-height <int> (property: height) The height of the dialog. default: 600
-output <adams.core.io.PlaceholderFile> (property: output) The output directory. default: .
-writer <adams.gui.print.JComponentWriter [options]> (property: writer) The writer to use for generating the graphics output. default: adams.gui.print.NullWriter
-provider <adams.flow.sink.DisplayPanelProvider [options]> (property: panelProvider) The actor for generating the display panels to take a screenshot of. default: adams.flow.sink.ClassifierErrors -writer adams.gui.print.NullWriter
-filename-prefix <java.lang.String> (property: filenamePrefix) The prefix for the filename in case of auto-generation (no path, just name ). default: screenshot
-filename-var <java.lang.String> (property: filenameVariable) The variable to use for the filename instead of the auto-generated one. default:
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_COUNTER
the key for storing the current counter in the backup.protected int
m_Counter
the counter for the screenshots.protected String
m_FilenamePrefix
the prefix for the auto-generated filename.protected VariableName
m_FilenameVariable
the variable to use as filename.protected DisplayPanelProvider
m_PanelProvider
the actor to use for generating panels.-
Fields inherited from class adams.flow.sink.AbstractGraphicsGenerator
m_Component, m_Frame, m_Height, m_Output, m_Suffix, m_Title, m_Width, m_Writer
-
Fields inherited from class adams.flow.sink.AbstractSink
BACKUP_INPUT, m_InputToken
-
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 Screenshot()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.void
defineOptions()
Adds options to the internal list of options.String
filenamePrefixTipText()
Returns the tip text for this property.String
filenameVariableTipText()
Returns the tip text for this property.protected JComponent
generateComponent()
Generates the component to display in the frame.protected PlaceholderFile
generateFilename()
Generates the filename for the output.protected int
getDefaultHeight()
Returns the default height for the dialog.protected String
getDefaultTitle()
Returns the default title for the dialog.protected int
getDefaultWidth()
Returns the default width for the dialog.String
getFilenamePrefix()
Returns the prefix for the filename in case of auto-generation.VariableName
getFilenameVariable()
Returns the variable to use for generating the filename instead of the auto-generated one.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
outputTipText()
Returns the tip text for this property.String
panelProviderTipText()
Returns the tip text for this property.protected void
pruneBackup()
Removes entries from the backup.protected void
reset()
Resets the scheme.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
setFilenamePrefix(String value)
Sets the prefix for the filename in case of auto-generation.void
setFilenameVariable(VariableName value)
Sets the variable to use for generating the filename instead of the auto-generated one.void
setPanelProvider(DisplayPanelProvider value)
Sets the panel provider to use for generating the panels.-
Methods inherited from class adams.flow.sink.AbstractGraphicsGenerator
displayFrame, disposeComponent, doExecute, generateFrame, generateOutput, getHeight, getOutput, getSuffix, getTitle, getWidth, getWriter, heightTipText, hideFrame, setHeight, setOutput, setSuffix, setTitle, setWidth, setWriter, suffixTipText, titleTipText, widthTipText, writerTipText
-
Methods inherited from class adams.flow.sink.AbstractSink
currentInput, hasInput, input, postExecute, wrapUp
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, 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, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, 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, 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
-
BACKUP_COUNTER
public static final String BACKUP_COUNTER
the key for storing the current counter in the backup.- See Also:
- Constant Field Values
-
m_PanelProvider
protected DisplayPanelProvider m_PanelProvider
the actor to use for generating panels.
-
m_FilenamePrefix
protected String m_FilenamePrefix
the prefix for the auto-generated filename.
-
m_FilenameVariable
protected VariableName m_FilenameVariable
the variable to use as filename.
-
m_Counter
protected int m_Counter
the counter for the screenshots.
-
-
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 classAbstractGraphicsGenerator
-
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
-
pruneBackup
protected void pruneBackup()
Removes entries from the backup.- Overrides:
pruneBackup
in classAbstractActor
- See Also:
AbstractActor.reset()
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classAbstractSink
- Returns:
- the backup
- See Also:
AbstractActor.updateVariables()
,AbstractActor.restoreState(Hashtable)
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreState
in classAbstractSink
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
getDefaultTitle
protected String getDefaultTitle()
Returns the default title for the dialog.- Specified by:
getDefaultTitle
in classAbstractGraphicsGenerator
- Returns:
- the default title
-
getDefaultWidth
protected int getDefaultWidth()
Returns the default width for the dialog.- Specified by:
getDefaultWidth
in classAbstractGraphicsGenerator
- Returns:
- the default width
-
getDefaultHeight
protected int getDefaultHeight()
Returns the default height for the dialog.- Specified by:
getDefaultHeight
in classAbstractGraphicsGenerator
- Returns:
- the default height
-
outputTipText
public String outputTipText()
Returns the tip text for this property.- Specified by:
outputTipText
in classAbstractGraphicsGenerator
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
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.
-
setFilenamePrefix
public void setFilenamePrefix(String value)
Sets the prefix for the filename in case of auto-generation.- Parameters:
value
- the prefix (just name, no path)
-
getFilenamePrefix
public String getFilenamePrefix()
Returns the prefix for the filename in case of auto-generation.- Returns:
- the panel provider in use
-
filenamePrefixTipText
public String filenamePrefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFilenameVariable
public void setFilenameVariable(VariableName value)
Sets the variable to use for generating the filename instead of the auto-generated one.- Parameters:
value
- the variable name (without the @{ and })
-
getFilenameVariable
public VariableName getFilenameVariable()
Returns the variable to use for generating the filename instead of the auto-generated one.- Returns:
- the panel provider in use
-
filenameVariableTipText
public String filenameVariableTipText()
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:
- weka.classifiers.Evaluation.class
-
generateComponent
protected JComponent generateComponent()
Generates the component to display in the frame.- Specified by:
generateComponent
in classAbstractGraphicsGenerator
- Returns:
- the component
-
generateFilename
protected PlaceholderFile generateFilename()
Generates the filename for the output.- Specified by:
generateFilename
in classAbstractGraphicsGenerator
- Returns:
- the file
-
-