DESY ACOP Beans Home

com.cosylab.gui.components
Class ObjectTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.cosylab.gui.components.table.TableModelRows
          extended by com.cosylab.gui.components.table.MutableTableModelRows
              extended by com.cosylab.gui.components.ObjectTableModel
All Implemented Interfaces:
TableRowModelListener, java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.Set, javax.swing.table.TableModel

public class ObjectTableModel
extends MutableTableModelRows
implements java.util.Set

TableModel, which accepts new items as objects and converts them to new rows. This model acts as Set for Objects, it does not hold them in constant order and does not permit multiple entries with same object.

Author:
Igor Kriznar
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ObjectTableModel()
          Creates new empty model.
ObjectTableModel(ObjectTableEngine engine)
          Creates new model with engine.
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 java.lang.String getColumnName(int column)
           
 ObjectTableEngine getObjectTableEngine()
          Return engine, which converts objects to table rows.
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 void setObjectTableEngine(ObjectTableEngine objectTableEngine)
          Sets new object to for converter.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 
Methods inherited from class com.cosylab.gui.components.table.MutableTableModelRows
addRow, addRow, getComparator, getRow, removeAllRows, removeRow, removeRow, setColumnCount, setColumnNames, setComparator
 
Methods inherited from class com.cosylab.gui.components.table.TableModelRows
getColumnCount, getRowCount, getRowModel, getValueAt, isCellEditable, tableChanged
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

ObjectTableModel

public ObjectTableModel()
Creates new empty model.


ObjectTableModel

public ObjectTableModel(ObjectTableEngine engine)
Creates new model with engine.

Parameters:
engine - the table engine
Method Detail

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.Set

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.Set

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.Set

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set

getObjectTableEngine

public ObjectTableEngine getObjectTableEngine()
Return engine, which converts objects to table rows. If engine was not set before, call to this method initializes this model to DefaultObjectTableEngine.

Returns:
object to row converter

setObjectTableEngine

public void setObjectTableEngine(ObjectTableEngine objectTableEngine)
Sets new object to for converter. Setting new factory is only alllowed with empty model.

Parameters:
objectTableEngine - new object to row converter
Throws:
java.lang.IllegalStateException - if model is not empty

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

getColumnName

public java.lang.String getColumnName(int column)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class TableModelRows


Copyright © 2010. All Rights Reserved.