Class CTable

    • Field Detail

      • p_lastSortIndex

        protected int p_lastSortIndex
        Last model index sorted
      • p_asc

        protected boolean p_asc
        Sort direction
      • p_keyColumnIndex

        protected int p_keyColumnIndex
        Model Index of Key Column
      • sorting

        protected boolean sorting
        state variable to indicate sorting in progress
    • Constructor Detail

      • CTable

        public CTable()
        Default Constructor
    • Method Detail

      • setKeyColumnIndex

        public void setKeyColumnIndex​(int keyColumnIndex)
        Set Model index of Key Column. Used for identifying previous selected row after fort complete to set as selected row. If not set, column 0 is used.
        Parameters:
        keyColumnIndex - model index
      • getKeyColumnIndex

        public int getKeyColumnIndex()
        Get Model index of Key Column
        Returns:
        model index
      • getSelectedKeyColumnValue

        public Object getSelectedKeyColumnValue()
        Get Current Row Key Column Value
        Returns:
        value or null
      • getSelectedValue

        public Object getSelectedValue()
        Get Selected Value or null
        Returns:
        value
      • stopEditor

        public void stopEditor​(boolean saveValue)
        Stop Table Editors and remove focus
        Parameters:
        saveValue - save value
      • autoSize

        public void autoSize​(boolean useColumnIdentifier)
        Size Columns.
        Parameters:
        useColumnIdentifier - if false uses plain content - otherwise uses Column Identifier to indicate displayed columns
      • packColumn

        public void packColumn​(TableColumn column)
      • sort

        protected void sort​(int modelColumnIndex)
        Sort Table
        Parameters:
        modelColumnIndex - model column sort index
      • getSortColumn

        public int getSortColumn()
        Returns:
        column index
      • isSortAscending

        public boolean isSortAscending()
        Returns:
        boolean
      • isColumnControlVisible

        public boolean isColumnControlVisible()
        Returns the column control visible property.

        Returns:
        boolean to indicate whether the column control is visible.
        See Also:
        setColumnControlVisible(boolean), #setColumnControl(JComponent)
      • setColumnControlVisible

        public void setColumnControlVisible​(boolean visible)
        Sets the column control visible property. If true and JXTable is contained in a JScrollPane, the table adds the column control to the trailing corner of the scroll pane.

        Note: if the table is not inside a JScrollPane the column control is not shown even if this returns true. In this case it's the responsibility of the client code to actually show it.

        The default value is false.

        Parameters:
        visible - boolean to indicate if the column control should be shown
        See Also:
        isColumnControlVisible(), #setColumnControl(JComponent)
      • getColumnControl

        public JComponent getColumnControl()
        Returns the component used as column control. Lazily creates the control to the default if it is null.
        Returns:
        component for column control, guaranteed to be != null.
        See Also:
        #setColumnControl(JComponent), createDefaultColumnControl()
      • createDefaultColumnControl

        protected JComponent createDefaultColumnControl()
        Creates the default column control used by this table. This implementation returns a ColumnControlButton configured with default ColumnControlIcon.
        Returns:
        the default component used as column control.
        See Also:
        #setColumnControl(JComponent), ColumnControlButton, ColumnControlIcon
      • configureColumnControl

        protected void configureColumnControl()
        Configures the upper trailing corner of an enclosing JScrollPane. Adds/removes the ColumnControl depending on the columnControlVisible property.

        See Also:
        setColumnControlVisible(boolean), #setColumnControl(JComponent)
      • isColumnVisible

        public boolean isColumnVisible​(TableColumn column)
        Parameters:
        column -
        Returns:
        boolean
      • setColumnVisibility

        public void setColumnVisibility​(TableColumn column,
                                        boolean visible)
        Hide or show column
        Parameters:
        column -
        visible -