com.cometway.swing
Class PropsTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.cometway.swing.PropsTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class PropsTableModel
extends javax.swing.table.AbstractTableModel

This is a swing TableModel implementation for editing Props.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
PropsTableModel(Props p)
          Constructor for PropsTableModel.
 
Method Summary
 java.lang.Class getColumnClass(int column)
          Returns the Class of data in the specified Column (java.lang.String).
 int getColumnCount()
          Returns the number of columns (2).
 java.lang.String getColumnName(int column)
          Returns the name of the specified column.
 int getRowCount()
          Returns the number of rows in this TableModel.
 java.lang.Object getValueAt(int row, int col)
          Returns the value of the specified row and column.
 boolean isCellEditable(int row, int column)
          Returns true if the specified cell is editable; false otherwise.
 boolean isReservedKey(java.lang.String key)
          Returns true if the specified key is "agent_id", "name", "classname", "startup", "hide_println", "hide_warning" or "hide_debug".
 void notifyPropsChanged()
          Call this method to indicate that the values in the table have changed.
 void setProps(Props p)
          Sets the Props this TableModel is rendering.
 void setValueAt(java.lang.Object value, int row, int col)
          Sets the value of the specified cell.
 void sortKeys()
          Sorts the keys in alphabetical order.
 
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

PropsTableModel

public PropsTableModel(Props p)
Constructor for PropsTableModel. There is one column for Key, and another for Value.

Parameters:
p - The Props to be rendered by a JTable.
Method Detail

getColumnCount

public int getColumnCount()
Returns the number of columns (2).


getColumnClass

public java.lang.Class getColumnClass(int column)
Returns the Class of data in the specified Column (java.lang.String).

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

getColumnName

public java.lang.String getColumnName(int column)
Returns the name of the specified column.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getRowCount

public int getRowCount()
Returns the number of rows in this TableModel.


getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Returns the value of the specified row and column.


isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns true if the specified cell is editable; false otherwise.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

isReservedKey

public boolean isReservedKey(java.lang.String key)
Returns true if the specified key is "agent_id", "name", "classname", "startup", "hide_println", "hide_warning" or "hide_debug".


notifyPropsChanged

public void notifyPropsChanged()
Call this method to indicate that the values in the table have changed.


setProps

public void setProps(Props p)
Sets the Props this TableModel is rendering.


setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Sets the value of the specified cell.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

sortKeys

public void sortKeys()
Sorts the keys in alphabetical order.