DESY ACOP Beans Home

com.cosylab.gui.components.introspection
Class PropertiesTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.cosylab.gui.components.introspection.PropertiesTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
BeanPropertiesTableModel

public class PropertiesTableModel
extends javax.swing.table.AbstractTableModel

A table model, which help edit arbitrary set of properties. Each property has arbitrary name, value and type. In connection with PropertiesTable this model is capabel of JavaBeans editing based on introspection.

Version:
$id$
Author:
Miha Kadunc
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
PropertiesTableModel()
          Constructor for PropertiesTableModel.
PropertiesTableModel(java.lang.String[] names, java.lang.Class[] types, java.lang.Object[] values)
          Creates new model with specified property names, types and values.
 
Method Summary
 boolean containsProperty(java.lang.String name)
          Check if the table contains the given property.
 int findColumn(java.lang.String columnName)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int columnIndex)
           
 java.lang.String[] getPropertyNames()
          Returns array with names of properties.
 java.lang.Class[] getPropertyTypes()
          Returns array with types of properties.
 java.lang.Object[] getPropertyValues()
          Returns array with values of properties.
 int getRowCount()
           
 java.lang.Class getTypeForRow(int row)
          Returns type of property in specified row.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isEditable()
          Returns true if editting is allowed.
 boolean isTypeShowing()
          Returns true if table shows additional column with property types.
 void setEditable(boolean editable)
          Sets the editable property of this model.
 void setPropertyNames(java.lang.String[] names)
          Sets the parameter names
 void setPropertyTypes(java.lang.Class[] types)
          Sets the parameter types
 void setPropertyValues(java.lang.Object[] values)
          Sets the parameters
 void setTypeShowing(boolean typeShowing)
          Enables table to show additional column with property types.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, 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
 

Constructor Detail

PropertiesTableModel

public PropertiesTableModel()
Constructor for PropertiesTableModel.


PropertiesTableModel

public PropertiesTableModel(java.lang.String[] names,
                            java.lang.Class[] types,
                            java.lang.Object[] values)
Creates new model with specified property names, types and values.

Parameters:
names - String[]
types - Class[]
values - Object[]
Method Detail

getRowCount

public int getRowCount()

setPropertyNames

public void setPropertyNames(java.lang.String[] names)
Sets the parameter names

Parameters:
names - String[]

setPropertyValues

public void setPropertyValues(java.lang.Object[] values)
Sets the parameters

Parameters:
values - Object[]

setPropertyTypes

public void setPropertyTypes(java.lang.Class[] types)
Sets the parameter types

Parameters:
types - Class[]

getColumnCount

public int getColumnCount()

getValueAt

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

findColumn

public int findColumn(java.lang.String columnName)
Overrides:
findColumn in class javax.swing.table.AbstractTableModel

getColumnName

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

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

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

getPropertyNames

public java.lang.String[] getPropertyNames()
Returns array with names of properties.

Returns:
String[]

getPropertyTypes

public java.lang.Class[] getPropertyTypes()
Returns array with types of properties.

Returns:
Class[]

getPropertyValues

public java.lang.Object[] getPropertyValues()
Returns array with values of properties.

Returns:
Object[]

isTypeShowing

public boolean isTypeShowing()
Returns true if table shows additional column with property types.

Returns:
boolean

setTypeShowing

public void setTypeShowing(boolean typeShowing)
Enables table to show additional column with property types.

Parameters:
typeShowing - The typeShowing to set

getTypeForRow

public java.lang.Class getTypeForRow(int row)
Returns type of property in specified row.

Parameters:
row -
Returns:

containsProperty

public boolean containsProperty(java.lang.String name)
Check if the table contains the given property.

Parameters:
name -
Returns:

isEditable

public boolean isEditable()
Returns true if editting is allowed.

Returns:

setEditable

public void setEditable(boolean editable)
Sets the editable property of this model.

Parameters:
editable -


Copyright © 2010. All Rights Reserved.