Interface GColumnRenderer<T>

  • Type Parameters:
    T - the column type
    All Superinterfaces:
    javax.swing.table.TableCellRenderer
    All Known Subinterfaces:
    AbstractWrapperTypeColumnRenderer<T>
    All Known Implementing Classes:
    AbstractGColumnRenderer, AbstractGhidraColumnRenderer, CodeUnitTableCellRenderer, DefaultTimestampRenderer, PreviewDataTableCellRenderer

    public interface GColumnRenderer<T>
    extends javax.swing.table.TableCellRenderer
    An interface for the DynamicTableColumn. This allows the filtering system to stay in sync with the rendering system by using the display text to filter.

    Table filtering in GTables typically works with the following setup:

    1. The table has a text field that allows for quick filtering across all visible columns. The specifics of how the text filter works are defined by the RowFilterTransformer, which is controlled by the user via the button at the right of the filter field. (In the absence of this button, filters are typically a 'contains' filter.)

      The default transformer turns items to strings by, in order,:

      1. checking the the column renderer's getFilterString(Object, Settings),if a column renderer is installed
      2. checking to see if the column value is an instance of DisplayStringProvider
      3. checking to see if the column value is a JLabel
      4. calling toString() on the object
    2. The table has the ability to perform advanced filtering based upon specific columns. Each column's type is used to find dynamically discovered ColumnConstraints. These constraints dictate how a given column can be filtered. The user will create filters using these constraints in the ColumnFilterDialog by pressing the button at the far right of the filter text field.

      The way the constraints are used in the filtering system, in conjunction with this renderer, is defined by the GColumnRenderer.ColumnConstraintFilterMode via getColumnConstraintFilterMode().

    3. Any custom filters, defined by individual clients (this is outside the scope of the default filtering system)

    Note: The default filtering behavior of this class is to only filter on the aforementioned filter text field. That is, column constraints will not be enabled by default. To change this, change the value returned by getColumnConstraintFilterMode().

    • Method Detail

      • getColumnConstraintFilterMode

        default GColumnRenderer.ColumnConstraintFilterMode getColumnConstraintFilterMode()
        Returns the current mode of how column constraints will be used to filter this column

        This method is typically not overridden. This is only needed in rare cases, such as when a column uses a renderer, but does *not* want this column to be filtered using a String column constraint. Or, if a column uses a renderer and wants that text to be available as a filter, along with any other column constraints.

        Returns:
        the mode
      • getFilterString

        java.lang.String getFilterString​(T t,
                                         Settings settings)
        Returns a string that is suitable for use when filtering. The returned String should be an unformatted (e.g., no HTML markup, icons, etc) version of what is on the screen. If the String returned here does not match what the user sees (that which is rendered), then the filtering action may confuse the user.
        Parameters:
        t - the column type instance
        settings - any settings the converter may need to convert the type
        Returns:
        the unformatted String version of what is rendered in the table cell on screen
      • createWrapperTypeException

        default AssertException createWrapperTypeException()
        A convenience method for primitive-based/wrapper-based renderers to signal that they should not be using text to filter.

        The basic wrapper types, like Number, and some others, like Date, have special built-in filtering capabilities. Columns whose column type is one of the wrapper classes will not have their getFilterString(Object, Settings) methods called. They can stub out those methods by throwing the exception returned by this method.

        Returns:
        the new exception
        See Also:
        AbstractWrapperTypeColumnRenderer