# Class UiBinding.BoundTableModel

java.lang.Object
com.codename1.ui.table.AbstractTableModel
com.codename1.properties.UiBinding.BoundTableModel

All Implemented Interfaces:
  `TableModel`

Enclosing class:
  `UiBinding`

public static class UiBinding.BoundTableModel extends AbstractTableModel
Implements table model binding, this is implemented as a class to allow additional features such as adding/removing rows

- ## Constructor Summary

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

- ## Method Summary

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

  ### Methods inherited from class AbstractTableModel

  `getValidator, setValidator`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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

    public BoundTableModel(CollectionProperty objectProperty, PropertyBusinessObject prototype)

    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

    public void excludeProperty(PropertyBase b)

    The properties that are ignored

    ###### Parameters

    - `b`: the property to ignore

  - ### setColumnOrder

    public void setColumnOrder(PropertyBase... columnOrder)

    Sets the order of the columns explicitly

    ###### Parameters

    - `columnOrder`: 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`: 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

    public void addRow(int index, PropertyBusinessObject b)

    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

    public String getColumnName(int i)
    Description copied from interface: `TableModel`

    Returns 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: `TableModel`

    Returns 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

    public Object getValueAt(int row, int column)
    Description copied from interface: `TableModel`

    Returns 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

    public Class getCellType(int row, int column)
    Description copied from class: `AbstractTableModel`

    Allows 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:
      `getCellType` in class `AbstractTableModel`

  - ### getMultipleChoiceOptions

    public String[] getMultipleChoiceOptions(int row, int column)

    Allows the table cell to feature multiple choice for a specific entry

    ###### Parameters

    - `row`: the row in the table

    - `column`: the column

    ###### Returns

    Overrides:
      `getMultipleChoiceOptions` in class `AbstractTableModel`
    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`: the property

    - `values`: the supported values

  - ### getValidationConstraint

    public Constraint getValidationConstraint(int row, int column)

    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:
      `getValidationConstraint` in class `AbstractTableModel`

  - ### setValidationConstraint

    public void setValidationConstraint(PropertyBase prop, Constraint c)

    Sets a validator constraint on the table

    ###### Parameters

    - `prop`: the property matching the constraint

    - `c`: the constraint value

  - ### setValueAt

    public void setValueAt(int row, int column, Object o)
    Description copied from interface: `TableModel`

    Sets 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

    public void addDataChangeListener(DataChangedListener d)
    Description copied from interface: `TableModel`

    Adds a listener to the data changed event

    ###### Parameters

    - `d`: the new listener

  - ### removeDataChangeListener

    public void removeDataChangeListener(DataChangedListener d)
    Description copied from interface: `TableModel`

    Removes a listener to the data changed event

    ###### Parameters

    - `d`: the listener to remove