|
|||||||||
| Home >> All >> com >> pjsofts >> eurobudget >> [ beans overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.pjsofts.eurobudget.beans
Class BeanTableModel

java.lang.Objectjavax.swing.table.AbstractTableModel
com.pjsofts.eurobudget.beans.BeanTableModel
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.table.TableModel
- public class BeanTableModel
- extends javax.swing.table.AbstractTableModel
Simple Table model to display any bean in read only or write mode. Need to use it with a nice bean (got bean info ..) quite powerful already (editable, filterable (one column value), ...) Future: make it autosizable, find, goto,sortable, choose columns, save columns order...
| Nested Class Summary | |
private class |
BeanTableModel.BeanComparator
|
| Field Summary | |
private java.beans.BeanInfo |
beanInfo
|
private java.lang.String[] |
columns
contains the displayed columns order |
private java.beans.PropertyDescriptor[] |
descriptors
not hidden descriptors |
protected java.util.List |
filteredList
displayed list |
private static java.util.ResourceBundle |
i8n
|
protected java.util.List |
list
List of same Bean class, original list of beans |
private boolean |
tableEditable
is the whole table editable ?? |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
| Constructor Summary | |
BeanTableModel(java.util.List list,
boolean editable,
java.lang.Class beanClass)
|
|
| Method Summary | |
int |
addRow(java.lang.Object bean)
add a bean to the list |
void |
applyFilter(int col,
java.lang.Object value)
change the model structure to show only beans that got 'value' as 'column' |
void |
deleteRow(int row)
|
java.lang.Class |
getColumnClass(int c)
Returns the Class for all Object instances
in the specified column. |
int |
getColumnCount()
Returns the number of columns in the model. |
int |
getColumnIndex(java.lang.String attName)
convenient method |
java.lang.String |
getColumnName(int col)
Returns the name of the specified column. |
int |
getRowCount()
Returns the number of rows in the model. |
java.lang.Object |
getValueAt(int row,
int col)
Returns the value ( Object) at a particular cell in the
table. |
private void |
initStructureToBean(java.lang.Class beanClass)
|
boolean |
isCellEditable(int row,
int col)
Returns true if the specified cell is editable, and
false if it is not. |
int |
newRow()
create and @return line of a new bean (or -1 if error) |
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Sets the value in the cell at columnIndex and
rowIndex to aValue. |
void |
sortColumn(int col,
boolean ascending)
change the model structure to sort items on this column. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
list
protected java.util.List list
- List of same Bean class, original list of beans
filteredList
protected java.util.List filteredList
- displayed list
beanInfo
private java.beans.BeanInfo beanInfo
descriptors
private java.beans.PropertyDescriptor[] descriptors
- not hidden descriptors
columns
private java.lang.String[] columns
- contains the displayed columns order
tableEditable
private boolean tableEditable
- is the whole table editable ??
i8n
private static final java.util.ResourceBundle i8n
| Constructor Detail |
BeanTableModel
public BeanTableModel(java.util.List list, boolean editable, java.lang.Class beanClass)
| Method Detail |
initStructureToBean
private void initStructureToBean(java.lang.Class beanClass)
getColumnIndex
public int getColumnIndex(java.lang.String attName)
- convenient method
getRowCount
public int getRowCount()
- Description copied from interface:
javax.swing.table.TableModel - Returns the number of rows in the model.
getColumnCount
public int getColumnCount()
- Description copied from interface:
javax.swing.table.TableModel - Returns the number of columns in the model.
getValueAt
public java.lang.Object getValueAt(int row, int col)
- Description copied from interface:
javax.swing.table.TableModel - Returns the value (
Object) at a particular cell in the table.
getColumnName
public java.lang.String getColumnName(int col)
- Description copied from class:
javax.swing.table.AbstractTableModel - Returns the name of the specified column. This method generates default
names in a sequence (starting with column 0): A, B, C, ..., Z, AA, AB,
AC, ..., AZ, BA, BB, BC, and so on. Subclasses may override this method
to allow column names to be specified on some other basis.
getColumnClass
public java.lang.Class getColumnClass(int c)
- Description copied from class:
javax.swing.table.AbstractTableModel - Returns the
Classfor allObjectinstances in the specified column.
isCellEditable
public boolean isCellEditable(int row,
int col)
- Description copied from class:
javax.swing.table.AbstractTableModel - Returns
trueif the specified cell is editable, andfalseif it is not. This implementation returnsfalsefor all arguments, subclasses should override the method if necessary.
setValueAt
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
- Sets the value in the cell at
columnIndexandrowIndextoaValue.
newRow
public int newRow()
- create and @return line of a new bean (or -1 if error)
addRow
public int addRow(java.lang.Object bean)
- add a bean to the list
deleteRow
public void deleteRow(int row)
applyFilter
public void applyFilter(int col,
java.lang.Object value)
- change the model structure to show only beans that got 'value' as 'column'
sortColumn
public void sortColumn(int col,
boolean ascending)
- change the model structure to sort items on this column.
Stable sort.
Bean properties classes must support a Comparable interface
|
|||||||||
| Home >> All >> com >> pjsofts >> eurobudget >> [ beans overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC