org.PingOO.DLAI.lib.PWidget
Class DefaultPTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--javax.swing.table.DefaultTableModel
              |
              +--org.PingOO.DLAI.lib.PWidget.DefaultPTableModel

public class DefaultPTableModel
extends javax.swing.table.DefaultTableModel

Provides default model for PTables (localizable columns names).

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
JTable, DefaultTableModel, PTable, PComponent, Serialized Form

Field Summary
private  PManager manager
          The manager where this component will lokk for its resources.
protected  java.lang.String module
          Defines the module where to find this component's text and tool tip.
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DefaultPTableModel()
          Constructs a default table model which is a table of zero columns and zero rows.
DefaultPTableModel(int numRows, int numColumns)
          Constructs a table model with numRows and numColumns of null object values.
DefaultPTableModel(java.lang.Object[][] data, java.lang.Object[] columnNames)
          Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.
DefaultPTableModel(java.lang.Object[] columnNames, int numRows)
          Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.
DefaultPTableModel(java.lang.String module)
          Constructs a default table model which is a table of zero columns and zero rows.
DefaultPTableModel(java.lang.String module, int numRows, int numColumns)
          Constructs a table model with numRows and numColumns of null object values.
DefaultPTableModel(java.lang.String module, java.lang.Object[][] data, java.lang.Object[] columnNames)
          Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.
DefaultPTableModel(java.lang.String module, java.lang.Object[] columnNames, int numRows)
          Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.
DefaultPTableModel(java.lang.String module, java.util.Vector columnNames, int numRows)
          Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.
DefaultPTableModel(java.lang.String module, java.util.Vector data, java.util.Vector columnNames)
          Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.
DefaultPTableModel(java.util.Vector columnNames, int numRows)
          Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.
DefaultPTableModel(java.util.Vector data, java.util.Vector columnNames)
          Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.
 
Method Summary
 void addLocalizedColumn(java.lang.String columnNameKey)
          Add a localizable column to the model.
 void addLocalizedColumn(java.lang.String columnNameKey, java.lang.Object[] columnData)
          Adds a localizable column to the model.
 int findColumn(java.lang.String columnName)
          Convenience method for locating columns by name.
 int findLocalizedColumn(java.lang.String columnNameKey)
          Find the first localizable column that have the required nameKey.
 java.lang.String getColumnName(int column)
          Returns the column name.
 java.lang.String getLocalizedColumnName(int column)
           
 java.lang.String getModule()
          Returns the component's resources location.
 void updateLanguage()
          Update the component's text and tool tip with the default module.
 void updateLanguage(java.lang.String module)
          Update the component's text and tool tip with the current module.
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getDataVector, getRowCount, getValueAt, insertRow, insertRow, isCellEditable, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, removeTableModelListener
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

module

protected java.lang.String module
Defines the module where to find this component's text and tool tip.

manager

private PManager manager
The manager where this component will lokk for its resources.
Constructor Detail

DefaultPTableModel

public DefaultPTableModel()
Constructs a default table model which is a table of zero columns and zero rows.

DefaultPTableModel

public DefaultPTableModel(java.lang.String module)
Constructs a default table model which is a table of zero columns and zero rows.

DefaultPTableModel

public DefaultPTableModel(int numRows,
                          int numColumns)
Constructs a table model with numRows and numColumns of null object values.
Parameters:
numRows -  
numColumns -  

DefaultPTableModel

public DefaultPTableModel(java.lang.String module,
                          int numRows,
                          int numColumns)
Constructs a table model with numRows and numColumns of null object values.
Parameters:
numRows -  
numColumns -  

DefaultPTableModel

public DefaultPTableModel(java.lang.Object[][] data,
                          java.lang.Object[] columnNames)
Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.

DefaultPTableModel

public DefaultPTableModel(java.lang.String module,
                          java.lang.Object[][] data,
                          java.lang.Object[] columnNames)
Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.

DefaultPTableModel

public DefaultPTableModel(java.lang.Object[] columnNames,
                          int numRows)
Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.

DefaultPTableModel

public DefaultPTableModel(java.lang.String module,
                          java.lang.Object[] columnNames,
                          int numRows)
Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.

DefaultPTableModel

public DefaultPTableModel(java.util.Vector columnNames,
                          int numRows)
Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.

DefaultPTableModel

public DefaultPTableModel(java.lang.String module,
                          java.util.Vector columnNames,
                          int numRows)
Constructs a table model with as many columns as there are elements in columnNames and numRows of null object values.

DefaultPTableModel

public DefaultPTableModel(java.util.Vector data,
                          java.util.Vector columnNames)
Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.

DefaultPTableModel

public DefaultPTableModel(java.lang.String module,
                          java.util.Vector data,
                          java.util.Vector columnNames)
Constructs a table model and initializes the table by passing data and columnNames to the setDataVector() method.
Method Detail

updateLanguage

public void updateLanguage()
Update the component's text and tool tip with the default module.

updateLanguage

public void updateLanguage(java.lang.String module)
Update the component's text and tool tip with the current module.
Parameters:
module - The module where the resources are stored.

getModule

public final java.lang.String getModule()
Returns the component's resources location.
Returns:
The component's resources location or PComponent.DEFAULT_MODULE if the component has no defined module

addLocalizedColumn

public void addLocalizedColumn(java.lang.String columnNameKey)
Add a localizable column to the model.

addLocalizedColumn

public void addLocalizedColumn(java.lang.String columnNameKey,
                               java.lang.Object[] columnData)
Adds a localizable column to the model.
Parameters:
columnNameKey -  
columnData -  

findLocalizedColumn

public int findLocalizedColumn(java.lang.String columnNameKey)
Find the first localizable column that have the required nameKey.

findColumn

public int findColumn(java.lang.String columnName)
Convenience method for locating columns by name.
Implementation is naive so this should be overridden if this method is to be called often.
This method is not in the TableModel interface and is not used by the JTable.

Also, if you indent to use localized column names you sould try findLocalizedColumn() instead of this method.

Overrides:
findColumn in class javax.swing.table.AbstractTableModel

getLocalizedColumnName

public java.lang.String getLocalizedColumnName(int column)

getColumnName

public java.lang.String getColumnName(int column)
Returns the column name.
Returns:
A name for this column using the string value of the appropriate member in columnIdentfiers. If columnIdentfiers is null or does not have and entry for this index return the default name provided by the superclass.
Overrides:
getColumnName in class javax.swing.table.DefaultTableModel