Package org.openxava.tab.impl
Class TableModelBean
- java.lang.Object
-
- org.openxava.tab.impl.TableModelBean
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.table.TableModel,IObjectTableModel,IRefreshTableModel,IXTableModel
public class TableModelBean extends java.lang.Object implements IXTableModel, java.io.Serializable
IXTableModelimplementation in JavaBean format.It's a read only
TableModel.
Call toinvariant()before use.- Author:
- Javier Paniza
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TableModelBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTableModelListener(javax.swing.event.TableModelListener l)intgetChunkSize()java.lang.ClassgetColumnClass(int columnIndex)intgetColumnCount()java.lang.StringgetColumnName(int columnIndex)java.lang.String[]getColumnsClasses()IEntityTabImplgetEntityTab()java.lang.String[]getHeading()java.lang.ObjectgetObjectAt(int rowIndex)Return the object associated to indicated row.int[]getPKIndexes()Indexes of columns that contains the primary key.java.util.ListgetPropertiesNames()intgetRowCount()java.lang.NumbergetSum(java.lang.String property)intgetTotalSize()Total count of objects represented by this table model.java.lang.ObjectgetValueAt(int rowIndex, int columnIndex)voidinvariant()Verify object invariant.booleanisAllLoaded()booleanisCellEditable(int rowIndex, int columnIndex)booleanisTranslateHeading()If true tries to translate the heading.voidrefresh()Refresh data from datasource.voidremoveAllRows()voidremoveRow(java.util.Map keyValues)voidremoveTableModelListener(javax.swing.event.TableModelListener l)voidsetColumnsClasses(java.lang.String[] columnsClasses)voidsetEntityTab(IEntityTabImpl entityTab)voidsetHeading(java.lang.String[] heading)voidsetPKIndexes(int[] indicesPK)Indexes of columns that contains the primary key.voidsetPropertiesNames(java.util.List propertiesNames)voidsetTranslateHeading(boolean b)voidsetValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)java.lang.StringtoString()Return TablaModelBean> Rows: x, Columns: x.
-
-
-
Method Detail
-
addTableModelListener
public void addTableModelListener(javax.swing.event.TableModelListener l)
- Specified by:
addTableModelListenerin interfacejavax.swing.table.TableModel
-
getHeading
public java.lang.String[] getHeading()
-
getColumnsClasses
public java.lang.String[] getColumnsClasses()
-
getColumnClass
public java.lang.Class getColumnClass(int columnIndex)
- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel
-
getColumnName
public java.lang.String getColumnName(int columnIndex)
- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel
-
getEntityTab
public IEntityTabImpl getEntityTab()
-
getPKIndexes
public int[] getPKIndexes()
Indexes of columns that contains the primary key.
Primary key is used for create the object associated to row.
-
getObjectAt
public java.lang.Object getObjectAt(int rowIndex) throws javax.ejb.FinderExceptionDescription copied from interface:IObjectTableModelReturn the object associated to indicated row.- Specified by:
getObjectAtin interfaceIObjectTableModel- Specified by:
getObjectAtin interfaceIXTableModel- Throws:
javax.ejb.FinderException
-
getRowCount
public int getRowCount()
- Specified by:
getRowCountin interfacejavax.swing.table.TableModel
-
getValueAt
public java.lang.Object getValueAt(int rowIndex, int columnIndex) throws java.util.NoSuchElementException- Specified by:
getValueAtin interfacejavax.swing.table.TableModel- Throws:
java.util.NoSuchElementException
-
invariant
public void invariant() throws java.lang.IllegalStateExceptionVerify object invariant.
Invariant:- headers != null
- entityTab != null
- indexesPK != null
- Throws:
java.lang.IllegalStateException- If invariant is broken
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel
-
refresh
public void refresh()
Description copied from interface:IRefreshTableModelRefresh data from datasource.- Specified by:
refreshin interfaceIRefreshTableModel- Specified by:
refreshin interfaceIXTableModel
-
removeAllRows
public void removeAllRows()
- Specified by:
removeAllRowsin interfaceIXTableModel
-
removeTableModelListener
public void removeTableModelListener(javax.swing.event.TableModelListener l)
- Specified by:
removeTableModelListenerin interfacejavax.swing.table.TableModel
-
setHeading
public void setHeading(java.lang.String[] heading)
-
setColumnsClasses
public void setColumnsClasses(java.lang.String[] columnsClasses)
-
setEntityTab
public void setEntityTab(IEntityTabImpl entityTab)
-
setPKIndexes
public void setPKIndexes(int[] indicesPK)
Indexes of columns that contains the primary key.
Primary key is used for create the object associated to row.
-
setValueAt
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)- Specified by:
setValueAtin interfacejavax.swing.table.TableModel
-
toString
public java.lang.String toString()
Return TablaModelBean> Rows: x, Columns: x.- Overrides:
toStringin classjava.lang.Object
-
getTotalSize
public int getTotalSize() throws java.rmi.RemoteExceptionDescription copied from interface:IXTableModelTotal count of objects represented by this table model.Cantidad de objetos total representados por el table model.
getRowCount()in another side, return the loaded objects count, not total.- Specified by:
getTotalSizein interfaceIXTableModel- Throws:
java.rmi.RemoteException
-
getSum
public java.lang.Number getSum(java.lang.String property) throws java.rmi.RemoteException- Specified by:
getSumin interfaceIXTableModel- Throws:
java.rmi.RemoteException
-
isTranslateHeading
public boolean isTranslateHeading()
If true tries to translate the heading.If a dot is found in heading label assume resourceFile.nombreId.
For example, if the label is MyAplicationResources.plazo then find in MyAplicationResources resource bundle the identifier plazo.
If no dot the take the label as is.
Of course, if this properti is false do nothing.
By default is true
-
setTranslateHeading
public void setTranslateHeading(boolean b)
-
setPropertiesNames
public void setPropertiesNames(java.util.List propertiesNames)
-
getPropertiesNames
public java.util.List getPropertiesNames()
-
removeRow
public void removeRow(java.util.Map keyValues) throws javax.ejb.FinderException- Specified by:
removeRowin interfaceIXTableModel- Throws:
javax.ejb.FinderException
-
getChunkSize
public int getChunkSize()
- Specified by:
getChunkSizein interfaceIXTableModel- Since:
- 5.7
-
isAllLoaded
public boolean isAllLoaded()
- Specified by:
isAllLoadedin interfaceIXTableModel- Since:
- 5.7
-
-