Class SpreadSheetDisplay

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

    public class SpreadSheetDisplay
    extends AbstractTextualDisplay
    implements DisplayPanelProvider, SpreadSheetSupporter, ComponentSupplier
    Actor for displaying a spreadsheet.
    Custom background for negative/positive values can be specified as well.

    Input/output:
    - accepts:
       adams.data.spreadsheet.SpreadSheet
       adams.data.spreadsheet.SpreadSheetSupporter


    -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: SpreadSheetDisplay
     
    -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
     
    -short-title <boolean> (property: shortTitle)
        If enabled uses just the name for the title instead of the actor's full
        name.
        default: false
     
    -display-type <adams.flow.core.displaytype.AbstractDisplayType> (property: displayType)
        Determines how to show the display, eg as standalone frame (default) or
        in the Flow editor window.
        default: adams.flow.core.displaytype.Default
     
    -width <int> (property: width)
        The width of the dialog.
        default: 640
        minimum: -1
     
    -height <int> (property: height)
        The height of the dialog.
        default: 480
        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
     
    -font <java.awt.Font> (property: font)
        The font of the dialog.
        default: Monospaced-PLAIN-12
     
    -num-decimals <int> (property: numDecimals)
        The number of decimals for numeric values.
        default: 3
        minimum: -1
     
    -cell-rendering-customizer <adams.gui.core.spreadsheettable.CellRenderingCustomizer> (property: cellRenderingCustomizer)
        The customizer for the cell rendering.
        default: adams.gui.core.spreadsheettable.DefaultCellRenderingCustomizer
     
    -show-row-index-col <boolean> (property: showRowIndexColumn)
        Whether to show the row index column.
        default: true
     
    -show-formulas <boolean> (property: showFormulas)
        Whether to show the formulas or the calculated values.
        default: false
     
    -use-simple-header <boolean> (property: useSimpleHeader)
        Whether to use a simple table header (and also suppress the combobox for
        jumping to a column).
        default: false
     
    -allow-search <boolean> (property: allowSearch)
        Whether to allow the user to search the table.
        default: false
     
    -optimal-column-width <boolean> (property: optimalColumnWidth)
        Whether to calculate the optimal column width whenever a token is displayed
        (= enabled) or only when flow finishes.
        default: true
     
    -read-only <boolean> (property: readOnly)
        Whether cells are read-only or editable.
        default: true
     
    -writer <adams.data.io.output.AbstractTextWriter> (property: writer)
        The writer to use for storing the textual output.
        default: adams.data.io.output.NullWriter
     
    -selected-rows-processor <adams.gui.core.spreadsheettable.ProcessSelectedRows> [-selected-rows-processor ...] (property: selectedRowsProcessors)
        The schemes that allow processing of the selected rows.
        default:
     
    -preview <adams.gui.core.spreadsheetpreview.AbstractSpreadSheetPreview> (property: preview)
        The preview to use for selected rows.
        default: adams.gui.core.spreadsheetpreview.NullPreview
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_PanelSearch

        protected SearchPanel m_PanelSearch
        the search panel.
      • m_NumDecimals

        protected int m_NumDecimals
        the number of decimals for numeric values.
      • m_ShowRowIndexColumn

        protected boolean m_ShowRowIndexColumn
        whether to show the column with the row index.
      • m_ShowFormulas

        protected boolean m_ShowFormulas
        whether to show the formulas instead of the calculated values.
      • m_UseSimpleHeader

        protected boolean m_UseSimpleHeader
        whether to use the simple header.
      • m_AllowSearch

        protected boolean m_AllowSearch
        whether to allow searching.
      • m_OptimalColumnWidth

        protected boolean m_OptimalColumnWidth
        whether to optimize the column width whenever a token is displayed.
      • m_ReadOnly

        protected boolean m_ReadOnly
        whether the table is read only.
      • m_SelectedRowsProcessors

        protected ProcessSelectedRows[] m_SelectedRowsProcessors
        for processing the selected rows.
    • Constructor Detail

      • SpreadSheetDisplay

        public SpreadSheetDisplay()
    • Method Detail

      • setNumDecimals

        public void setNumDecimals​(int value)
        Sets the number of decimals to display.
        Parameters:
        value - the number of decimals
      • getNumDecimals

        public int getNumDecimals()
        Returns the currently set number of decimals to display.
        Returns:
        the number of decimals
      • numDecimalsTipText

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

        public void setCellRenderingCustomizer​(CellRenderingCustomizer value)
        Sets the cell rendering customizer.
        Parameters:
        value - the customizer
      • getCellRenderingCustomizer

        public CellRenderingCustomizer getCellRenderingCustomizer()
        Returns the cell rendering customizer.
        Returns:
        the customizer
      • cellRenderingCustomizerTipText

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

        public void setShowFormulas​(boolean value)
        Sets whether to show the formulas or the calculated values.
        Parameters:
        value - true if to show formulas
      • getShowFormulas

        public boolean getShowFormulas()
        Returns whether to show the formulas or the calculated values.
        Returns:
        true if to show formulas
      • showFormulasTipText

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

        public void setShowRowIndexColumn​(boolean value)
        Sets whether to show the column with the row indices.
        Parameters:
        value - true if to show the column
      • getShowRowIndexColumn

        public boolean getShowRowIndexColumn()
        Returns whether to show the column with the row indices.
        Returns:
        true if to show the column
      • showRowIndexColumnTipText

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

        public void setUseSimpleHeader​(boolean value)
        Sets whether to use a simple table (and also suppress the combobox for jumping to a column).
        Parameters:
        value - true if to use
      • getUseSimpleHeader

        public boolean getUseSimpleHeader()
        Returns whether to use a simple table (and also suppress the combobox for jumping to a column).
        Returns:
        true if to use
      • useSimpleHeaderTipText

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

        public void setAllowSearch​(boolean value)
        Sets whether to allow the user to search the table.
        Parameters:
        value - true if to allow search
      • getAllowSearch

        public boolean getAllowSearch()
        Returns whether to allow the user to search the table.
        Returns:
        true if to allow search
      • allowSearchTipText

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

        public void setOptimalColumnWidth​(boolean value)
        Sets whether calculate the optimal column widht whenever a token is displayed (= true) or just when the flow finishes.
        Parameters:
        value - true if to always recaculate
      • getOptimalColumnWidth

        public boolean getOptimalColumnWidth()
        Returns whether calculate the optimal column widht whenever a token is displayed (= true) or just when the flow finishes.
        Returns:
        true if to always recalculate
      • optimalColumnWidthTipText

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

        public void setReadOnly​(boolean value)
        Sets whether cells are readonly or editable.
        Parameters:
        value - true if read only
      • getReadOnly

        public boolean getReadOnly()
        Returns whether cells are readonly or editable.
        Returns:
        true if read only
      • readOnlyTipText

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

        public void setSelectedRowsProcessors​(ProcessSelectedRows[] value)
        Sets the processors for the selected rows.
        Parameters:
        value - the processors
      • getSelectedRowsProcessors

        public ProcessSelectedRows[] getSelectedRowsProcessors()
        Returns the processors for the selected rows.
        Returns:
        the processors
      • selectedRowsProcessorsTipText

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

        public void setPreview​(AbstractSpreadSheetPreview value)
        Sets the preview to use for selected rows.
        Parameters:
        value - the preview
      • previewTipText

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

        protected int getDefaultWidth()
        Returns the default width for the dialog.
        Overrides:
        getDefaultWidth in class AbstractDisplay
        Returns:
        the default width
      • getDefaultHeight

        protected int getDefaultHeight()
        Returns the default height for the dialog.
        Overrides:
        getDefaultHeight in class AbstractDisplay
        Returns:
        the default height
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        adams.data.spreadsheet.SpreadSheet.class, adams.data.spreadsheet.SpreadSheetSupporter.class
      • display

        protected void display​(Token token)
        Displays the token (the panel and dialog have already been created at this stage).
        Specified by:
        display in class AbstractDisplay
        Parameters:
        token - the token to display
      • displayPanelRequiresScrollPane

        public boolean displayPanelRequiresScrollPane()
        Returns whether the created display panel requires a scroll pane or not.
        Specified by:
        displayPanelRequiresScrollPane in interface DisplayPanelProvider
        Returns:
        true if the display panel requires a scroll pane
      • doExecute

        protected String doExecute()
        Executes the flow item.

        Outputs the token on the command-line in headless mode.
        Overrides:
        doExecute in class AbstractTextualDisplay
        Returns:
        null if everything is fine, otherwise error message
      • supplyComponent

        public JComponent supplyComponent()
        Supplies the component. May get called even before actor has been executed.
        Specified by:
        supplyComponent in interface ComponentSupplier
        Returns:
        the component, null if none available