Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.iface.ui.table
Class AbstractIXTableModel

    java.lang.Object
      javax.swing.table.AbstractTableModel
          ix.iface.ui.table.AbstractIXTableModel

All Implemented Interfaces:
  java.io.Serializable, javax.swing.table.TableModel

Direct Known Subclasses:
  AbstractTreeTableModel, DeclarationEditor.VarTypeTableModel, GrammarEditorPanel.GenericConstraintTableModel, PropertyTableModel

    public abstract class AbstractIXTableModel

extends javax.swing.table.AbstractTableModel

An abstract class for table models. Keeps track of the base objects that are shown in the table. Implements most functions required by JTable and IXTable objects to work. Implement the following functions (see documentation below):

- protected Object getCellValueAt(Object baseObject, int columnIndex)

See Also:
  Serialized Form

Nested Class Summary
`static interface` | `AbstractIXTableModel.TableMarkListener`

Field Summary
`protected java.util.ArrayList` | `columnClasses`
`protected java.util.ArrayList` | `columnFields`
`protected java.util.ArrayList` | `columnNames`
`protected java.util.HashSet` | `markedRows` contains data objects. cannot do rows because it gets confused with expand/collapse in tree tables!
`protected java.lang.Class` | `objectClass`
`protected java.util.List` | `rows` a list of objects that appear in the table
`protected boolean` | `rowsMarkable`

Fields inherited from class javax.swing.table.AbstractTableModel
`listenerList`

Constructor Summary
`AbstractIXTableModel(boolean markable)` Makes an empty model.
`AbstractIXTableModel(boolean markable, java.lang.Class theClass, java.lang.Object[] theRows)` Makes a model that contains the given nodes and derives which fields to use.
`AbstractIXTableModel(boolean markable, java.lang.Object[] theRows)` Makes a model that contains the given nodes.
`AbstractIXTableModel(boolean markable, java.lang.Object[] theRows, java.lang.String[] columns)` Makes a model as above but with the given strings as column names.

Method Summary
`void` | `addData(int row, java.lang.Object data)` Adds the given data object to the table's rows at the given position if it is not already there and notifies listeners.
`void` | `addData(java.lang.Object data)` Adds the given data object to the table's rows if it is not already there and notifies listeners.
`void` | `addMarkListener(AbstractIXTableModel.TableMarkListener tml)`
`void` | `clearData()` Removes all data objects from the table's rows and notifies listeners.
`void` | `clearMarks()`
`protected java.lang.Object` | `defaultGetCellValueAt(java.lang.Object o, int columnIndex)` Looks up the value in the columnField of the given index.
`protected void` | `defaultSetColumnFields(java.lang.String[] fieldNames)` Sets the fields to be used as table columns
`protected void` | `deriveColumnFields()` Collects usable fields from the objectClass
`void` | `fireTableMarkAdded(java.lang.Object rowObject)`
`void` | `fireTableMarkCleared()`
`void` | `fireTableMarkedAll()`
`void` | `fireTableMarkRemoved(java.lang.Object rowObject)`
`abstract java.lang.Object` | `getCellValueAt(java.lang.Object baseObject, int columnIndex)` Gets the object's value for the given column index.
`java.lang.Class` | `getColumnClass(int index)` JTable required TableModel function (default is Object).
`int` | `getColumnCount()` JTable required TableModel function.
`java.lang.String` | `getColumnName(int index)` JTable required TableModel function.
`protected java.lang.String[]` | `getColumnNames()` Gets the strings to use as column names.
`java.util.List` | `getData()`
`java.util.Collection` | `getMarkedObjects()`
`java.util.Collection` | `getMarkedRows()`
`int` | `getObjectRow(java.lang.Object object)` Gets the row index of the given object
`int` | `getRowCount()` JTable required TableModel function.
`java.lang.Object` | `getRowObject(int rowIndex)` Gets the object that is in the given row.
`java.lang.Object` | `getValueAt(int rowIndex, int columnIndex)` Gets the value for a cell in the table defined by the given indices.
`boolean` | `isCellEditable(int row, int col)`
`boolean` | `isMarkable()`
`boolean` | `isMarked(int row)`
`boolean` | `isMarkedEmpty()`
`void` | `markAll()`
`void` | `markRow(int row)`
`void` | `removeData(java.lang.Object data)` Removes the given data object from the table's rows and notifies listeners if it worked.
`void` | `removeMarkListener(AbstractIXTableModel.TableMarkListener tml)`
`void` | `replaceData(java.lang.Object oldData, java.lang.Object newData)` Replaces the given old data object with the new given one and notifies listeners if it worked.
`void` | `setColumnClasses(java.lang.Class[] fieldClasses)` Sets the column classes of the table
`void` | `setColumnFields(java.lang.Class objectClass, java.lang.String[] fieldNames)` Sets the fields to be used as columns in the table
`void` | `setColumnNames(java.lang.String[] fieldNames)` Sets the column titles to be used in the table
`void` | `setData(java.lang.Object[] data)` Sets the table's rows to the given data objects and notifies listeners.
`void` | `setValueAt(java.lang.Object value, int row, int col)`
`void` | `unmarkRow(int row)`

