org.purl.sword.client
Class PropertiesDialog.PropertiesModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.purl.sword.client.PropertiesDialog.PropertiesModel
All Implemented Interfaces:
Serializable, TableModel
Enclosing class:
PropertiesDialog

public class PropertiesDialog.PropertiesModel
extends AbstractTableModel

A table model that is used to show the properties. The model links directly to the underlying properties object. As changes are made in the table, the corresponding changes are made in the properties object. The user can only edit the value column in the table.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
PropertiesDialog.PropertiesModel()
          Create a new instance of the model.
 
Method Summary
 Class getColumnClass(int col)
          Retrieve the column class.
 int getColumnCount()
          Get the number of columns.
 String getColumnName(int col)
          Retrieve the column name for the specified column.
 String getKeyValue(int row)
          Get the Key value for the specified row.
 int getRowCount()
          Get the number of rows.
 Object getValueAt(int row, int col)
          Get the value that is at the specified cell.
 boolean isCellEditable(int row, int col)
          Determine if the cell can be edited.
 void setValueAt(Object value, int row, int col)
          Set the value for the specified cell.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesDialog.PropertiesModel

public PropertiesDialog.PropertiesModel()
Create a new instance of the model. If no properties object exists, a default model is created. Note, this will allow the table to continue editing, although this value will not be passed back to the calling window.

Method Detail

getColumnCount

public int getColumnCount()
Get the number of columns.

Returns:
The number of columns.

getRowCount

public int getRowCount()
Get the number of rows.

Returns:
The number of rows.

getValueAt

public Object getValueAt(int row,
                         int col)
Get the value that is at the specified cell.

Parameters:
row - The row for the cell.
col - The column for the cell.
Returns:
The data value from the properties.

getColumnName

public String getColumnName(int col)
Retrieve the column name for the specified column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
col - The column number.
Returns:
The column name.

getColumnClass

public Class getColumnClass(int col)
Retrieve the column class.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
col - The column number.
Returns:
The class for the object found at the column position.

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Determine if the cell can be edited. This model will only allow the second column to be edited.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - The cell row.
col - The cell column.
True - if the cell can be edited. Otherwise, false.

setValueAt

public void setValueAt(Object value,
                       int row,
                       int col)
Set the value for the specified cell.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
value - The value to set.
row - The row for the cell.
col - The column.

getKeyValue

public String getKeyValue(int row)
Get the Key value for the specified row.

Parameters:
row - The row.
Returns:
A string that shows the key value.


Copyright © 2011 DuraSpace. All Rights Reserved.