|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.swing.table.TableModelAdapter
public class TableModelAdapter
Adapts the DataModel nodes for use with Table components.
Copyright (c) Formaria Ltd., 2008
License: see license.txt
| Field Summary | |
|---|---|
protected Project |
currentProject
|
protected boolean |
editable
|
protected int |
headerRow
1 - to display a header, 0 - otherwise |
protected java.util.Vector |
listeners
|
protected DataModel |
model
The data model |
protected ModelListener |
modelListener
|
protected int |
outputFieldIdx
|
protected DataModel |
rootModel
|
protected java.lang.Object |
table
|
protected boolean |
translateable
|
protected Translator |
translator
|
protected boolean |
usesDatabase
|
| Constructor Summary | |
|---|---|
TableModelAdapter(Project project)
Creates a new instance of TableModelAdapter |
|
TableModelAdapter(Project project,
java.lang.Object c,
DataModel src)
Creates a new instance of TableModelAdpater |
|
| Method Summary | |
|---|---|
void |
addTableModelListener(javax.swing.event.TableModelListener l)
Adds a listener to the list that is notified each time a change to the data model occurs. |
java.lang.Object |
clone()
Create a copy of this adapter |
void |
configure(java.util.Hashtable bindingConfig,
java.util.Hashtable instanceConfig)
Sets the configuration. |
int |
find(java.lang.String key,
int keyColumnIdx)
Locate a key value in the underlying data source |
java.lang.Object |
get(int i)
Gets the individual list item value |
java.lang.Object |
get(int i,
int fieldIdx)
Gets the individual list item value |
DataModel |
getAdaptedModel()
Gets the encapsulated model node. |
java.lang.Class |
getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column. |
int |
getColumnCount()
Gets the number of columns that should be shown in a table. |
java.lang.String |
getColumnName(int columnIndex)
Gets the name of the column at the specified position. |
DataModel |
getDataModel()
Gets the encapsulated model node. |
java.lang.String |
getFieldName(int column,
java.lang.String field)
Get the displayable field name |
java.lang.Object |
getModelAt(int rowIndex)
Get the model for the specified row |
java.lang.Object |
getModelAt(int rowIndex,
int columnIndex)
Deprecated. |
int |
getNumChildren()
Gets the number of children of the adapted model node. |
int |
getRowCount()
Gets the number of rows that will appera in a Table component. |
java.lang.Object |
getSelected()
Gets the value of the selected item from the node. |
java.lang.Object |
getSelected(int fieldIdx)
Gets the specified field's value. |
boolean |
getTranslated()
Gets the value of translateable fag |
boolean |
getUsesDatabase()
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and
rowIndex. |
boolean |
hasHeaderRow()
Indicates whether a header should be displayed |
void |
init(ModelListener listener)
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and
columnIndex
is editable. |
void |
removeTableModelListener(javax.swing.event.TableModelListener l)
Removes a listener from the list that is notified each time a change to the data model occurs. |
void |
set(java.lang.Object o)
Sets the value of the adapted model node. |
void |
setCellEditable(boolean state)
Set the editable state of the cell |
void |
setDataModel(DataModel src)
Sets the new model node to be adapted. |
void |
setHasHeaderRow(boolean state)
Sets whether a header should be displayed. |
void |
setModelListener(ModelListener listener)
|
void |
setOutputField(int fieldIdx)
Sets the index of the output field. |
void |
setTranslated(boolean tr)
Sets the value of translateable flag. |
void |
setUsesDatabase(boolean state)
|
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Sets the value in the cell at columnIndex and
rowIndex to aValue. |
void |
sync()
Force a sync/update of the table |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected DataModel model
protected int headerRow
protected boolean usesDatabase
protected int outputFieldIdx
protected java.util.Vector listeners
protected boolean translateable
protected Translator translator
protected DataModel rootModel
protected boolean editable
protected Project currentProject
protected ModelListener modelListener
protected java.lang.Object table
| Constructor Detail |
|---|
public TableModelAdapter(Project project)
project - the current project
public TableModelAdapter(Project project,
java.lang.Object c,
DataModel src)
TableModelAdpater
project - the current projectc - the table componentsrc - the model node to be adapted| Method Detail |
|---|
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic void setHasHeaderRow(boolean state)
state - true to display a header,
false otherwise.public boolean hasHeaderRow()
true to display a header,
false otherwise.public boolean getTranslated()
translateable fag
public void setTranslated(boolean tr)
translateable flag.
public boolean getUsesDatabase()
public void setUsesDatabase(boolean state)
public DataModel getAdaptedModel()
public int getColumnCount()
getColumnCount in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int rowIndex,
int columnIndex)
columnIndex and
rowIndex.
getValueAt in interface javax.swing.table.TableModelrowIndex - the row whose value is to be queriedcolumnIndex - the column whose value is to be queried
public void setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
columnIndex and
rowIndex to aValue.
setValueAt in interface javax.swing.table.TableModelaValue - the new valuerowIndex - the row whose value is to be changedcolumnIndex - the column whose value is to be changedgetValueAt(int, int),
isCellEditable(int, int)public java.lang.String getColumnName(int columnIndex)
getColumnName in interface javax.swing.table.TableModelcolumnIndex - the index of the column.
public java.lang.Object get(int i,
int fieldIdx)
i - The index of the listitemfieldIdx - the field index
public java.lang.Object get(int i)
get in interface ModelAdapteri - The index of the list itemfieldIdx - the field index
public int getNumChildren()
getNumChildren in interface ModelAdapterpublic void set(java.lang.Object o)
set in interface ModelAdaptero - the value to be set.public java.lang.Object getSelected()
getSelected in interface ModelAdapterpublic java.lang.Object getSelected(int fieldIdx)
fieldIdx - the index of the field
public void setOutputField(int fieldIdx)
fieldIdx - the new indexpublic void setDataModel(DataModel src)
setDataModel in interface ModelAdaptersrc - the new model node.public DataModel getDataModel()
getDataModel in interface ModelAdapter
public int find(java.lang.String key,
int keyColumnIdx)
key - the key to locatekeyColumnIdx - the index of the key column
public void sync()
public int getRowCount()
getRowCount in interface javax.swing.table.TableModelpublic java.lang.Class getColumnClass(int columnIndex)
JTable to set up a
default renderer and editor for the column.
getColumnClass in interface javax.swing.table.TableModelcolumnIndex - the index of the column
public boolean isCellEditable(int rowIndex,
int columnIndex)
rowIndex and
columnIndex
is editable. Otherwise, setValueAt on the cell will not
change the value of that cell. The cell is editable if its 'edit' attribute
is 'true'
isCellEditable in interface javax.swing.table.TableModelrowIndex - the row whose value to be queriedcolumnIndex - the column whose value to be queried
setValueAt(java.lang.Object, int, int)public void addTableModelListener(javax.swing.event.TableModelListener l)
addTableModelListener in interface javax.swing.table.TableModell - the TableModelListenerpublic void removeTableModelListener(javax.swing.event.TableModelListener l)
removeTableModelListener in interface javax.swing.table.TableModell - the TableModelListener
public void configure(java.util.Hashtable bindingConfig,
java.util.Hashtable instanceConfig)
configure in interface ModelAdapterConfigurablebindingConfig - the XML element which contains the binding configurationinstanceConfig - the XML element which contains the setup attributes of the binding instancepublic java.lang.Object getModelAt(int rowIndex)
rowIndex - the row index
public java.lang.Object getModelAt(int rowIndex,
int columnIndex)
rowIndex - the row indexcolumnIndex - the column indexpublic void setModelListener(ModelListener listener)
public void init(ModelListener listener)
public void setCellEditable(boolean state)
state - the new editable state
public java.lang.String getFieldName(int column,
java.lang.String field)
column - the column indexfield -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||