DESY ACOP Beans Home

com.cosylab.gui.components.table
Class TableRowArray

java.lang.Object
  extended by com.cosylab.gui.components.table.TableRowArray
All Implemented Interfaces:
TableRow

public class TableRowArray
extends java.lang.Object
implements TableRow

TableRowArray is support implementation of TableRow build around ArrayList.

Since:
May 5, 2004.
Version:
$Id: TableRowArray.java,v 1.7 2008-04-22 12:28:40 jbobnar Exp $
Author:
Igor Kriznar

Field Summary
protected  TableRowModel parentModel
           
protected  java.util.List<java.lang.Object> values
           
 
Constructor Summary
TableRowArray()
          Creates new instance.
TableRowArray(java.util.List<java.lang.Object> l)
          Creates new instance.
TableRowArray(java.lang.Object[] l)
          Creates new instance.
 
Method Summary
 void addValue(int index, java.lang.Object value)
          Inserts new value to this row at specified position.
 void addValue(java.lang.Object value)
          Adds new value to the end of this row.
 int compareTo(TableRow row, int valueIndex)
          Compares this table row with the specified table row for order.
protected  void fireUpdate()
           
protected  void fireUpdate(int index)
           
 TableRowModel getParentModel()
          The parent model which contains this row.
 java.lang.Object getValueAt(int column)
          Returns value at column index.
 int getValueCount()
          Returns the number values int this row.
 boolean isValueSettable(int index)
          Return true if value at specified column index is editable.
 void setParentModel(TableRowModel model)
          This method is called when row is added to model.
 java.lang.Object setValue(int index, java.lang.Object newValue)
          Replaces value at specified index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

protected java.util.List<java.lang.Object> values

parentModel

protected TableRowModel parentModel
Constructor Detail

TableRowArray

public TableRowArray()
Creates new instance.


TableRowArray

public TableRowArray(java.lang.Object[] l)
Creates new instance.

Parameters:
l - values as array

TableRowArray

public TableRowArray(java.util.List<java.lang.Object> l)
Creates new instance.

Parameters:
l - values as List
Method Detail

getValueAt

public java.lang.Object getValueAt(int column)
Description copied from interface: TableRow
Returns value at column index.

Specified by:
getValueAt in interface TableRow
Parameters:
column - the column index
Returns:
value at column index

getValueCount

public int getValueCount()
Description copied from interface: TableRow
Returns the number values int this row.

Specified by:
getValueCount in interface TableRow
Returns:
the number values int this row

setParentModel

public void setParentModel(TableRowModel model)
Description copied from interface: TableRow
This method is called when row is added to model. When row is remove from the model, this method is called with parameter null.

Row can call on parent model method fireRowUpdate(TableRow,int) when want to notify model listeners (specially the JTable) about data changes.

Specified by:
setParentModel in interface TableRow
Parameters:
model - the model to which row was added, or null, when row is removed form model
See Also:
TableRowModel.fireRowUpdate(TableRow, int)

getParentModel

public TableRowModel getParentModel()
Description copied from interface: TableRow
The parent model which contains this row.

Specified by:
getParentModel in interface TableRow
Returns:
the parent model which contains this row.

addValue

public void addValue(java.lang.Object value)
Adds new value to the end of this row.

Parameters:
value - the value added to the end of this row

addValue

public void addValue(int index,
                     java.lang.Object value)
Inserts new value to this row at specified position.

Parameters:
index - where to insert value
value - new inserted value

setValue

public java.lang.Object setValue(int index,
                                 java.lang.Object newValue)
Replaces value at specified index.

Parameters:
index - where value is set
newValue - new value
Returns:
old value at index

fireUpdate

protected void fireUpdate()

fireUpdate

protected void fireUpdate(int index)

isValueSettable

public boolean isValueSettable(int index)
Description copied from interface: TableRow
Return true if value at specified column index is editable.

Specified by:
isValueSettable in interface TableRow
Parameters:
index - the column index
Returns:
true if value at the specified column index is editable

compareTo

public int compareTo(TableRow row,
                     int valueIndex)
Description copied from interface: TableRow
Compares this table row with the specified table row for order. Returns a negative integer, zero, or a positive integer as this row is less than, equal to, or greater than the specified row.

Specified by:
compareTo in interface TableRow
Parameters:
row - a row, to which it is compared
valueIndex - the index of value, which is compared in row
Returns:
negative integer, zero, or a positive integer as this row is less than, equal to, or greater than the specified row.


Copyright © 2010. All Rights Reserved.