de.esprit.common.gui.table

## Class AbstractObjectTableModel<T>

- java.lang.Object
- - javax.swing.table.AbstractTableModel
  - - de.esprit.common.gui.table.AbstractObjectTableModel<T>

- All Implemented Interfaces:
    DataLoadEvent.Source, OrderChangeEvent.Source, Clearable, java.io.Serializable, javax.swing.table.TableModel
  Direct Known Subclasses:
    AbstractMarkableTableModel, ApplicationTableModel, DBRecordTableModel

      public abstract class AbstractObjectTableModel<T>
      extends javax.swing.table.AbstractTableModel
      implements Clearable, OrderChangeEvent.Source, DataLoadEvent.Source

  This TableModel stores a single object per row in an internal rowList. Thus columns must be rendered with special renderers that know how to render the particular field type.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class javax.swing.table.AbstractTableModel

      `listenerList`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractObjectTableModel()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addColumn(NlsKey nameKey)`
    `void` | `addColumn(NlsKey nameKey, int preferredWidth)`
    `void` | `addColumn(NlsKey nameKey, int minWidth, int preferredWidth, int maxWidth)`
    `void` | `addColumn(NlsKey nameKey, JavaDataType type, int minWidth, int preferredWidth, int maxWidth)`
    `void` | `addDataLoadListener(DataLoadEvent.Listener l)` Register here to be notified when the number of records changes.
    `void` | `addObject(int index, T obj)`
    `int` | `addObject(T newObj)` Adds an object into the TableModel whereas the current Comparator defines where it is added.
    `void` | `addObjects(java.util.Collection<T> objs)`
    `void` | `addObjects(T[] objs)`
    `void` | `addOrderChangeListener(OrderChangeEvent.Listener l)` Register here to be notified when the current Comparator is being changed.
    `protected void` | `addRowData(int index, T obj)`
    `protected void` | `addRowData(T obj)`
    `void` | `clear()` Clears the content
    `protected void` | `clearRowData()`
    `boolean` | `containsObject(T obj)`
    `T` | `dropRow(int rowIndex)`
    `int` | `dropRow(T obj)`
    `void` | `fireTableRowsDeleted(int firstRow, int lastRow)`
    `void` | `fireTableRowsInserted(int firstRow, int lastRow)`
    `void` | `fireTableRowsUpdated(int firstRow, int lastRow)`
    `java.util.List<T>` | `getAllObjects()`
    `int` | `getColumnCount()`
    `java.lang.String` | `getColumnName(int index)`
    `java.util.Comparator` | `getComparator()`
    `T` | `getObject(int index)` Returns the Object at the given row index.
    `int` | `getRowCount()`
    `T` | `getValueAt(int rowIndex)`
    `java.lang.Object` | `getValueAt(int rowIndex, int columnIndex)`
    `int` | `indexOf(java.lang.Object obj)` Finds the row index of the Object stored in column 0 of the TableModel.
    `boolean` | `isEmpty()`
    `boolean` | `isNumb()`
    `boolean` | `isSortAscending()`
    `void` | `load()` Empty implementation, can be overridden to load the table by activating the LoadAction
    `void` | `removeColumn(int index)`
    `void` | `removeDataLoadListener(DataLoadEvent.Listener l)`
    `T` | `removeObject(int index)`
    `int` | `removeObject(T obj)`
    `void` | `removeOrderChangeListener(OrderChangeEvent.Listener l)`
    `protected T` | `removeRowData(int rowIndex)`
    `boolean` | `replaceObject(T obj)`
    `void` | `setComparator(java.util.Comparator cmp)` Sets the current Comparator which causes an according sort of the table data
    `void` | `setNumb(boolean isNumb)` Sets the model to numb mode, where it does not fire events
    `void` | `setObject(int index, T obj)` Places the given Object at the specified index into the TableModel.
    `void` | `setSortAscending(boolean isAscending)`
    `void` | `setValueAt(java.lang.Object value, int rowIndex, int columnIndex)`

    - ### Methods inherited from class javax.swing.table.AbstractTableModel

      `addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### AbstractObjectTableModel

          public AbstractObjectTableModel()

  - ### Method Detail

    - #### addColumn

          public void addColumn(NlsKey nameKey)

    - #### addColumn

          public void addColumn(NlsKey nameKey,
                       int preferredWidth)

    - #### addColumn

          public void addColumn(NlsKey nameKey,
                       int minWidth,
                       int preferredWidth,
                       int maxWidth)

    - #### addColumn

          public void addColumn(NlsKey nameKey,
                       JavaDataType type,
                       int minWidth,
                       int preferredWidth,
                       int maxWidth)

    - #### getColumnName

          public java.lang.String getColumnName(int index)

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

    - #### load

          public void load()
                    throws java.lang.Exception

      Empty implementation, can be overridden to load the table by activating the LoadAction
      Throws:
        `java.lang.Exception`

    - #### setComparator

          public void setComparator(java.util.Comparator cmp)

      Sets the current Comparator which causes an according sort of the table data

    - #### setNumb

          public void setNumb(boolean isNumb)

      Sets the model to numb mode, where it does not fire events

    - #### isNumb

          public boolean isNumb()

    - #### getComparator

          public java.util.Comparator getComparator()

    - #### isSortAscending

          public boolean isSortAscending()

    - #### setSortAscending

          public void setSortAscending(boolean isAscending)

    - #### getColumnCount

          public int getColumnCount()

      Specified by:
        `getColumnCount` in interface `javax.swing.table.TableModel`

    - #### getRowCount

          public int getRowCount()

      Specified by:
        `getRowCount` in interface `javax.swing.table.TableModel`

    - #### getValueAt

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

      Specified by:
        `getValueAt` in interface `javax.swing.table.TableModel`

    - #### getValueAt

          public T getValueAt(int rowIndex)

    - #### removeColumn

          public void removeColumn(int index)

    - #### dropRow

          public final int dropRow(T obj)

    - #### dropRow

          public final T dropRow(int rowIndex)

    - #### addRowData

          protected void addRowData(T obj)

    - #### addRowData

          protected void addRowData(int index,
                        T obj)

    - #### removeRowData

          protected T removeRowData(int rowIndex)

    - #### clearRowData

          protected void clearRowData()

    - #### removeObject

          public int removeObject(T obj)

    - #### removeObject

          public T removeObject(int index)

    - #### addObject

          public void addObject(int index,
                       T obj)

    - #### addObjects

          public void addObjects(T[] objs)

    - #### addObjects

          public void addObjects(java.util.Collection<T> objs)

    - #### getAllObjects

          public java.util.List<T> getAllObjects()

    - #### addObject

          public int addObject(T newObj)

      Adds an object into the TableModel whereas the current Comparator defines where it is added. If no comparator is set, then the rows are just added unsorted.

    - #### indexOf

          public int indexOf(java.lang.Object obj)

      Finds the row index of the Object stored in column 0 of the TableModel. Compares by the equals() method.

    - #### containsObject

          public boolean containsObject(T obj)

    - #### getObject

          public T getObject(int index)

      Returns the Object at the given row index.

    - #### replaceObject

          public boolean replaceObject(T obj)

    - #### setObject

          public void setObject(int index,
                       T obj)

      Places the given Object at the specified index into the TableModel.

    - #### setValueAt

          public void setValueAt(java.lang.Object value,
                        int rowIndex,
                        int columnIndex)

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

    - #### clear

          public void clear()

      Description copied from interface: `Clearable`
      Clears the content
      Specified by:
        `clear` in interface `Clearable`

    - #### isEmpty

          public boolean isEmpty()

    - #### fireTableRowsInserted

          public void fireTableRowsInserted(int firstRow,
                                   int lastRow)

      Overrides:
        `fireTableRowsInserted` in class `javax.swing.table.AbstractTableModel`

    - #### fireTableRowsDeleted

          public void fireTableRowsDeleted(int firstRow,
                                  int lastRow)

      Overrides:
        `fireTableRowsDeleted` in class `javax.swing.table.AbstractTableModel`

    - #### fireTableRowsUpdated

          public void fireTableRowsUpdated(int firstRow,
                                  int lastRow)

      Overrides:
        `fireTableRowsUpdated` in class `javax.swing.table.AbstractTableModel`

    - #### addDataLoadListener

          public void addDataLoadListener(DataLoadEvent.Listener l)

      Register here to be notified when the number of records changes.
      Specified by:
        `addDataLoadListener` in interface `DataLoadEvent.Source`

    - #### removeDataLoadListener

          public void removeDataLoadListener(DataLoadEvent.Listener l)

      Specified by:
        `removeDataLoadListener` in interface `DataLoadEvent.Source`

    - #### addOrderChangeListener

          public void addOrderChangeListener(OrderChangeEvent.Listener l)

      Register here to be notified when the current Comparator is being changed.
      Specified by:
        `addOrderChangeListener` in interface `OrderChangeEvent.Source`

    - #### removeOrderChangeListener

          public void removeOrderChangeListener(OrderChangeEvent.Listener l)

      Specified by:
        `removeOrderChangeListener` in interface `OrderChangeEvent.Source`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.