|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.swing.table.TableModelAdapter
org.formaria.swing.table.TablePojoModelAdapter
public class TablePojoModelAdapter
Adapts the PojoModel nodes for user with Table components.
Copyright (c) Formaria Ltd., 2008
License: see license.txt
| Field Summary | |
|---|---|
protected java.lang.String[] |
columns
|
protected java.util.Hashtable<java.lang.String,java.lang.String> |
displayField
|
protected boolean |
enabledByDefault
|
protected java.util.Hashtable<java.lang.String,java.lang.String> |
excludes
|
protected java.lang.String[] |
exclusions
|
protected java.lang.String[] |
fieldOrder
|
protected java.util.ArrayList<java.beans.PropertyDescriptor> |
fields
|
protected java.util.ArrayList<java.lang.String> |
paths
|
protected java.beans.PropertyDescriptor[] |
properties
|
protected java.util.Hashtable<java.lang.String,XmlElement> |
viewFields
|
protected XmlElement |
viewModel
|
protected java.util.ArrayList<java.lang.String> |
viewOrder
|
protected java.lang.String |
viewPath
|
| Fields inherited from class org.formaria.swing.table.TableModelAdapter |
|---|
currentProject, editable, headerRow, listeners, model, modelListener, outputFieldIdx, rootModel, table, translateable, translator, usesDatabase |
| Constructor Summary | |
|---|---|
TablePojoModelAdapter(Project project)
Creates a new instance of XTablePojoModelAdapter |
|
TablePojoModelAdapter(Project project,
java.lang.Object c,
DataModel src)
Creates a new instance of XPojoModelAdapter |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Create a copy of this adapter |
void |
configure(java.util.Hashtable bindingConfig,
java.util.Hashtable instanceConfig)
Retrieves the fieldOrder attribute's value from the binding
configuration specifying the underlying POJO's properties that should
be displayed in the bound |
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 idx)
Gets the name of the column at the specified position. |
java.lang.String[] |
getColumns()
Returns the column names that are to be shown in the XTable component. |
protected void |
getCompoundProperty(java.beans.PropertyDescriptor[] pp,
java.lang.String target,
java.lang.String fieldName)
Get the property descriptor corresponding to a compound path using '.' separators. |
protected void |
getCompoundProperty(java.beans.PropertyDescriptor properties,
java.lang.String target,
java.lang.String fieldName)
|
java.lang.Object |
getCompoundValueAt(int rowIndex,
java.lang.String target)
Gets the value at the specified table's cell. |
protected java.lang.String |
getDisplayName(int column,
java.lang.String fieldName,
java.lang.String defaultName)
Try to get the display name |
java.lang.String |
getFieldName(int column,
java.lang.String field)
Get the displayable field name |
int |
getNumChildren()
Gets the number of children of the encapsulated POJO model node. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Gets the value at the specified table's cell. |
java.lang.String |
getViewAttrib(int column,
java.lang.String fieldName,
java.lang.String attribName)
Get the view field attribute |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Indicates whether the specified cell is editable. |
protected boolean |
isFieldEnabled(java.lang.String fieldName)
|
protected boolean |
isFieldExcluded(java.lang.String name)
Is the field excluded from the form? |
protected boolean |
isFieldVisible(java.lang.String fieldName)
|
void |
loadDefaultViewFile(java.lang.Class objectClass)
Attempt to load the default view file. |
protected void |
retrieveColumnNames()
Retrieves column names that should be shown in a table. |
void |
set(java.lang.Object o)
Sets the value of the adapted model node. |
void |
setDataModel(DataModel src)
Sets the new model node to be adapted. |
void |
setValueAt(java.lang.Object value,
int rowIndex,
int columnIndex)
Sets the value at the specified table's cell. |
void |
setViewFile(java.lang.String resName)
Read the view file |
void |
setViewPath(java.lang.String path)
Read the view file |
| Methods inherited from class org.formaria.swing.table.TableModelAdapter |
|---|
addTableModelListener, find, get, get, getAdaptedModel, getDataModel, getModelAt, getModelAt, getRowCount, getSelected, getSelected, getTranslated, getUsesDatabase, hasHeaderRow, init, removeTableModelListener, setCellEditable, setHasHeaderRow, setModelListener, setOutputField, setTranslated, setUsesDatabase, sync |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String[] fieldOrder
protected java.lang.String[] exclusions
protected java.lang.String[] columns
protected java.util.ArrayList<java.lang.String> viewOrder
protected java.util.Hashtable<java.lang.String,java.lang.String> displayField
protected java.util.Hashtable<java.lang.String,java.lang.String> excludes
protected java.util.Hashtable<java.lang.String,XmlElement> viewFields
protected XmlElement viewModel
protected java.lang.String viewPath
protected java.util.ArrayList<java.beans.PropertyDescriptor> fields
protected java.util.ArrayList<java.lang.String> paths
protected boolean enabledByDefault
protected java.beans.PropertyDescriptor[] properties
| Constructor Detail |
|---|
public TablePojoModelAdapter(Project project)
XTablePojoModelAdapter
project - the current project.
public TablePojoModelAdapter(Project project,
java.lang.Object c,
DataModel src)
XPojoModelAdapter
project - the current project.c - the table componentsrc - the model node to be adapted.| Method Detail |
|---|
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class TableModelAdapterjava.lang.CloneNotSupportedExceptionpublic java.lang.String[] getColumns()
public int getNumChildren()
getNumChildren in interface ModelAdaptergetNumChildren in class TableModelAdapterpublic java.lang.String getColumnName(int idx)
getColumnName in interface javax.swing.table.TableModelgetColumnName in class TableModelAdaptercolumnIndex - the index of the column.
public int getColumnCount()
getColumnCount in interface javax.swing.table.TableModelgetColumnCount in class TableModelAdapterpublic java.lang.Class getColumnClass(int columnIndex)
JTable to set up a
default renderer and editor for the column.
getColumnClass in interface javax.swing.table.TableModelgetColumnClass in class TableModelAdaptercolumnIndex - the index of the column
public java.lang.Object getValueAt(int rowIndex,
int columnIndex)
getValueAt in interface javax.swing.table.TableModelgetValueAt in class TableModelAdapterrowIndex - the row of the cellcolumnIndex - the column of the cell
public java.lang.Object getCompoundValueAt(int rowIndex,
java.lang.String target)
rowIndex - the row of the cellcolumnIndex - the column of the cell
public boolean isCellEditable(int rowIndex,
int columnIndex)
isCellEditable in interface javax.swing.table.TableModelisCellEditable in class TableModelAdapterrowIndex - cell's rowcolumnIndex - cell's column
true if the cell is editable,
false otherwise.TableModelAdapter.setValueAt(java.lang.Object, int, int)
public void setValueAt(java.lang.Object value,
int rowIndex,
int columnIndex)
setValueAt in interface javax.swing.table.TableModelsetValueAt in class TableModelAdaptervalue - the value to be set.rowIndex - the row of the cell.columnIndex - the column of the cellTableModelAdapter.getValueAt(int, int),
TableModelAdapter.isCellEditable(int, int)
public void configure(java.util.Hashtable bindingConfig,
java.util.Hashtable instanceConfig)
fieldOrder attribute's value from the binding
configuration specifying the underlying POJO's properties that should
be displayed in the bound XTable component.
- Specified by:
configure in interface ModelAdapterConfigurable- Overrides:
configure in class TableModelAdapter
- Parameters:
bindingConfig - the XML element which contains the binding configurationinstanceConfig - the XML element which contains the setup attributes of the binding instance
public void set(java.lang.Object o)
set in interface ModelAdapterset in class TableModelAdaptero - the value to be set.public void setDataModel(DataModel src)
setDataModel in interface ModelAdaptersetDataModel in class TableModelAdaptersrc - the new model node.public void loadDefaultViewFile(java.lang.Class objectClass)
public void setViewFile(java.lang.String resName)
resName - public void setViewPath(java.lang.String path)
path - the name of the model path containing the viewprotected void retrieveColumnNames()
protected boolean isFieldExcluded(java.lang.String name)
name - the field/property name
protected boolean isFieldEnabled(java.lang.String fieldName)
protected boolean isFieldVisible(java.lang.String fieldName)
public java.lang.String getViewAttrib(int column,
java.lang.String fieldName,
java.lang.String attribName)
getViewAttrib in interface ViewProvidercolumn - the column indexfieldName - the field/property nameattribName - the name of the attribute
protected java.lang.String getDisplayName(int column,
java.lang.String fieldName,
java.lang.String defaultName)
column - the column indexfieldName - defaultName -
public java.lang.String getFieldName(int column,
java.lang.String field)
getFieldName in class TableModelAdaptercolumn - the column indexfield -
protected void getCompoundProperty(java.beans.PropertyDescriptor[] pp,
java.lang.String target,
java.lang.String fieldName)
throws java.beans.IntrospectionException
pp - target -
java.beans.IntrospectionException
protected void getCompoundProperty(java.beans.PropertyDescriptor properties,
java.lang.String target,
java.lang.String fieldName)
throws java.beans.IntrospectionException
java.beans.IntrospectionException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||