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 theDynamicTableColumn
. This allows the filtering system to stay in sync with the rendering system by using the display text to filter.Table filtering in
GTable
s typically works with the following setup:- 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,:
- checking the the column renderer's
getFilterString(Object, Settings)
,if a column renderer is installed - checking to see if the column value is an instance of
DisplayStringProvider
- checking to see if the column value is a
JLabel
- calling
toString()
on the object
- checking the the column renderer's
-
The table has the ability to perform advanced filtering based upon specific columns. Each
column's type is used to find dynamically discovered
ColumnConstraint
s. These constraints dictate how a given column can be filtered. The user will create filters using these constraints in theColumnFilterDialog
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
viagetColumnConstraintFilterMode()
. - 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()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
GColumnRenderer.ColumnConstraintFilterMode
An enum that signals how the advanced column filtering should work.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default AssertException
createWrapperTypeException()
A convenience method for primitive-based/wrapper-based renderers to signal that they should not be using text to filter.default GColumnRenderer.ColumnConstraintFilterMode
getColumnConstraintFilterMode()
Returns the current mode of how column constraints will be used to filter this columnjava.lang.String
getFilterString(T t, Settings settings)
Returns a string that is suitable for use when filtering.
-
-
-
Method Detail
-
getColumnConstraintFilterMode
default GColumnRenderer.ColumnConstraintFilterMode getColumnConstraintFilterMode()
Returns the current mode of how column constraints will be used to filter this columnThis 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 instancesettings
- 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 theirgetFilterString(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
-
-