public static class UiBinding.BoundTableModel

  1. Object
  2. AbstractTableModel
  3. UiBinding.BoundTableModel

ImplementsTableModel

Implements table model binding, this is implemented as a class to allow additional features such as adding/removing rows

Constructors

public BoundTableModel(List<? extends PropertyBusinessObject> objects, PropertyBusinessObject prototype)Creates a table model with the business objects
public BoundTableModel(CollectionProperty objectProperty, PropertyBusinessObject prototype)Creates a table model with the business objects

Methods

public void excludeProperty(PropertyBase b)The properties that are ignored
public void setColumnOrder(PropertyBase... columnOrder)Sets the order of the columns explicitly
public void setEditable(PropertyBase pb, boolean editable)Makes the property editable or uneditable
public int getRowCount()Returns the number of rows in the table
public void addRow(int index, PropertyBusinessObject b)Adds a new business object to the table
public void removeRow(int index)Removes the row at the given index
public int getColumnCount()Returns the number of columns in the table
public String getColumnName(int i)Returns the name of the column at the given offset
public boolean isCellEditable(int row, int column)Returns true if the cell at the given location is an editable cell
public Object getValueAt(int row, int column)Returns the value of the cell at the given location
public Class getCellType(int row, int column)Allows the table to hint the class type of a specific cell
public String[] getMultipleChoiceOptions(int row, int column)Allows the table cell to feature multiple choice for a specific entry
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.
public Constraint getValidationConstraint(int row, int column)If the cell has a validation constraint it’s returned here
public void setValidationConstraint(PropertyBase prop, Constraint c)Sets a validator constraint on the table
public void setValueAt(int row, int column, Object o)Sets the value of the cell at the given location
public void addDataChangeListener(DataChangedListener d)Adds a listener to the data changed event
public void removeDataChangeListener(DataChangedListener d)Removes a listener to the data changed event

Inherited methods

Constructor details

BoundTableModel

public BoundTableModel(List<? extends PropertyBusinessObject> objects, PropertyBusinessObject prototype)
Creates a table model with the business objects

Parameters

objects List<? extends PropertyBusinessObject>
the objects of the model
prototype PropertyBusinessObject
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

objectProperty CollectionProperty
the objects of the model
prototype PropertyBusinessObject
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

b PropertyBase
the property to ignore

setColumnOrder

public void setColumnOrder(PropertyBase... columnOrder)
Sets the order of the columns explicitly

Parameters

columnOrder PropertyBase...
the order of the columns based on the prototype

setEditable

public void setEditable(PropertyBase pb, boolean editable)
Makes the property editable or uneditable

Parameters

pb PropertyBase
the property base
editable boolean
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

index int
the index of the addition
b PropertyBusinessObject
the business object

removeRow

public void removeRow(int index)
Removes the row at the given index

Parameters

index int
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

i int
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

row int
the cell row
column int
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

row int
the cell row
column int
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

row int
the row in the table
column int
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

row int
the row in the table
column int
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

prop PropertyBase
the property
values String...
the supported values

getValidationConstraint

public Constraint getValidationConstraint(int row, int column)
If the cell has a validation constraint it’s returned here

Parameters

row int
the row
column int
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

prop PropertyBase
the property matching the constraint
c Constraint
the constraint value

setValueAt

public void setValueAt(int row, int column, Object o)
Sets the value of the cell at the given location

Parameters

row int
the cell row
column int
the cell column
o Object
the value of the cell at the given location

addDataChangeListener

public void addDataChangeListener(DataChangedListener d)
Adds a listener to the data changed event

Parameters

d DataChangedListener
the new listener

removeDataChangeListener

public void removeDataChangeListener(DataChangedListener d)
Removes a listener to the data changed event

Parameters

d DataChangedListener
the listener to remove