Class GDynamicColumnTableModel<ROW_TYPE,DATA_SOURCE>
- java.lang.Object
- 
- javax.swing.table.AbstractTableModel
- 
- docking.widgets.table.AbstractGTableModel<T>
- 
- docking.widgets.table.AbstractSortedTableModel<ROW_TYPE>
- 
- docking.widgets.table.GDynamicColumnTableModel<ROW_TYPE,DATA_SOURCE>
 
 
 
 
- 
- Type Parameters:
- ROW_TYPE- the row object class for this table model.
- DATA_SOURCE- the type of data that will be returned from- getDataSource(). This object will be given to the- DynamicTableColumnobjects used by this table model when- DynamicTableColumn.getValue(Object, ghidra.docking.settings.Settings, Object, ServiceProvider)is called.
 - All Implemented Interfaces:
- ConfigurableColumnTableModel,- DynamicColumnTableModel<ROW_TYPE>,- RowObjectTableModel<ROW_TYPE>,- SelectionStorage<ROW_TYPE>,- SortedTableModel,- VariableColumnTableModel,- java.io.Serializable,- java.util.EventListener,- javax.swing.event.ChangeListener,- javax.swing.table.TableModel
 - Direct Known Subclasses:
- AnyObjectTableModel,- SetEquateTableModel,- ThreadedTableModel
 
 public abstract class GDynamicColumnTableModel<ROW_TYPE,DATA_SOURCE> extends AbstractSortedTableModel<ROW_TYPE> implements javax.swing.event.ChangeListener, VariableColumnTableModel, DynamicColumnTableModel<ROW_TYPE> An abstract table model for showing DynamicTableColumns where each row is based on an object of type ROW_TYPE. The client is responsible for implementingcreateTableColumnDescriptor(). This method specifies which default columns the table should have and whether they should be visible or hidden. Hidden columns can be made visible through the UI.This model will also discover other system columns that understand how to render ROW_TYPE data directly. Also, if you create a mapper(s) for your row type, then this model will load columns for each type for which a mapper was created, all as optional, hidden columns.The various attributes of the columns of this model (visibility, position, size, etc) are saved to disk as tool preferences when the user exits the tool. Implementation Note: this model loads all columns, specific and discovered, as being visible. Then, during initialization, the TableColumnModelStateclass will either hide all non-default columns, or reload the column state if any previous saved state is found.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.Map<DynamicTableColumn<ROW_TYPE,?,?>,Settings>columnSettingsprotected ServiceProviderserviceProviderprotected java.util.List<DynamicTableColumn<ROW_TYPE,?,?>>tableColumns- 
Fields inherited from class docking.widgets.table.AbstractSortedTableModelhasEverSorted
 - 
Fields inherited from class docking.widgets.table.AbstractGTableModelWIDTH_UNDEFINED
 - 
Fields inherited from interface docking.widgets.table.SortedTableModelASCENDING_ORDER, DESCENDING_ORDER
 
- 
 - 