Methods inherited from class javax.swing.table.AbstractTableModel
`addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### columnFields

    protected java.util.ArrayList columnFields

### columnNames

    protected java.util.ArrayList columnNames

### columnClasses

    protected java.util.ArrayList columnClasses

### objectClass

    protected java.lang.Class objectClass

### rowsMarkable

    protected boolean rowsMarkable

### markedRows

    protected java.util.HashSet markedRows

  contains data objects. cannot do rows because it gets confused with expand/collapse in tree tables!

### rows

    protected java.util.List rows

  a list of objects that appear in the table

Constructor Detail

### AbstractIXTableModel

    public AbstractIXTableModel(boolean markable)

  Makes an empty model.

### AbstractIXTableModel

    public AbstractIXTableModel(boolean markable,
                                java.lang.Object[] theRows)

  Makes a model that contains the given nodes.

### AbstractIXTableModel

    public AbstractIXTableModel(boolean markable,
                                java.lang.Object[] theRows,
                                java.lang.String[] columns)

  Makes a model as above but with the given strings as column names.

### AbstractIXTableModel

    public AbstractIXTableModel(boolean markable,
                                java.lang.Class theClass,
                                java.lang.Object[] theRows)

  Makes a model that contains the given nodes and derives which fields to use.

Method Detail

### setData

    public void setData(java.lang.Object[] data)

  Sets the table's rows to the given data objects and notifies listeners. Clears markings on previous rows.

### getData

    public java.util.List getData()

### addData

    public void addData(java.lang.Object data)

  Adds the given data object to the table's rows if it is not already there and notifies listeners.

### addData

    public void addData(int row,
                        java.lang.Object data)

  Adds the given data object to the table's rows at the given position if it is not already there and notifies listeners.

### removeData

    public void removeData(java.lang.Object data)

  Removes the given data object from the table's rows and notifies listeners if it worked.

### replaceData

    public void replaceData(java.lang.Object oldData,
                            java.lang.Object newData)

  Replaces the given old data object with the new given one and notifies listeners if it worked.

### clearData

    public void clearData()

  Removes all data objects from the table's rows and notifies listeners.

### getRowObject

    public java.lang.Object getRowObject(int rowIndex)

  Gets the object that is in the given row.

  Returns:
    the object or null if there is no such row.

### getObjectRow

    public int getObjectRow(java.lang.Object object)

  Gets the row index of the given object

  Returns:
    the object's index or -1 if there is no such object.

### getValueAt

    public java.lang.Object getValueAt(int rowIndex,
                                       int columnIndex)

  Gets the value for a cell in the table defined by the given indices. Looks up the object and calls the abstract object-index method.

### getRowCount

    public int getRowCount()

  JTable required TableModel function.

### getColumnCount

    public int getColumnCount()

  JTable required TableModel function.

### getColumnName

    public java.lang.String getColumnName(int index)

  JTable required TableModel function.

  Specified by:
    `getColumnName` in interface `javax.swing.table.TableModel`
  Overrides:
    `getColumnName` in class `javax.swing.table.AbstractTableModel`

### getColumnClass

    public java.lang.Class getColumnClass(int index)

  JTable required TableModel function (default is Object).

  Specified by:
    `getColumnClass` in interface `javax.swing.table.TableModel`
  Overrides:
    `getColumnClass` in class `javax.swing.table.AbstractTableModel`

### getCellValueAt

    public abstract java.lang.Object getCellValueAt(java.lang.Object baseObject,
                                                    int columnIndex)

  Gets the object's value for the given column index.

  Returns:
    an object that can be rendered by the table.

### isCellEditable

    public boolean isCellEditable(int row,
                                  int col)

  Specified by:
    `isCellEditable` in interface `javax.swing.table.TableModel`
  Overrides:
    `isCellEditable` in class `javax.swing.table.AbstractTableModel`

### setValueAt

    public void setValueAt(java.lang.Object value,
                           int row,
                           int col)

  Specified by:
    `setValueAt` in interface `javax.swing.table.TableModel`
  Overrides:
    `setValueAt` in class `javax.swing.table.AbstractTableModel`

### setColumnNames

    public void setColumnNames(java.lang.String[] fieldNames)

  Sets the column titles to be used in the table

### setColumnClasses

    public void setColumnClasses(java.lang.Class[] fieldClasses)

  Sets the column classes of the table

### getColumnNames

    protected java.lang.String[] getColumnNames()

  Gets the strings to use as column names.

### setColumnFields

    public void setColumnFields(java.lang.Class objectClass,
                                java.lang.String[] fieldNames)

  Sets the fields to be used as columns in the table

### isMarkable

    public boolean isMarkable()

### markRow

    public void markRow(int row)

### unmarkRow

    public void unmarkRow(int row)

### clearMarks

    public void clearMarks()

### markAll

    public void markAll()

### isMarked

    public boolean isMarked(int row)

### isMarkedEmpty

    public boolean isMarkedEmpty()

### getMarkedRows

    public java.util.Collection getMarkedRows()

### getMarkedObjects

    public java.util.Collection getMarkedObjects()

### addMarkListener

    public void addMarkListener(AbstractIXTableModel.TableMarkListener tml)

### removeMarkListener

    public void removeMarkListener(AbstractIXTableModel.TableMarkListener tml)

### fireTableMarkAdded

    public void fireTableMarkAdded(java.lang.Object rowObject)

### fireTableMarkRemoved

    public void fireTableMarkRemoved(java.lang.Object rowObject)

### fireTableMarkCleared

    public void fireTableMarkCleared()

### fireTableMarkedAll

    public void fireTableMarkedAll()

### deriveColumnFields

    protected void deriveColumnFields()

  Collects usable fields from the objectClass

### defaultSetColumnFields

    protected void defaultSetColumnFields(java.lang.String[] fieldNames)

  Sets the fields to be used as table columns

### defaultGetCellValueAt

    protected java.lang.Object defaultGetCellValueAt(java.lang.Object o,
                                                     int columnIndex)

  Looks up the value in the columnField of the given index.

  Returns:
    the value object or null if something goes wrong.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD