Class ConsoleWindow

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, TextSupporter, VariablesInspectionHandler, VariableChangeListener, Actor, DisplayTypeSupporter, ErrorHandler, TextSupplier, MenuBarProvider, ConsolePanelListener, SendToActionSupporter, Serializable, Comparable

    public class ConsoleWindow
    extends AbstractDisplay
    implements ConsolePanelListener, MenuBarProvider, TextSupplier, SendToActionSupporter
    Displays the messages that are output in the system's 'Console window'.

    -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: ConsoleWindow
     
    -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
     
    -display-in-editor <boolean> (property: displayInEditor)
        If enabled displays the panel in a tab in the flow editor rather than in 
        a separate frame.
        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
     
    -level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> [-level ...] (property: levels)
        The logging levels of messages to display.
        default: INFO, WARNING, SEVERE
     
    -font <java.awt.Font> (property: font)
        The font of the dialog.
        default: Monospaced-PLAIN-12
     
    -log-file <adams.core.io.PlaceholderFile> (property: logFile)
        The file to save the log messages to as they come in; ignored if pointing 
        to a directory.
        default: ${CWD}
     
    -file-only-output <boolean> (property: fileOnlyOutput)
        If enabled, log messages are only output to the specified log file, no window 
        with text.
        default: false
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Levels

        protected LoggingLevel[] m_Levels
        the logging levels to display.
      • m_Font

        protected Font m_Font
        the font to use.
      • m_LogFile

        protected PlaceholderFile m_LogFile
        the file to save the log messages to.
      • m_FileOnlyOutput

        protected boolean m_FileOnlyOutput
        whether to only use file output.
      • m_TextArea

        protected BaseTextArea m_TextArea
        the text area for displaying the messages.
      • m_MenuBar

        protected JMenuBar m_MenuBar
        the menu bar, if used.
      • m_MenuItemFileClear

        protected JMenuItem m_MenuItemFileClear
        the "clear" menu item.
      • m_MenuItemFileSaveAs

        protected JMenuItem m_MenuItemFileSaveAs
        the "save as" menu item.
      • m_MenuItemFileClose

        protected JMenuItem m_MenuItemFileClose
        the "exit" menu item.
      • m_FileChooser

        protected transient TextFileChooser m_FileChooser
        the filedialog for saving the output.
    • Constructor Detail

      • ConsoleWindow

        public ConsoleWindow()
    • Method Detail

      • setLevels

        public void setLevels​(LoggingLevel[] value)
        Sets the LoggingLevels to display.
        Parameters:
        value - the levels
      • levelsTipText

        public String levelsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDefaultFont

        protected Font getDefaultFont()
        Returns the default font for the dialog.
        Returns:
        the default font
      • setFont

        public void setFont​(Font value)
        Sets the font of the dialog.
        Parameters:
        value - the font
      • getFont

        public Font getFont()
        Returns the currently set font of the dialog.
        Returns:
        the font
      • fontTipText

        public String fontTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLogFile

        public void setLogFile​(PlaceholderFile value)
        Sets the file to save the log messages to, ignored if directory.
        Parameters:
        value - the output file
      • getLogFile

        public PlaceholderFile getLogFile()
        Returns the file to save the log messages to, ignored if directory.
        Returns:
        the output file
      • logFileTipText

        public String logFileTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFileOnlyOutput

        public void setFileOnlyOutput​(boolean value)
        Sets whether to output the log messages only to the file and suppress GUI output.
        Parameters:
        value - true if only log file output
      • getFileOnlyOutput

        public boolean getFileOnlyOutput()
        Returns whether to output the log messages only to the file and suppress GUI output.
        Returns:
        true if only log file output
      • fileOnlyOutputTipText

        public String fileOnlyOutputTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getFileChooser

        protected TextFileChooser getFileChooser()
        Returns (and initializes if necessary) the file chooser.
        Returns:
        the file chooser
      • createFileMenu

        protected JMenu createFileMenu()
        Creates the "File" menu.
        Returns:
        the generated menu
      • indexOfMenuItem

        protected int indexOfMenuItem​(JMenu menu,
                                      JMenuItem menuitem)
        Determines the index of the menu item in the specified menu.
        Parameters:
        menu - the menu to search in
        menuitem - the menu item to get the index for
        Returns:
        the index, -1 if not found
      • createMenuBar

        protected JMenuBar createMenuBar()
        Assembles the menu bar.
        Returns:
        the menu bar
      • getMenuBar

        public JMenuBar getMenuBar()
        Creates a menu bar (singleton per panel object). Can be used in frames.
        Specified by:
        getMenuBar in interface MenuBarProvider
        Returns:
        the menu bar
      • updateMenu

        protected void updateMenu()
        updates the enabled state of the menu items.
      • supportsClear

        protected boolean supportsClear()
        Whether "clear" is supported and shows up in the menu.
        Returns:
        true if supported
      • clear

        protected void clear()
        Clears the display.
      • saveAs

        protected void saveAs()
        Saves the setups.
      • close

        protected void close()
        Closes the dialog or frame.
      • getCustomTextFileFilter

        public ExtensionFileFilter getCustomTextFileFilter()
        Returns a custom file filter for the file chooser.

        Default implementation returns null.
        Specified by:
        getCustomTextFileFilter in interface TextSupplier
        Returns:
        the file filter, null if to use default one
      • getCreateFrame

        public boolean getCreateFrame()
        Returns whether the frame is created as well as the panel.
        Overrides:
        getCreateFrame in class AbstractDisplay
        Returns:
        true if the frame is created as well
      • setUp

        public String setUp()
        Initializes the item for flow execution. Also calls the reset() method first before anything else.
        Specified by:
        setUp in interface Actor
        Overrides:
        setUp in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message
        See Also:
        AbstractActor.reset()
      • wrapUp

        public void wrapUp()
        Cleans up after the execution has finished.
        Specified by:
        wrapUp in interface Actor
        Overrides:
        wrapUp in class AbstractDisplay
      • cleanUpGUI

        protected void cleanUpGUI()
        Removes all graphical components.
        Overrides:
        cleanUpGUI in class AbstractDisplay
      • hasSendToItem

        public boolean hasSendToItem​(Class[] cls)
        Checks whether something to send is available.
        Specified by:
        hasSendToItem in interface SendToActionSupporter
        Parameters:
        cls - the classes to retrieve the item for
        Returns:
        true if an object is available for sending
      • getSendToItem

        public Object getSendToItem​(Class[] cls)
        Returns the object to send.
        Specified by:
        getSendToItem in interface SendToActionSupporter
        Parameters:
        cls - the classes to retrieve the item for
        Returns:
        the item to send