Constructor SummaryConstructors Constructor Description GDynamicColumnTableModel(ServiceProvider serviceProvider)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddTableColumn(DynamicTableColumn<ROW_TYPE,?,?> column)Adds the given column at the end of the list of columns.protected voidaddTableColumn(DynamicTableColumn<ROW_TYPE,?,?> column, int index, boolean isDefault)Adds the given field at the given index to the list of fields in this class.protected voidaddTableColumns(java.util.Set<DynamicTableColumn<ROW_TYPE,?,?>> columns)Adds the given columns to the end of the list of columns.protected java.util.Comparator<ROW_TYPE>createSortComparator(int columnIndex)An extension point for subclasses to insert their own comparator objects for their data.protected java.util.Comparator<java.lang.Object>createSortComparatorForColumn(int columnIndex)This differs fromcreateSortComparator(int)in that the other method creates a comparator that operates on a full row value, whereas this method operates on column values.protected abstract TableColumnDescriptor<ROW_TYPE>createTableColumnDescriptor()DynamicTableColumn<ROW_TYPE,?,?>getColumn(int index)Returns the column for the given model indexjava.lang.Class<?>getColumnClass(int column)intgetColumnCount()java.lang.StringgetColumnDescription(int column)java.lang.StringgetColumnDisplayName(int columnIndex)intgetColumnIndex(DynamicTableColumn<ROW_TYPE,?,?> identifier)Returns the model index for the given columnintgetColumnIndex(java.lang.Class<?> columnClass)Returns the column index of the given column classjava.lang.StringgetColumnName(int column)SettingsgetColumnSettings(int index)Returns settings for the specified column index.SettingsDefinition[]getColumnSettingsDefinitions(int index)Returns settings definitions for the specified column index.java.lang.ObjectgetColumnValueForRow(ROW_TYPE t, int columnIndex)Implementors are expected to return a value at the given column index for the specified row object.abstract DATA_SOURCEgetDataSource()Returns the table's context for the data.intgetDefaultColumnCount()Gets the count of the default columns for this model.intgetMaxLines(int index)Gets the maximum number of text display lines needed for any given cell within the specified column.intgetPreferredColumnWidth(int column)javax.swing.table.TableCellRenderergetRenderer(int index)Gets the special table cell renderer for the specified table field column.java.lang.StringgetUniqueIdentifier(int column)Returns a value that is unique for a given table column.booleanisDefaultColumn(int modelIndex)Returns true if the column indicated by the index in the model is a default column (meaning that it was specified by the model and not discovered).booleanisSortable(int columnIndex)Returns true if the specified columnIndex is sortable.booleanisVisibleByDefault(int modelIndex)Returns true if the column denoted by the given model index is specified by the table model as being visible when the table is loaded for the first time.protected voidloadDiscoveredTableColumns()protected voidremoveTableColumn(DynamicTableColumn<ROW_TYPE,?,?> column)Removes the given column from this modelprotected voidremoveTableColumns(java.util.Set<DynamicTableColumn<ROW_TYPE,?,?>> columns)Removes the given columns from this model.voidsetAllColumnSettings(Settings[] newSettings)Allows for the bulk setting of Settings.voidsetColumnSettings(int index, Settings newSettings)A convenience method to set bulk column setting information for a group of columns at one time (this saves repeated rebuilding when settings are changing for multiple columns at once).voidstateChanged(javax.swing.event.ChangeEvent e)Callback when column settings have changed- 
Methods inherited from class docking.widgets.table.AbstractSortedTableModeladdSortListener, createSortingContext, fireTableChanged, getIndexForRowObject, getIndexForRowObject, getPendingSortState, getPrimarySortColumnIndex, getRowIndex, getRowObject, getTableSortState, getValueAt, initializeSorting, isSorted, isSortPending, notifyModelSorted, reSort, setDefaultTableSortState, setTableSortState, sort, sortCompleted
 - 
Methods inherited from class docking.widgets.table.AbstractGTableModeldispose, getLastSelectedObjects, getRowCount, refresh, setLastSelectedObjects
 - 
Methods inherited from class javax.swing.table.AbstractTableModeladdTableModelListener, findColumn, fireTableCellUpdated, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface docking.widgets.table.RowObjectTableModelfireTableDataChanged, getModelData, getName, getRowIndex, getRowObject
 
- 
 
- 
- 
- 
Field Detail- 
serviceProviderprotected ServiceProvider serviceProvider 
 - 
tableColumnsprotected java.util.List<DynamicTableColumn<ROW_TYPE,?,?>> tableColumns 
 - 
columnSettingsprotected java.util.Map<DynamicTableColumn<ROW_TYPE,?,?>,Settings> columnSettings 
 
- 
 - 
Constructor Detail- 
GDynamicColumnTableModelpublic GDynamicColumnTableModel(ServiceProvider serviceProvider) 
 
- 
 - 
Method Detail- 
createTableColumnDescriptorprotected abstract TableColumnDescriptor<ROW_TYPE> createTableColumnDescriptor() 
 - 
isSortablepublic boolean isSortable(int columnIndex) Description copied from interface:SortedTableModelReturns true if the specified columnIndex is sortable.- Specified by:
- isSortablein interface- SortedTableModel
- Parameters:
- columnIndex- the column index
- Returns:
- true if the specified columnIndex is sortable
 
 - 
loadDiscoveredTableColumnsprotected void loadDiscoveredTableColumns() 
 - 
createSortComparatorprotected java.util.Comparator<ROW_TYPE> createSortComparator(int columnIndex) Description copied from class:AbstractSortedTableModelAn extension point for subclasses to insert their own comparator objects for their data. Subclasses can create comparators for a single or multiple columns, as desired.- Overrides:
- createSortComparatorin class- AbstractSortedTableModel<ROW_TYPE>
- Parameters:
- columnIndex- the column index
- Returns:
- the comparator
 
 - 
createSortComparatorForColumnprotected java.util.Comparator<java.lang.Object> createSortComparatorForColumn(int columnIndex) This differs fromcreateSortComparator(int)in that the other method creates a comparator that operates on a full row value, whereas this method operates on column values.- Parameters:
- columnIndex- the column index
- Returns:
- a comparator for the specific column values
 
 - 
