org.moyoman.client.reference.admin
Class MessageTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--org.moyoman.client.reference.admin.MessageTableModel
All Implemented Interfaces:
Serializable, TableModel

class MessageTableModel
extends AbstractTableModel

Provides a table model to edit messages.

Since:
v0.02
Version:
v0.15
Author:
Jeffrey M. Thompson

Field Summary
private  List _data
          The keys.
private  String _fromLanguage
          From language.
private  boolean _isEditingDefault
          Flag indicating if we're editing the default language.
private  String _toLanguage
          To language.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
MessageTableModel(boolean isEditingDefault, String fromLanguage, String toLanguage)
          Construct this object with the given parameter.
 
Method Summary
 void addKey(String key)
          Add the given key to the table.
 int getColumnCount()
          Return the column count.
 String getColumnName(int column)
          Return the column name at the given index.
 String getEditLanguage()
          Return the language being edited.
(package private)  String getFromLanguage()
          Return the from language.
 int getRowCount()
          Return the row count.
(package private)  String getToLanguage()
          Return the to language.
private  String getValue(String languageName, String key)
          Return the value for the given language name and key.
 Object getValueAt(int row, int column)
          Return the value at the given coordinates.
 int indexOf(String key)
          Return the index of the given key.
 boolean isCellEditable(int row, int column)
          Return true if the cell at the given coordinates is editable.
 boolean isEditingDefault()
          Return the flag which indicates if we're editing the default language.
 void load()
          Load the keys into the table model.
 void removeKey(String key)
          Add the given key to the table.
private  void setValue(int row, String languageName, String value)
          Set the value for the given language name and key.
 void setValueAt(Object value, int row, int column)
          Return the value at the given coordinates.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_data

private List _data
The keys.


_fromLanguage

private String _fromLanguage
From language.


_toLanguage

private String _toLanguage
To language.


_isEditingDefault

private boolean _isEditingDefault
Flag indicating if we're editing the default language.

Constructor Detail

MessageTableModel

public MessageTableModel(boolean isEditingDefault,
                         String fromLanguage,
                         String toLanguage)
Construct this object with the given parameter.

Parameters:
isEditingDefault - Flag indicating if we're editing the default language.
fromLanguage - From language.
toLanguage - To language.
Since:
v0.02
Method Detail

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Return true if the cell at the given coordinates is editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Since:
v0.02

getColumnCount

public int getColumnCount()
Return the column count.

Since:
v0.02

getColumnName

public String getColumnName(int column)
Return the column name at the given index.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Since:
v0.02

getEditLanguage

public String getEditLanguage()
Return the language being edited.

Since:
v0.02

isEditingDefault

public boolean isEditingDefault()
Return the flag which indicates if we're editing the default language.

Since:
v0.02

getRowCount

public int getRowCount()
Return the row count.

Since:
v0.02

setValueAt

public void setValueAt(Object value,
                       int row,
                       int column)
Return the value at the given coordinates.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Since:
v0.02

getValueAt

public Object getValueAt(int row,
                         int column)
Return the value at the given coordinates.

Since:
v0.02

addKey

public void addKey(String key)
Add the given key to the table.

Since:
v0.02

indexOf

public int indexOf(String key)
Return the index of the given key.

Since:
v0.02

load

public void load()
Load the keys into the table model.

Since:
v0.02

removeKey

public void removeKey(String key)
Add the given key to the table.

Since:
v0.02

getFromLanguage

String getFromLanguage()
Return the from language.

Since:
v0.02

getToLanguage

String getToLanguage()
Return the to language.

Since:
v0.02

setValue

private void setValue(int row,
                      String languageName,
                      String value)
Set the value for the given language name and key.

Since:
v0.02

getValue

private String getValue(String languageName,
                        String key)
Return the value for the given language name and key.

Since:
v0.02