org.openide.explorer 6.5.22 1

org.openide.explorer.view
Class NodeTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.openide.explorer.view.NodeTableModel
All Implemented Interfaces:
Serializable, TableModel

public class NodeTableModel
extends AbstractTableModel

Table model with properties (Node.Property) as columns and nodes (Node) as rows. It is used as model for displaying node properties in table. Each column is represented by Node.Property object. Each row is represented by Node object. Each cell contains Node.Property property which equals with column object and should be in property sets of row representant (Node).

Since:
1.7
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
NodeTableModel()
           
 
Method Summary
 Class getColumnClass(int column)
          Getter for column class.
 int getColumnCount()
          Getter for column count.
 String getColumnName(int column)
          Getter for column name
protected  Node.Property getPropertyFor(Node node, Node.Property prop)
          Returns node property if found in nodes property sets.
 int getRowCount()
          Getter for row count.
 Object getValueAt(int row, int column)
          Getter for property.
 boolean isCellEditable(int row, int column)
          Cell is editable only if it has non null value.
 void setNodes(Node[] nodes)
          Set rows.
 void setProperties(Node.Property[] props)
          Set columns.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeTableModel

public NodeTableModel()
Method Detail

setNodes

public void setNodes(Node[] nodes)
Set rows.

Parameters:
nodes - the rows

setProperties

public void setProperties(Node.Property[] props)
Set columns.

Parameters:
props - the columns

getPropertyFor

protected Node.Property getPropertyFor(Node node,
                                       Node.Property prop)
Returns node property if found in nodes property sets. Could be overriden to return property which is not in nodes property sets.

Parameters:
node - represents single row
prop - represents column
Returns:
nodes property

getRowCount

public int getRowCount()
Getter for row count.

Returns:
row count

getColumnCount

public int getColumnCount()
Getter for column count.

Returns:
column count

getValueAt

public Object getValueAt(int row,
                         int column)
Getter for property.

Parameters:
row - table row index
column - table column index
Returns:
property at (row, column)

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Cell is editable only if it has non null value.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - table row index
column - table column index
Returns:
true if cell contains non null value

getColumnClass

public Class getColumnClass(int column)
Getter for column class.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
column - table column index
Returns:
Node.Property.class

getColumnName

public String getColumnName(int column)
Getter for column name

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
column - table column index
Returns:
display name of property which represents column

org.openide.explorer 6.5.22 1

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.