stateChangedpublic void stateChanged(javax.swing.event.ChangeEvent e) Callback when column settings have changed- Specified by:
- stateChangedin interface- javax.swing.event.ChangeListener
 
 - 
addTableColumnprotected void addTableColumn(DynamicTableColumn<ROW_TYPE,?,?> column) Adds the given column at the end of the list of columns. This method is intended for implementations to add custom column objects, rather than relying on generic, discovered DynamicTableColumn implementations.Note: this method assumes that the columns have already been sorted - Parameters:
- column- The field to add
 
 - 
addTableColumnsprotected void addTableColumns(java.util.Set<DynamicTableColumn<ROW_TYPE,?,?>> columns) Adds the given columns to the end of the list of columns. This method is intended for implementations to add custom column objects, rather than relying on generic, discovered DynamicTableColumn implementations.Note: this method assumes that the columns have already been sorted. - Parameters:
- columns- The columns to add
 
 - 
addTableColumnprotected void addTableColumn(DynamicTableColumn<ROW_TYPE,?,?> column, int index, boolean isDefault) Adds the given field at the given index to the list of fields in this class. This method is intended for implementations to add custom column objects, rather than relying on generic, discovered DynamicTableColumn implementations.Note: this method assumes that the columns have already been sorted. - Parameters:
- column- The field to add.
- index- The index at which to add the field. If the index value is invalid (negative or greater than the number of columns), then the column will be added to the end of the columns list.
- isDefault- true if this is a default column
 
 - 
removeTableColumnprotected void removeTableColumn(DynamicTableColumn<ROW_TYPE,?,?> column) Removes the given column from this model- Parameters:
- column- the column to remove
 
 - 
removeTableColumnsprotected void removeTableColumns(java.util.Set<DynamicTableColumn<ROW_TYPE,?,?>> columns) Removes the given columns from this model. This method allows the client to remove multiple columns at once, firing only one event when the work is finished.- Parameters:
- columns- the columns to remove
 
 - 
getDefaultColumnCountpublic int getDefaultColumnCount() Description copied from interface:VariableColumnTableModelGets the count of the default columns for this model. This model may have non-default columns added. This method will return the count of columns that have been setup specifically by the table model. This method can be used to iterate of the first n columns of this model in order to get information for the default columns by calling methods likeTableModel.getColumnName(int).- Specified by:
- getDefaultColumnCountin interface- VariableColumnTableModel
- Returns:
- Gets the count of the default columns for this model.
 
 - 
isVisibleByDefaultpublic boolean isVisibleByDefault(int modelIndex) Description copied from interface:VariableColumnTableModelReturns true if the column denoted by the given model index is specified by the table model as being visible when the table is loaded for the first time.- Specified by:
- isVisibleByDefaultin interface- VariableColumnTableModel
- Parameters:
- modelIndex- The index in the column in the column model.
- Returns:
- true if the column denoted by the given model index is visible default.
 
 - 
isDefaultColumnpublic boolean isDefaultColumn(int modelIndex) Returns true if the column indicated by the index in the model is a default column (meaning that it was specified by the model and not discovered).- Specified by:
- isDefaultColumnin interface- VariableColumnTableModel
- Parameters:
- modelIndex- the index of the column in the model.
- Returns:
- true if the column is a default.
 
 - 
getColumnCountpublic final int getColumnCount() - Specified by:
- getColumnCountin interface- javax.swing.table.TableModel
 
 - 
getColumnClasspublic final java.lang.Class<?> getColumnClass(int column) - Specified by:
- getColumnClassin interface- javax.swing.table.TableModel
- Overrides:
- getColumnClassin class- javax.swing.table.AbstractTableModel
 
 - 
getColumnNamepublic final java.lang.String getColumnName(int column) - Specified by:
- getColumnNamein interface- javax.swing.table.TableModel
- Overrides:
- getColumnNamein class- javax.swing.table.AbstractTableModel
 
 - 
getPreferredColumnWidthpublic int getPreferredColumnWidth(int column) - Overrides:
- getPreferredColumnWidthin class- AbstractGTableModel<ROW_TYPE>
 
 - 
getColumnDisplayNamepublic java.lang.String getColumnDisplayName(int columnIndex) - Specified by:
- getColumnDisplayNamein interface- VariableColumnTableModel
 
 - 
getColumnDescriptionpublic java.lang.String getColumnDescription(int column) - Specified by:
- getColumnDescriptionin interface- VariableColumnTableModel
 
 - 
