Class TerraTableViewSkin

    • Constructor Detail

      • TerraTableViewSkin

        public TerraTableViewSkin()
    • Method Detail

      • install

        public void install​(Component component)
        Description copied from class: ComponentSkin
        Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.
        Specified by:
        install in interface Skin
        Overrides:
        install in class ComponentSkin
        Parameters:
        component - The component to which the skin is being attached.
      • getPreferredWidth

        public int getPreferredWidth​(int height)
        Description copied from interface: ConstrainedVisual
        Returns the visual's preferred width given the provided height constraint.
        Specified by:
        getPreferredWidth in interface ConstrainedVisual
        Parameters:
        height - The height by which to constrain the preferred width, or -1 for no constraint.
        Returns:
        The preferred width given the height constraint.
      • getPreferredWidth

        public static int getPreferredWidth​(TableView tableView,
                                            boolean includeTrailingVerticalGridLine)
      • getPreferredHeight

        public int getPreferredHeight​(int width)
        Description copied from interface: ConstrainedVisual
        Returns the visual's preferred height given the provided width constraint.
        Specified by:
        getPreferredHeight in interface ConstrainedVisual
        Parameters:
        width - The width by which to constrain the preferred height, or -1 for no constraint.
        Returns:
        The preferred height given the width constraint.
      • getBaseline

        public int getBaseline​(int width,
                               int height)
        Description copied from class: ComponentSkin
        Should be implemented in every subclass.

        The default implementation here simply returns -1 (no baseline).

        Specified by:
        getBaseline in interface ConstrainedVisual
        Overrides:
        getBaseline in class ComponentSkin
        Parameters:
        width - Constrained width to compute the baseline for.
        height - Constrained height to compute the baseline for.
        Returns:
        The baseline relative to the origin of this visual, or -1 if this visual does not have a baseline.
      • layout

        public void layout()
        Description copied from interface: Skin
        If the component on which the skin is installed is a container, lays out the container's children.
        Specified by:
        layout in interface Skin
      • paint

        public void paint​(java.awt.Graphics2D graphics)
        Description copied from interface: Visual
        Paints the visual.
        Specified by:
        paint in interface Visual
        Parameters:
        graphics - The graphics context in which to paint the visual.
      • getVariableRowHeight

        protected int getVariableRowHeight​(int rowIndex,
                                           ArrayList<java.lang.Integer> columnWidthsArgument)
      • getColumnWidths

        public static ArrayList<java.lang.Integer> getColumnWidths​(TableView tableView,
                                                                   int width)
      • isFocusable

        public final boolean isFocusable()
        Description copied from class: ComponentSkin
        By default, skins are focusable.
        Specified by:
        isFocusable in interface Skin
        Overrides:
        isFocusable in class ComponentSkin
        Returns:
        true if this skin is focusable; false, otherwise.
      • isOpaque

        public final boolean isOpaque()
        Description copied from class: ComponentSkin
        By default, skins are assumed to be opaque.
        Specified by:
        isOpaque in interface Skin
        Overrides:
        isOpaque in class ComponentSkin
        Returns:
        true if this skin is opaque; false if any part of it is transparent or translucent.
      • getFont

        public final java.awt.Font getFont()
      • setFont

        public final void setFont​(java.awt.Font font)
      • setFont

        public final void setFont​(java.lang.String font)
      • setFont

        public final void setFont​(Dictionary<java.lang.String,​?> font)
      • getColor

        public final java.awt.Color getColor()
      • setColor

        public final void setColor​(java.awt.Color color)
      • setColor

        public final void setColor​(java.lang.String color)
      • setColor

        public final void setColor​(int color)
      • getDisabledColor

        public final java.awt.Color getDisabledColor()
      • setDisabledColor

        public final void setDisabledColor​(java.awt.Color disabledColor)
      • setDisabledColor

        public final void setDisabledColor​(java.lang.String disabledColor)
      • setDisabledColor

        public final void setDisabledColor​(int disabledColor)
      • getBackgroundColor

        public final java.awt.Color getBackgroundColor()
      • setBackgroundColor

        public final void setBackgroundColor​(java.awt.Color backgroundColor)
      • setBackgroundColor

        public final void setBackgroundColor​(java.lang.String backgroundColor)
      • setBackgroundColor

        public final void setBackgroundColor​(int backgroundColor)
      • getSelectionColor

        public final java.awt.Color getSelectionColor()
      • setSelectionColor

        public final void setSelectionColor​(java.awt.Color selectionColor)
      • setSelectionColor

        public final void setSelectionColor​(java.lang.String selectionColor)
      • setSelectionColor

        public final void setSelectionColor​(int selectionColor)
      • getSelectionBackgroundColor

        public final java.awt.Color getSelectionBackgroundColor()
      • setSelectionBackgroundColor

        public final void setSelectionBackgroundColor​(java.awt.Color selectionBackgroundColor)
      • setSelectionBackgroundColor

        public final void setSelectionBackgroundColor​(java.lang.String selectionBackgroundColor)
      • setSelectionBackgroundColor

        public final void setSelectionBackgroundColor​(int selectionBackgroundColor)
      • getInactiveSelectionColor

        public final java.awt.Color getInactiveSelectionColor()
      • setInactiveSelectionColor

        public final void setInactiveSelectionColor​(java.awt.Color inactiveSelectionColor)
      • setInactiveSelectionColor

        public final void setInactiveSelectionColor​(java.lang.String inactiveSelectionColor)
      • setInactiveSelectionColor

        public final void setInactiveSelectionColor​(int inactiveSelectionColor)
      • getInactiveSelectionBackgroundColor

        public final java.awt.Color getInactiveSelectionBackgroundColor()
      • setInactiveSelectionBackgroundColor

        public final void setInactiveSelectionBackgroundColor​(java.awt.Color inactiveSelectionBackgroundColor)
      • setInactiveSelectionBackgroundColor

        public final void setInactiveSelectionBackgroundColor​(java.lang.String inactiveSelectionBackgroundColor)
      • setInactiveSelectionBackgroundColor

        public final void setInactiveSelectionBackgroundColor​(int inactiveSelectionBackgroundColor)
      • getHighlightBackgroundColor

        public final java.awt.Color getHighlightBackgroundColor()
      • setHighlightBackgroundColor

        public final void setHighlightBackgroundColor​(java.awt.Color highlightBackgroundColor)
      • setHighlightBackgroundColor

        public final void setHighlightBackgroundColor​(java.lang.String highlightBackgroundColor)
      • setHighlightBackgroundColor

        public final void setHighlightBackgroundColor​(int highlightBackgroundColor)
      • getAlternateRowBackgroundColor

        public final java.awt.Color getAlternateRowBackgroundColor()
      • setAlternateRowBackgroundColor

        public final void setAlternateRowBackgroundColor​(java.awt.Color alternateRowBackgroundColor)
      • setAlternateRowBackgroundColor

        public final void setAlternateRowBackgroundColor​(java.lang.String alternateRowBackgroundColor)
      • setAlternateRowBackgroundColor

        public final void setAlternateRowBackgroundColor​(int alternateRowBackgroundColor)
      • getColumnSelectionColor

        public final java.awt.Color getColumnSelectionColor()
      • setColumnSelectionColor

        public final void setColumnSelectionColor​(java.awt.Color columnSelectionColor)
      • setColumnSelectionColor

        public final void setColumnSelectionColor​(java.lang.String columnSelectionColor)
      • setColumnSelectionColor

        public final void setColumnSelectionColor​(int columnSelectionColor)
      • getColumnSelectionHorizontalGridColor

        public final java.awt.Color getColumnSelectionHorizontalGridColor()
      • setColumnSelectionHorizontalGridColor

        public final void setColumnSelectionHorizontalGridColor​(java.awt.Color columnSelectionHorizontalGridColor)
      • setColumnSelectionHorizontalGridColor

        public final void setColumnSelectionHorizontalGridColor​(java.lang.String columnSelectionHorizontalGridColor)
      • setColumnSelectionHorizontalGridColor

        public final void setColumnSelectionHorizontalGridColor​(int columnSelectionHorizontalGridColor)
      • getHorizontalGridColor

        public final java.awt.Color getHorizontalGridColor()
      • setHorizontalGridColor

        public final void setHorizontalGridColor​(java.awt.Color horizontalGridColor)
      • setHorizontalGridColor

        public final void setHorizontalGridColor​(java.lang.String horizontalGridColor)
      • setHorizontalGridColor

        public final void setHorizontalGridColor​(int horizontalGridColor)
      • getVerticalGridColor

        public final java.awt.Color getVerticalGridColor()
      • setVerticalGridColor

        public final void setVerticalGridColor​(java.awt.Color verticalGridColor)
      • setVerticalGridColor

        public final void setVerticalGridColor​(java.lang.String verticalGridColor)
      • setVerticalGridColor

        public final void setVerticalGridColor​(int verticalGridColor)
      • getShowHighlight

        public final boolean getShowHighlight()
      • setShowHighlight

        public final void setShowHighlight​(boolean showHighlight)
      • getShowHorizontalGridLines

        public final boolean getShowHorizontalGridLines()
      • setShowHorizontalGridLines

        public final void setShowHorizontalGridLines​(boolean showHorizontalGridLines)
      • getShowVerticalGridLines

        public final boolean getShowVerticalGridLines()
      • setShowVerticalGridLines

        public final void setShowVerticalGridLines​(boolean showVerticalGridLines)
      • getIncludeTrailingVerticalGridLine

        public final boolean getIncludeTrailingVerticalGridLine()
      • setIncludeTrailingVerticalGridLine

        public final void setIncludeTrailingVerticalGridLine​(boolean includeTrailingVerticalGridLine)
      • getIncludeTrailingHorizontalGridLine

        public final boolean getIncludeTrailingHorizontalGridLine()
      • setIncludeTrailingHorizontalGridLine

        public final void setIncludeTrailingHorizontalGridLine​(boolean includeTrailingHorizontalGridLine)
      • isVariableRowHeight

        public final boolean isVariableRowHeight()
      • setVariableRowHeight

        public final void setVariableRowHeight​(boolean variableRowHeight)
      • isEditOnMouseDown

        public final boolean isEditOnMouseDown()
        Returns:
        Is this TableView going into edit mode on a mouse down or on a mouse double click?
      • setEditOnMouseDown

        public final void setEditOnMouseDown​(boolean editOnMouseDown)
        Set whether this TableView will go into edit mode on a mouse down or on a mouse double click (the default).

        Setting this to true can reduce the number of mouse clicks necessary to rapidly edit a table view.

        Parameters:
        editOnMouseDown - The new setting.
      • mouseMove

        public boolean mouseMove​(Component component,
                                 int x,
                                 int y)
        Description copied from interface: ComponentMouseListener
        Called when the mouse is moved over a component.
        Specified by:
        mouseMove in interface ComponentMouseListener
        Overrides:
        mouseMove in class ComponentSkin
        Parameters:
        component - Component that is under the mouse.
        x - X position of the mouse.
        y - Y position of the mouse.
        Returns:
        true to consume the event; false to allow it to propagate (default return).
      • mouseDown

        public boolean mouseDown​(Component component,
                                 Mouse.Button button,
                                 int x,
                                 int y)
        Description copied from interface: ComponentMouseButtonListener
        Called when a mouse button is pressed over a component.
        Specified by:
        mouseDown in interface ComponentMouseButtonListener
        Overrides:
        mouseDown in class ComponentSkin
        Parameters:
        component - Component that is under the mouse pointer.
        button - Which mouse button was pressed.
        x - X position of the mouse.
        y - Y position of the mouse.
        Returns:
        true to consume the event; false to allow it to propagate (default).
      • mouseUp

        public boolean mouseUp​(Component component,
                               Mouse.Button button,
                               int x,
                               int y)
        Description copied from interface: ComponentMouseButtonListener
        Called when a mouse button is released over a component.
        Specified by:
        mouseUp in interface ComponentMouseButtonListener
        Overrides:
        mouseUp in class ComponentSkin
        Parameters:
        component - Component user the mouse pointer.
        button - Which mouse button that was released.
        x - X position of the mouse.
        y - Y position of the mouse.
        Returns:
        true to consume the event; false to allow it to propagate (default).
      • mouseClick

        public boolean mouseClick​(Component component,
                                  Mouse.Button button,
                                  int x,
                                  int y,
                                  int count)
        Description copied from interface: ComponentMouseButtonListener
        Called when a mouse button is clicked over a component.
        Specified by:
        mouseClick in interface ComponentMouseButtonListener
        Overrides:
        mouseClick in class ComponentSkin
        Parameters:
        component - Component user the mouse pointer.
        button - Which mouse button was clicked.
        x - X position of the mouse.
        y - Y position of the mouse.
        count - Number of clicks (1 = single click, 2 = double click, etc.).
        Returns:
        true to consume the event; false to allow it to propagate (default).
      • mouseWheel

        public boolean mouseWheel​(Component component,
                                  Mouse.ScrollType scrollType,
                                  int scrollAmount,
                                  int wheelRotation,
                                  int x,
                                  int y)
        Description copied from interface: ComponentMouseWheelListener
        Called when the mouse wheel is scrolled over a component.
        Specified by:
        mouseWheel in interface ComponentMouseWheelListener
        Overrides:
        mouseWheel in class ComponentSkin
        Parameters:
        component - Component under the mouse pointer.
        scrollType - What type of scroll was requested on the mouse.
        scrollAmount - Amount of scrolling.
        wheelRotation - Rotation value.
        x - X position of the mouse.
        y - Y position of the mouse.
        Returns:
        true to consume the event; false to allow it to propagate.
      • enabledChanged

        public void enabledChanged​(Component component)
        Description copied from interface: ComponentStateListener
        Called when a component's enabled state has changed.

        Called both when the component is enabled and when it is disabled. The component's enabled flag has already been set when this method is called so the new state can be determined by calling the Component.isEnabled() method.

        Specified by:
        enabledChanged in interface ComponentStateListener
        Overrides:
        enabledChanged in class ComponentSkin
        Parameters:
        component - The component whose enabled state is changing.
      • focusedChanged

        public void focusedChanged​(Component component,
                                   Component obverseComponent)
        Description copied from interface: ComponentStateListener
        Called when a component's focused state has changed.

        This will be called both when a component gains focus and when it loses focus. The currently focused component has already been set when this method is called, so that the new state of the component can be determined by calling the Component.isFocused() method.

        Specified by:
        focusedChanged in interface ComponentStateListener
        Overrides:
        focusedChanged in class ComponentSkin
        Parameters:
        component - The component that is either gaining focus or the one that previously had focus and is now losing it.
        obverseComponent - If the component is gaining focus, this is the component that is losing focus. If the component is losing focus this is the component that is gaining the focus instead.
      • tableDataChanged

        public void tableDataChanged​(TableView tableView,
                                     List<?> previousTableData)
        Description copied from interface: TableViewListener
        Called when a table view's table data has changed.
        Specified by:
        tableDataChanged in interface TableViewListener
        Parameters:
        tableView - The source of this event.
        previousTableData - The previous data list for this table view.
      • columnSourceChanged

        public void columnSourceChanged​(TableView tableView,
                                        TableView previousColumnSource)
        Description copied from interface: TableViewListener
        Called when a table view's column source has changed.
        Specified by:
        columnSourceChanged in interface TableViewListener
        Parameters:
        tableView - The source of this event.
        previousColumnSource - The previous column source for this table.
      • rowEditorChanged

        public void rowEditorChanged​(TableView tableView,
                                     TableView.RowEditor previousRowEditor)
        Description copied from interface: TableViewListener
        Called when a table view's row editor has changed.
        Specified by:
        rowEditorChanged in interface TableViewListener
        Parameters:
        tableView - The source of this event.
        previousRowEditor - The row editor that was previously used.
      • disabledRowFilterChanged

        public void disabledRowFilterChanged​(TableView tableView,
                                             Filter<?> previousDisabledRowFilter)
        Description copied from interface: TableViewListener
        Called when a table view's disabled row filter has changed.
        Specified by:
        disabledRowFilterChanged in interface TableViewListener
        Parameters:
        tableView - The table view in question.
        previousDisabledRowFilter - What the previous filter for disabled rows was.
      • columnInserted

        public void columnInserted​(TableView tableView,
                                   int index)
        Description copied from interface: TableViewColumnListener
        Called when a column is inserted into a table view's column sequence.
        Specified by:
        columnInserted in interface TableViewColumnListener
        Parameters:
        tableView - The table view that has changed.
        index - Where the new column has been inserted.
      • columnsRemoved

        public void columnsRemoved​(TableView tableView,
                                   int index,
                                   Sequence<TableView.Column> columns)
        Description copied from interface: TableViewColumnListener
        Called when columns are removed from a table view's column sequence.
        Specified by:
        columnsRemoved in interface TableViewColumnListener
        Parameters:
        tableView - The table view that has changed.
        index - The starting location of the removed columns.
        columns - The actual sequence of columns that were removed.
      • columnWidthChanged

        public void columnWidthChanged​(TableView.Column column,
                                       int previousWidth,
                                       boolean previousRelative)
        Description copied from interface: TableViewColumnListener
        Called when a column's width has changed.
        Specified by:
        columnWidthChanged in interface TableViewColumnListener
        Parameters:
        column - The column that changed.
        previousWidth - The previous numeric value of the column width.
        previousRelative - Whether the previous width was relative or not.
      • columnWidthLimitsChanged

        public void columnWidthLimitsChanged​(TableView.Column column,
                                             int previousMinimumWidth,
                                             int previousMaximumWidth)
        Description copied from interface: TableViewColumnListener
        Called when a column's width limits have changed.
        Specified by:
        columnWidthLimitsChanged in interface TableViewColumnListener
        Parameters:
        column - The source of this event.
        previousMinimumWidth - The previous minimum column width.
        previousMaximumWidth - The previous maximum column width.
      • rowInserted

        public void rowInserted​(TableView tableView,
                                int index)
        Description copied from interface: TableViewRowListener
        Called when a row has been inserted into the table view.
        Specified by:
        rowInserted in interface TableViewRowListener
        Parameters:
        tableView - The source of the event.
        index - The index of the row that was inserted.
      • rowsRemoved

        public void rowsRemoved​(TableView tableView,
                                int index,
                                int count)
        Description copied from interface: TableViewRowListener
        Called when rows have been removed from the table view.
        Specified by:
        rowsRemoved in interface TableViewRowListener
        Parameters:
        tableView - The source of the event.
        index - The first index affected by the event.
        count - The number of rows that were removed, or -1 if all rows were removed.
      • rowUpdated

        public void rowUpdated​(TableView tableView,
                               int index)
        Description copied from interface: TableViewRowListener
        Called when an row in the table view has been updated.
        Specified by:
        rowUpdated in interface TableViewRowListener
        Parameters:
        tableView - The source of the event.
        index - The first index affected by the event.
      • selectedRangeAdded

        public void selectedRangeAdded​(TableView tableView,
                                       int rangeStart,
                                       int rangeEnd)
        Description copied from interface: TableViewSelectionListener
        Called when a range has been added to a table view's selection.
        Specified by:
        selectedRangeAdded in interface TableViewSelectionListener
        Parameters:
        tableView - The source of the event.
        rangeStart - The start index of the range that was added, inclusive.
        rangeEnd - The end index of the range that was added, inclusive.
      • selectedRangeRemoved

        public void selectedRangeRemoved​(TableView tableView,
                                         int rangeStart,
                                         int rangeEnd)
        Description copied from interface: TableViewSelectionListener
        Called when a range has been removed from a table view's selection.
        Specified by:
        selectedRangeRemoved in interface TableViewSelectionListener
        Parameters:
        tableView - The source of the event.
        rangeStart - The start index of the range that was removed, inclusive.
        rangeEnd - The end index of the range that was removed, inclusive.
      • selectedRangesChanged

        public void selectedRangesChanged​(TableView tableView,
                                          Sequence<Span> previousSelectedRanges)
        Description copied from interface: TableViewSelectionListener
        Called when a table view's selection state has been reset.
        Specified by:
        selectedRangesChanged in interface TableViewSelectionListener
        Parameters:
        tableView - The source of the event.
        previousSelectedRanges - If the selection changed directly, contains the ranges that were previously selected. If the selection changed indirectly as a result of a model change, contains the current selection. Otherwise, contains null.
      • selectedRowChanged

        public void selectedRowChanged​(TableView tableView,
                                       java.lang.Object previousSelectedRow)
        Description copied from interface: TableViewSelectionListener
        Called when a table view's selected item has changed.
        Specified by:
        selectedRowChanged in interface TableViewSelectionListener
        Parameters:
        tableView - The source of the event.
        previousSelectedRow - The row that was previously selected.