Class SpreadSheetTable

    • Field Detail

      • m_HeaderPopupMenuCustomizer

        protected PopupMenuCustomizer m_HeaderPopupMenuCustomizer
        the customizer for the table header popup menu.
      • m_CellPopupMenuCustomizer

        protected PopupMenuCustomizer m_CellPopupMenuCustomizer
        the customizer for the table cells popup menu.
      • m_LastSetup

        protected HashMap<String,​Object> m_LastSetup
        for keeping track of the setups being used (classname-{plot|process}-{column|row} - setup).
    • Constructor Detail

      • SpreadSheetTable

        public SpreadSheetTable​(SpreadSheet sheet)
        Initializes the table.
        Parameters:
        sheet - the underlying spread sheet
      • SpreadSheetTable

        public SpreadSheetTable​(SpreadSheetTableModel model)
        Initializes the table.
        Parameters:
        model - the underlying spread sheet model
    • Method Detail

      • setCustomCellRenderer

        protected void setCustomCellRenderer()
        Sets the custom cell renderer.
      • getTableModelClass

        protected Class getTableModelClass()
        Returns the class of the table model that the models need to be derived from. The default implementation just returns TableModel.class
        Overrides:
        getTableModelClass in class SortableAndSearchableTable
        Returns:
        the class the models must be derived from
      • getCellAt

        public Cell getCellAt​(int rowIndex,
                              int columnIndex)
        Returns the spread sheet cell at the specified location.
        Parameters:
        rowIndex - the current display row index
        columnIndex - the column index
        Returns:
        the cell or null if invalid coordinates
      • setNumDecimals

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

        public int getNumDecimals()
        Returns the currently set number of decimals. -1 if displaying all.
        Returns:
        the number of decimals
      • selectionRowToModelRow

        protected int selectionRowToModelRow​(int index)
        Determines the actual row index.
        Overrides:
        selectionRowToModelRow in class BaseTable
        Parameters:
        index - the selected row
        Returns:
        the actual model row
      • showHeaderPopupMenu

        protected void showHeaderPopupMenu​(MouseEvent e)
        Shows a popup menu for the header.
        Parameters:
        e - the event that triggered the menu
      • showCellPopupMenu

        protected void showCellPopupMenu​(MouseEvent e)
        Shows a popup menu for the cells.
        Parameters:
        e - the event that triggered the menu
      • createCellPopupMenu

        protected BasePopupMenu createCellPopupMenu​(MouseEvent e)
        Creates a popup menu for the cells.
        Parameters:
        e - the event that triggered the menu
        Returns:
        the menu
      • setHeaderPopupMenuCustomizer

        public void setHeaderPopupMenuCustomizer​(PopupMenuCustomizer value)
        Sets the popup menu customizer to use (for the header).
        Parameters:
        value - the customizer, null to remove it
      • getHeaderPopupMenuCustomizer

        public PopupMenuCustomizer getHeaderPopupMenuCustomizer()
        Returns the current popup menu customizer (for the header).
        Returns:
        the customizer, null if none set
      • setCellPopupMenuCustomizer

        public void setCellPopupMenuCustomizer​(PopupMenuCustomizer value)
        Sets the popup menu customizer to use (for the cells).
        Parameters:
        value - the customizer, null to remove it
      • getCellPopupMenuCustomizer

        public PopupMenuCustomizer getCellPopupMenuCustomizer()
        Returns the current popup menu customizer (for the cells).
        Returns:
        the customizer, null if none set
      • 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
      • setShowFormulas

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

        public boolean getShowFormulas()
        Returns whether to display the formulas or their calculated values.
        Returns:
        true if to display the formulas rather than the calculated values
      • setShowRowColumn

        public void setShowRowColumn​(boolean value)
        Whether to display the column with the row numbers.
        Parameters:
        value - true if to display column
      • getShowRowColumn

        public boolean getShowRowColumn()
        Returns whether the column with the row numbers is displayed.
        Returns:
        true if column displayed
      • setUseSimpleHeader

        public void setUseSimpleHeader​(boolean value)
        Whether to display a simple header or an HTML one with the column indices.
        Parameters:
        value - true if to display simple header
      • getUseSimpleHeader

        public boolean getUseSimpleHeader()
        Returns whether to display a simple header or an HTML one with the column indices.
        Returns:
        true if simple header displayed
      • setReadOnly

        public void setReadOnly​(boolean value)
        Sets whether the table is read-only.
        Parameters:
        value - true if read-only
      • isReadOnly

        public boolean isReadOnly()
        Returns whether the table is read-only.
        Returns:
        true if read-only
      • setModified

        public void setModified​(boolean value)
        Sets whether the table has been modified.
        Parameters:
        value - true if modified
      • isModified

        public boolean isModified()
        Returns whether the table has been modified.
        Returns:
        true if modified
      • setShowCellTypes

        public void setShowCellTypes​(boolean value)
        Sets whether to show the cell types rather than the cell values.
        Parameters:
        value - true if to show cell types
      • getShowCellTypes

        public boolean getShowCellTypes()
        Returns whether to show the cell types rather than the cell values.
        Returns:
        true if showing the cell types
      • sort

        public void sort​(RowComparator comparator)
        Sorts the spreadsheet with the given comparator.
        Parameters:
        comparator - the row comparator to use
      • enterNumDecimals

        protected void enterNumDecimals()
        Prompts the user to enter the number of displayed decimals
      • createLastSetupKey

        protected String createLastSetupKey​(Class cls,
                                            boolean plot,
                                            boolean row)
        Generates a key for the HashMap used for the last setups.
        Parameters:
        cls - the scheme
        plot - plot or process
        row - row or column
        Returns:
        the generated key
      • addLastSetup

        public void addLastSetup​(Class cls,
                                 boolean plot,
                                 boolean row,
                                 Object setup)
        Stores this last setup.
        Parameters:
        cls - the scheme
        plot - plot or process
        row - row or column
        setup - the setup to add
      • getLastSetup

        public Object getLastSetup​(Class cls,
                                   boolean plot,
                                   boolean row)
        Returns any last setup if available.
        Parameters:
        cls - the scheme
        plot - plot or process
        row - row or column
        Returns:
        the last setup or null if none stored
      • 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