getUniqueIdentifierpublic java.lang.String getUniqueIdentifier(int column) Description copied from interface:VariableColumnTableModelReturns a value that is unique for a given table column. This is different than getting the display name, which may be shared by different columns.- Specified by:
- getUniqueIdentifierin interface- VariableColumnTableModel
- Parameters:
- column- the index (in the model space) of the column for which to get the identifier
 
 - 
getColumnValueForRowpublic final java.lang.Object getColumnValueForRow(ROW_TYPE t, int columnIndex) Description copied from interface:RowObjectTableModelImplementors are expected to return a value at the given column index for the specified row object. This is essentially a more specific version of theTableModel.getValueAt(int, int)that allows this class's comparator objects to work.- Specified by:
- getColumnValueForRowin interface- RowObjectTableModel<ROW_TYPE>
- Parameters:
- t- The object that represents a given row.
- columnIndex- The column index for which a value is requested.
- Returns:
- a value at the given column index for the specified row object.
 
 - 
getDataSourcepublic abstract DATA_SOURCE getDataSource() Returns the table's context for the data.- Returns:
- the table's context for the data.
 
 - 
getColumnIndexpublic int getColumnIndex(java.lang.Class<?> columnClass) Returns the column index of the given column class- Parameters:
- columnClass- the class for the type of DynamicTableColumn you want to find.
- Returns:
- the column index for the specified DynamicTableColumn. -1 if not found.
 
 - 
getColumnIndexpublic int getColumnIndex(DynamicTableColumn<ROW_TYPE,?,?> identifier) Description copied from interface:DynamicColumnTableModelReturns the model index for the given column- Specified by:
- getColumnIndexin interface- DynamicColumnTableModel<ROW_TYPE>
- Parameters:
- identifier- the column
- Returns:
- the model index
 
 - 
getColumnpublic DynamicTableColumn<ROW_TYPE,?,?> getColumn(int index) Description copied from interface:DynamicColumnTableModelReturns the column for the given model index- Specified by:
- getColumnin interface- DynamicColumnTableModel<ROW_TYPE>
- Parameters:
- index- the model index of the column (this can differ from the view index)
- Returns:
- the column
 
 - 
getColumnSettingsDefinitionspublic SettingsDefinition[] getColumnSettingsDefinitions(int index) Description copied from interface:ConfigurableColumnTableModelReturns settings definitions for the specified column index.- Specified by:
- getColumnSettingsDefinitionsin interface- ConfigurableColumnTableModel
- Parameters:
- index- column index
- Returns:
- column settings definitions.
 
 - 
getColumnSettingspublic Settings getColumnSettings(int index) Description copied from interface:ConfigurableColumnTableModelReturns settings for the specified column index.- Specified by:
- getColumnSettingsin interface- ConfigurableColumnTableModel
- Parameters:
- index- column index
- Returns:
- column settings.
 
 - 
setColumnSettingspublic void setColumnSettings(int index, Settings newSettings)Description copied from interface:ConfigurableColumnTableModelA convenience method to set bulk column setting information for a group of columns at one time (this saves repeated rebuilding when settings are changing for multiple columns at once).- Specified by:
- setColumnSettingsin interface- ConfigurableColumnTableModel
- Parameters:
- index- the column index
- newSettings- A list of pair objects that contain the column index of the column to which the new settings apply and the new settings object.
 
 - 
setAllColumnSettingspublic void setAllColumnSettings(Settings[] newSettings) Description copied from interface:ConfigurableColumnTableModelAllows for the bulk setting of Settings. This prevents excessive event notification when all settings need to be changed.- Specified by:
- setAllColumnSettingsin interface- ConfigurableColumnTableModel
- Parameters:
- newSettings- An array of Settings that contains Settings for each column where the index of the Settings in the array is the index of the column in the model.
- See Also:
- ConfigurableColumnTableModel.setColumnSettings(int, Settings)
 
 - 
getRendererpublic javax.swing.table.TableCellRenderer getRenderer(int index) Gets the special table cell renderer for the specified table field column. A null value indicates that this field uses a default cell renderer.- Specified by:
- getRendererin interface- ConfigurableColumnTableModel
- Parameters:
- index- the model column index
- Returns:
- a table cell renderer for this field. Otherwise, null if a default renderer should be used.
 
 - 
getMaxLinespublic int getMaxLines(int index) Gets the maximum number of text display lines needed for any given cell within the specified column.- Specified by:
- getMaxLinesin interface- ConfigurableColumnTableModel
- Parameters:
- index- column field index
- Returns:
- maximum number of lines needed for specified column
 
 
- 
 
-