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
IXTableModel
implementation 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 void
addTableModelListener(javax.swing.event.TableModelListener l)
int
getChunkSize()
java.lang.Class
getColumnClass(int columnIndex)
int
getColumnCount()
java.lang.String
getColumnName(int columnIndex)
java.lang.String[]
getColumnsClasses()
IEntityTabImpl
getEntityTab()
java.lang.String[]
getHeading()
java.lang.Object
getObjectAt(int rowIndex)
Return the object associated to indicated row.int[]
getPKIndexes()
Indexes of columns that contains the primary key.java.util.List
getPropertiesNames()
int
getRowCount()
java.lang.Number
getSum(java.lang.String property)
int
getTotalSize()
Total count of objects represented by this table model.java.lang.Object
getValueAt(int rowIndex, int columnIndex)
void
invariant()
Verify object invariant.boolean
isAllLoaded()
boolean
isCellEditable(int rowIndex, int columnIndex)
boolean
isTranslateHeading()
If true tries to translate the heading.void
refresh()
Refresh data from datasource.void
removeAllRows()
void
removeRow(java.util.Map keyValues)
void
removeTableModelListener(javax.swing.event.TableModelListener l)
void
setColumnsClasses(java.lang.String[] columnsClasses)
void
setEntityTab(IEntityTabImpl entityTab)
void
setHeading(java.lang.String[] heading)
void
setPKIndexes(int[] indicesPK)
Indexes of columns that contains the primary key.void
setPropertiesNames(java.util.List propertiesNames)
void
setTranslateHeading(boolean b)
void
setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
java.lang.String
toString()
Return TablaModelBean> Rows: x, Columns: x.
-
-
-
Method Detail
-
addTableModelListener
public void addTableModelListener(javax.swing.event.TableModelListener l)
- Specified by:
addTableModelListener
in 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:
getColumnClass
in interfacejavax.swing.table.TableModel
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
-
getColumnName
public java.lang.String getColumnName(int columnIndex)
- Specified by:
getColumnName
in 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.FinderException
Description copied from interface:IObjectTableModel
Return the object associated to indicated row.- Specified by:
getObjectAt
in interfaceIObjectTableModel
- Specified by:
getObjectAt
in interfaceIXTableModel
- Throws:
javax.ejb.FinderException
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
-
getValueAt
public java.lang.Object getValueAt(int rowIndex, int columnIndex) throws java.util.NoSuchElementException
- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- Throws:
java.util.NoSuchElementException
-
invariant
public void invariant() throws java.lang.IllegalStateException
Verify 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:
isCellEditable
in interfacejavax.swing.table.TableModel
-
refresh
public void refresh()
Description copied from interface:IRefreshTableModel
Refresh data from datasource.- Specified by:
refresh
in interfaceIRefreshTableModel
- Specified by:
refresh
in interfaceIXTableModel
-
removeAllRows
public void removeAllRows()
- Specified by:
removeAllRows
in interfaceIXTableModel
-
removeTableModelListener
public void removeTableModelListener(javax.swing.event.TableModelListener l)
- Specified by:
removeTableModelListener
in 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:
setValueAt
in interfacejavax.swing.table.TableModel
-
toString
public java.lang.String toString()
Return TablaModelBean> Rows: x, Columns: x.- Overrides:
toString
in classjava.lang.Object
-
getTotalSize
public int getTotalSize() throws java.rmi.RemoteException
Description copied from interface:IXTableModel
Total 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:
getTotalSize
in interfaceIXTableModel
- Throws:
java.rmi.RemoteException
-
getSum
public java.lang.Number getSum(java.lang.String property) throws java.rmi.RemoteException
- Specified by:
getSum
in 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:
removeRow
in interfaceIXTableModel
- Throws:
javax.ejb.FinderException
-
getChunkSize
public int getChunkSize()
- Specified by:
getChunkSize
in interfaceIXTableModel
- Since:
- 5.7
-
isAllLoaded
public boolean isAllLoaded()
- Specified by:
isAllLoaded
in interfaceIXTableModel
- Since:
- 5.7
-
-