Class DiscoverableTableUtils
- java.lang.Object
-
- docking.widgets.table.DiscoverableTableUtils
-
public class DiscoverableTableUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DiscoverableTableUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <ROW_TYPE,COLUMN_TYPE,DATA_SOURCE>
DynamicTableColumn<ROW_TYPE,COLUMN_TYPE,DATA_SOURCE>adaptColumForModel(GDynamicColumnTableModel<ROW_TYPE,COLUMN_TYPE> model, AbstractDynamicTableColumn<?,?,?> column)
Returns a column object that is usable by the given model.static <T,M>
java.util.Collection<ColumnConstraint<T>>getColumnConstraints(ColumnTypeMapper<T,M> mapper)
Returns a list of all theColumnConstraint
that are capable of filtering the destination type of the given mapper.static <T> java.util.Collection<ColumnConstraint<T>>
getColumnConstraints(java.lang.Class<T> columnType)
Returns a list of all theColumnConstraint
that are capable of filtering the given column type.static <ROW_TYPE> java.util.Collection<DynamicTableColumn<ROW_TYPE,?,?>>
getDynamicTableColumns(java.lang.Class<ROW_TYPE> rowTypeClass)
Returns all "discovered"AbstractDynamicTableColumn
classes that are compatible with the given class, which represents the object for a table's row.
-
-
-
Method Detail
-
adaptColumForModel
public static <ROW_TYPE,COLUMN_TYPE,DATA_SOURCE> DynamicTableColumn<ROW_TYPE,COLUMN_TYPE,DATA_SOURCE> adaptColumForModel(GDynamicColumnTableModel<ROW_TYPE,COLUMN_TYPE> model, AbstractDynamicTableColumn<?,?,?> column)
Returns a column object that is usable by the given model.Dynamic columns and models work on row types. This method allows clients to use columns with row types that differ from the model's row type, as long as a suitable mapper can be found. If no mapper can be found, then an IllegalArgumentException is thrown. Also, if the given column is of the correct type, then that column is returned.
- Type Parameters:
ROW_TYPE
- the model's row typeCOLUMN_TYPE
- the model's row type- Parameters:
model
- the table model for which a column is neededcolumn
- the column that you want to use with the given model- Returns:
- a column object that is usable by the given model.
- Throws:
java.lang.IllegalArgumentException
- if this method cannot figure out how to map the given column's row type to the given model's row type.
-
getDynamicTableColumns
public static <ROW_TYPE> java.util.Collection<DynamicTableColumn<ROW_TYPE,?,?>> getDynamicTableColumns(java.lang.Class<ROW_TYPE> rowTypeClass)
Returns all "discovered"AbstractDynamicTableColumn
classes that are compatible with the given class, which represents the object for a table's row. For example, many tables useAddress
as the row type. In this case, passingAddress.class
as the parameter to this method will return allAbstractDynamicTableColumn
s that can provide column data by working withAddress
instances.Usage Notes: This class will not only discover
AbstractDynamicTableColumn
s that directly support the given class type, but will also use discoveredTableRowMapper
objects to create adapters that allow the use of table row data that does not exactly match the supported type of discoveredAbstractDynamicTableColumn
classes. For example, suppose that a table's row type isAddress
. This methods will return at least allAbstractDynamicTableColumn
s that supportAddress
data. In order to support extra columns, Ghidra has created aTableRowMapper
that can convert aProgramLocation
into anAddress
. This method will find and use this mapper to return aMappedTableColumn
instance (which is anAbstractDynamicTableColumn
). By doing this, any table that hasAddress
objects as its row type can now useAbstractDynamicTableColumn
s that supportProgramLocations
in addition toAddress
objects. These mappers provide a way for tables that have non-standard Ghidra data as their row type to take advantage of existing dynamic columns for standard Ghidra data (like ProgramLocations and Addresses).- Parameters:
rowTypeClass
- table's row type- Returns:
- the discovered column
-
getColumnConstraints
public static <T,M> java.util.Collection<ColumnConstraint<T>> getColumnConstraints(ColumnTypeMapper<T,M> mapper)
Returns a list of all theColumnConstraint
that are capable of filtering the destination type of the given mapper. The mapper will be used to create a mapped constraint that will be called with an instance of the typeT
.- Parameters:
mapper
- the mapper that will be used to convert- Returns:
- a list of all the
ColumnConstraint
that are capable of filtering the given column type
-
getColumnConstraints
public static <T> java.util.Collection<ColumnConstraint<T>> getColumnConstraints(java.lang.Class<T> columnType)
Returns a list of all theColumnConstraint
that are capable of filtering the given column type.- Parameters:
columnType
- the class of the data that is return by the table model for specific column.- Returns:
- a list of all the
ColumnConstraint
that are capable of filtering the given column type.
-
-