Class UiBinding.BoundTableModel
- All Implemented Interfaces:
TableModel
- Enclosing class:
UiBinding
-
Constructor Summary
ConstructorsConstructorDescriptionBoundTableModel(CollectionProperty objectProperty, PropertyBusinessObject prototype) Creates a table model with the business objectsBoundTableModel(List<? extends PropertyBusinessObject> objects, PropertyBusinessObject prototype) Creates a table model with the business objects -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a listener to the data changed eventvoidaddRow(int index, PropertyBusinessObject b) Adds a new business object to the tablevoidThe properties that are ignoredgetCellType(int row, int column) Allows the table to hint the class type of a specific cellintReturns the number of columns in the tablegetColumnName(int i) Returns the name of the column at the given offsetString[]getMultipleChoiceOptions(int row, int column) Allows the table cell to feature multiple choice for a specific entryintReturns the number of rows in the tablegetValidationConstraint(int row, int column) If the cell has a validation constraint it's returned heregetValueAt(int row, int column) Returns the value of the cell at the given locationbooleanisCellEditable(int row, int column) Returns true if the cell at the given location is an editable cellvoidRemoves a listener to the data changed eventvoidremoveRow(int index) Removes the row at the given indexvoidsetColumnOrder(PropertyBase... columnOrder) Sets the order of the columns explicitlyvoidsetEditable(PropertyBase pb, boolean editable) Makes the property editable or uneditablevoidsetMultipleChoiceOptions(PropertyBase prop, String... values) Sets the multiple choice option for a string entry, this is useful if a string property can have one of several values.voidSets a validator constraint on the tablevoidsetValueAt(int row, int column, Object o) Sets the value of the cell at the given locationMethods inherited from class AbstractTableModel
getValidator, setValidator
-
Constructor Details
-
BoundTableModel
public BoundTableModel(List<? extends PropertyBusinessObject> objects, PropertyBusinessObject prototype) Creates a table model with the business objects
Parameters
-
objects: the objects of the model -
prototype: the type by which we determine the structure of the table
-
-
BoundTableModel
Creates a table model with the business objects
Parameters
-
objectProperty: the objects of the model -
prototype: the type by which we determine the structure of the table
-
-
-
Method Details
-
excludeProperty
The properties that are ignored
Parameters
b: the property to ignore
-
setColumnOrder
Sets the order of the columns explicitly
Parameters
columnOrder: the order of the columns based on the prototype
-
setEditable
Makes the property editable or uneditable
Parameters
-
pb: the property base -
editable: true for editable (the default)
-
-
getRowCount
public int getRowCount()Returns the number of rows in the table
Returns
the number of rows in the table
-
addRow
Adds a new business object to the table
Parameters
-
index: the index of the addition -
b: the business object
-
-
removeRow
public void removeRow(int index) Removes the row at the given index
Parameters
index: the position in the table
-
getColumnCount
public int getColumnCount()Returns the number of columns in the table
Returns
the number of columns in the table
-
getColumnName
Description copied from interface:TableModelReturns the name of the column at the given offset
Parameters
i: the offset for the column name
Returns
name to display at the top of the table
-
isCellEditable
public boolean isCellEditable(int row, int column) Description copied from interface:TableModelReturns true if the cell at the given location is an editable cell
Parameters
-
row: the cell row -
column: the cell column
Returns
true if the cell at the given location is an editable cell
-
-
getValueAt
Description copied from interface:TableModelReturns the value of the cell at the given location
Parameters
-
row: the cell row -
column: the cell column
Returns
the value of the cell at the given location
-
-
getCellType
Description copied from class:AbstractTableModelAllows the table to hint the class type of a specific cell
Parameters
-
row: the row in the table -
column: the column
Returns
the class representing this cell
- Overrides:
getCellTypein classAbstractTableModel
-
-
getMultipleChoiceOptions
Allows the table cell to feature multiple choice for a specific entry
Parameters
-
row: the row in the table -
column: the column
Returns
- Overrides:
getMultipleChoiceOptionsin classAbstractTableModel- Returns:
- the string values matching the entries or null if this isn't a multiple choice option
-
-
setMultipleChoiceOptions
Sets the multiple choice option for a string entry, this is useful if a string property can have one of several values. It will be rendered as a picker in the table
Parameters
-
prop: the property -
values: the supported values
-
-
getValidationConstraint
If the cell has a validation constraint it's returned here
Parameters
-
row: the row -
column: the column for the cell
Returns
null for no constraints
- Overrides:
getValidationConstraintin classAbstractTableModel
-
-
setValidationConstraint
Sets a validator constraint on the table
Parameters
-
prop: the property matching the constraint -
c: the constraint value
-
-
setValueAt
Description copied from interface:TableModelSets the value of the cell at the given location
Parameters
-
row: the cell row -
column: the cell column -
o: the value of the cell at the given location
-
-
addDataChangeListener
Description copied from interface:TableModelAdds a listener to the data changed event
Parameters
d: the new listener
-
removeDataChangeListener
Description copied from interface:TableModelRemoves a listener to the data changed event
Parameters
d: the listener to remove
-