org.openswing.swing.properties.client
Class PropertyGridModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byjavax.swing.table.DefaultTableModel
          extended byorg.openswing.swing.properties.client.PropertyGridModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class PropertyGridModel
extends javax.swing.table.DefaultTableModel

Title: OpenSwing Framework

Description: TableModel used by PropertyGridControl.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Constructor Summary
PropertyGridModel()
           
 
Method Summary
 int findRow(java.lang.String attributeName)
           
 java.lang.String getAttributeName(int rowIndex)
           
 int[] getChangedRowNumbers()
           
 java.lang.Object getDefaultValue(int rowIndex)
           
 InputControl getInputControl(int rowIndex)
           
 int getMode()
           
 java.lang.Object getOldPropertyValue(int rowIndex)
           
 java.lang.Object getPropertyValue(int rowIndex)
           
 java.lang.Object getUserObject(int rowIndex)
           
 boolean isCellEditable(int row, int column)
           
 boolean isRequired(int rowIndex)
           
 void setMode(int mode)
          Set grid mode.
 void setPropertyValue(int rowIndex, java.lang.Object value)
           
 void setValueAt(java.lang.Object aValue, int row, int column)
          Sets the object value for the cell at column and row.
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
 
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyGridModel

public PropertyGridModel()
Method Detail

isCellEditable

public final boolean isCellEditable(int row,
                                    int column)
Returns:
true if the current grid mode is EDIT and the column is the property value column, false otherwise

getMode

public final int getMode()
Returns:
current grid mode

setMode

public final void setMode(int mode)
Set grid mode.

Parameters:
mode - grid mode; possibile values: READONLY, INSERT, EDIT

getDefaultValue

public final java.lang.Object getDefaultValue(int rowIndex)
Parameters:
rowIndex - row index
Returns:
default value to use (in INSERT mode) for the property value related to the specified row index

getInputControl

public final InputControl getInputControl(int rowIndex)
Parameters:
rowIndex - row index
Returns:
Component to use for the property value related to the specified row index

isRequired

public final boolean isRequired(int rowIndex)
Parameters:
rowIndex - row index
Returns:
true if the property is mandatory, false otherwise

getAttributeName

public final java.lang.String getAttributeName(int rowIndex)
Parameters:
rowIndex - row index
Returns:
attribute name, related to the specified row index

setPropertyValue

public final void setPropertyValue(int rowIndex,
                                   java.lang.Object value)
Parameters:
rowIndex - row index in the model
value - property value to set

getPropertyValue

public final java.lang.Object getPropertyValue(int rowIndex)
Parameters:
rowIndex - row index in the model
Returns:
property value related to the specified attribute name

getOldPropertyValue

public final java.lang.Object getOldPropertyValue(int rowIndex)
Returns:
old value stored for the specified property value

getUserObject

public final java.lang.Object getUserObject(int rowIndex)
Parameters:
rowIndex - row index in the model
Returns:
user object related to the specified row index

findRow

public final int findRow(java.lang.String attributeName)
Parameters:
attributeName - attribute name that identify a row
Returns:
row index related to the specified attribute name

getChangedRowNumbers

public final int[] getChangedRowNumbers()
Returns:
list of row indexes, related to chnaged properties

setValueAt

public final void setValueAt(java.lang.Object aValue,
                             int row,
                             int column)
Sets the object value for the cell at column and row. aValue is the new value. This method will generate a tableChanged notification.

Parameters:
aValue - the new value; this can be null
row - the row whose value is to be changed
column - the column whose value is to be changed
Throws:
java.lang.ArrayIndexOutOfBoundsException - if an invalid row or column was given