Package org.ka2ddo.yaac.pluginapi
Class ExtraColumn
java.lang.Object
org.ka2ddo.yaac.pluginapi.ExtraColumn
This class defines (in a non-GUI-dependent way) an extra column of data for inclusion in the
station/object list table view. This is specific to a particular GuiContentType as returned
by
ExtraColumnProvider
so it can expect a particular class of rowData to be provided
to the getValueAt(int, SupportsExtraData)
method.- Author:
- Andrew Pavlin, KA2DDO
-
Constructor Summary
ModifierConstructorDescriptionprotected
ExtraColumn
(GuiContentType guiContentType, int extraColumnIndex, ExtraColumnProvider extraColumnProvider) Create an ExtraColumn. -
Method Summary
Modifier and TypeMethodDescriptionint
compareRows
(int rowIndex1, SupportsExtraData rowData1, int rowIndex2, SupportsExtraData rowData2) Compare this column of the two rows.Class<?>
Returns the most specific superclass for all the cell values in the column.abstract String
Returns the localized name of this column.Get the text (if any) to be displayed on a popup for the data record being displayed in the popup.int
Get the provider-relative index of this extra column.Get the ExtraColumnProvider that defines this column.Get the GUI content type this column is associated with.abstract Object
getValueAt
(int rowIndex, SupportsExtraData rowData) Returns the value for the cell at this column androwIndex
.boolean
isCellEditable
(int rowIndex, SupportsExtraData rowData) Returns true if the cell atrowIndex
and this column is editable.void
setExtraColumnIndex
(int columnIndex) Modify the column index for the ExtraColumn.void
setValueAt
(Object aValue, int rowIndex, SupportsExtraData rowData) Sets the value in the cell at this column androwIndex
toaValue
.boolean
usesUnitEnum
(Class<Enum<? extends UnitEnum>> clazz) Report if this column uses the specified enum class to scale its values.
-
Constructor Details
-
ExtraColumn
protected ExtraColumn(GuiContentType guiContentType, int extraColumnIndex, ExtraColumnProvider extraColumnProvider) Create an ExtraColumn.- Parameters:
guiContentType
- the GuiContentType this ExtraColumn is associated withextraColumnIndex
- zero-based relative column index from the providerextraColumnProvider
- ExtraColumnProvider providing this column
-
-
Method Details
-
getGuiContentType
Get the GUI content type this column is associated with.- Returns:
- GuiContentType
-
getExtraColumnIndex
public int getExtraColumnIndex()Get the provider-relative index of this extra column.- Returns:
- zero-based index of this column from the provider
-
setExtraColumnIndex
public void setExtraColumnIndex(int columnIndex) Modify the column index for the ExtraColumn. Note this should only be done if the columns are beuing reordered or the column numberwas not known at construction time.- Parameters:
columnIndex
- zero-based ordinal of this column from itsExtraColumnProvider
-
getExtraColumnProvider
Get the ExtraColumnProvider that defines this column.- Returns:
- ExtraColumnProvider
-
getColumnClass
Returns the most specific superclass for all the cell values in the column. This is used by the table to set up a default renderer and editor for the column. Expected to be overridden by subclasses.- Returns:
- the common ancestor class of the object values in the model of this column.
-
getColumnName
Returns the localized name of this column. This is used to initialize the table's column header name. Note: this name does not need to be unique; two columns in a table can have the same name.- Returns:
- the name of the column
-
getValueAt
Returns the value for the cell at this column androwIndex
.- Parameters:
rowIndex
- the row whose value is to be queriedrowData
- Object from the original table containing data represented by the entire row; the Object type is specific to the GuiContentType of the table- Returns:
- the value Object at the specified cell
-
isCellEditable
Returns true if the cell atrowIndex
and this column is editable. Otherwise,setValueAt
on the cell will not change the value of that cell. Expected to be overridden by editable subclasses.- Parameters:
rowIndex
- the row whose value to be queriedrowData
- Object from the original table containing data represented by the entire row; the Object type is specific to the GuiContentType of the table- Returns:
- true if the cell is editable
- See Also:
-
setValueAt
Sets the value in the cell at this column androwIndex
toaValue
. Expected to be overridden by editable subclasses.- Parameters:
aValue
- the new valuerowIndex
- the row whose value is to be changedrowData
- Object from the original table containing data represented by the entire row; the Object type is specific to the GuiContentType of the table- See Also:
-
compareRows
public int compareRows(int rowIndex1, SupportsExtraData rowData1, int rowIndex2, SupportsExtraData rowData2) Compare this column of the two rows. Should be overridden in case the specified table model implementsFastComparableTableModel
.- Parameters:
rowIndex1
- zero-based model row index of first row to comparerowData1
- Object from the original table containing data represented by the entire first row; the Object type is specific to the GuiContentType of the tablerowIndex2
- zero-based model row index of second row to comparerowData2
- Object from the original table containing data represented by the entire second row; the Object type is specific to the GuiContentType of the table- Returns:
- +1 if the 1st row's column is after the 2nd row's column, -1 if before, or 0 if equal precedence
-
usesUnitEnum
Report if this column uses the specified enum class to scale its values. Expected to be overridden by subclasses.- Parameters:
clazz
- Class of a UnitEnum- Returns:
- boolean true if the value of this enum is used by this column
-
getContentForPopupWindow
Get the text (if any) to be displayed on a popup for the data record being displayed in the popup. This is the same info that should be returned by the getColumnName() and the rendering of getValueAt() for the specified data object- Parameters:
rowData
- Object to provide the data to render (same as would be passed togetValueAt(int, SupportsExtraData)
- Returns:
- array of ExtraContentElements to display on the popup, or null if nothing to display for this column of this data record
-