public static class UiBinding.BoundTableModel
- Object
- AbstractTableModel
- UiBinding.BoundTableModel
ImplementsTableModel
Implements table model binding, this is implemented as a class to allow additional features
such as adding/removing rows
Constructors
Methods
Inherited methods
Constructor details
BoundTableModel
public BoundTableModel(List<? extends PropertyBusinessObject> objects, PropertyBusinessObject prototype)Creates a table model with the business objects
Parameters
objectsList<? extends PropertyBusinessObject>- the objects of the model
prototypePropertyBusinessObject- the type by which we determine the structure of the table
BoundTableModel
public BoundTableModel(CollectionProperty objectProperty, PropertyBusinessObject prototype)Creates a table model with the business objects
Parameters
objectPropertyCollectionProperty- the objects of the model
prototypePropertyBusinessObject- the type by which we determine the structure of the table
Method details
excludeProperty
public void excludeProperty(PropertyBase b)The properties that are ignored
Parameters
bPropertyBase- the property to ignore
setColumnOrder
public void setColumnOrder(PropertyBase... columnOrder)Sets the order of the columns explicitly
Parameters
columnOrderPropertyBase...- the order of the columns based on the prototype
setEditable
public void setEditable(PropertyBase pb, boolean editable)Makes the property editable or uneditable
Parameters
pbPropertyBase- the property base
editableboolean- 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
public void addRow(int index, PropertyBusinessObject b)Adds a new business object to the table
Parameters
indexint- the index of the addition
bPropertyBusinessObject- the business object
removeRow
public void removeRow(int index)Removes the row at the given index
Parameters
indexint- 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
public String getColumnName(int i)Returns the name of the column at the given offset
Parameters
iint- the offset for the column name
Returns
name to display at the top of the table
isCellEditable
public boolean isCellEditable(int row, int column)Returns true if the cell at the given location is an editable cell
Parameters
rowint- the cell row
columnint- the cell column
Returns
true if the cell at the given location is an editable cell
getValueAt
public Object getValueAt(int row, int column)Returns the value of the cell at the given location
Parameters
rowint- the cell row
columnint- the cell column
Returns
the value of the cell at the given location
getCellType
public Class getCellType(int row, int column)Allows the table to hint the class type of a specific cell
Parameters
rowint- the row in the table
columnint- the column
Returns
the class representing this cell
getMultipleChoiceOptions
public String[] getMultipleChoiceOptions(int row, int column)Allows the table cell to feature multiple choice for a specific entry
Parameters
rowint- the row in the table
columnint- the column
Returns
the string values matching the entries or null if this isn’t a multiple
choice option
setMultipleChoiceOptions
public void setMultipleChoiceOptions(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. It will be rendered as a picker in the table
Parameters
propPropertyBase- the property
valuesString...- the supported values
getValidationConstraint
public Constraint getValidationConstraint(int row, int column)If the cell has a validation constraint it’s returned here
Parameters
rowint- the row
columnint- the column for the cell
Returns
null for no constraints
setValidationConstraint
public void setValidationConstraint(PropertyBase prop, Constraint c)Sets a validator constraint on the table
Parameters
propPropertyBase- the property matching the constraint
cConstraint- the constraint value
setValueAt
public void setValueAt(int row, int column, Object o)Sets the value of the cell at the given location
Parameters
rowint- the cell row
columnint- the cell column
oObject- the value of the cell at the given location
addDataChangeListener
public void addDataChangeListener(DataChangedListener d)Adds a listener to the data changed event
Parameters
dDataChangedListener- the new listener
removeDataChangeListener
public void removeDataChangeListener(DataChangedListener d)Removes a listener to the data changed event
Parameters
dDataChangedListener- the listener to remove