Class ValidatedBeanListTableModel<T>
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- io.github.jonestimd.swing.table.model.BeanListTableModel<T>
-
- io.github.jonestimd.swing.table.model.BufferedBeanListTableModel<T>
-
- io.github.jonestimd.swing.table.model.ValidatedBeanListTableModel<T>
-
- All Implemented Interfaces:
ChangeBuffer
,BeanTableModel<T>
,ChangeBufferTableModel<T>
,ColumnIdentifier
,ValidatedTableModel
,java.io.Serializable
,javax.swing.table.TableModel
public class ValidatedBeanListTableModel<T> extends BufferedBeanListTableModel<T> implements ValidatedTableModel
ExtendsBufferedBeanListTableModel
to add validation.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class io.github.jonestimd.swing.table.model.BeanListTableModel
beanTableAdapter
-
-
Constructor Summary
Constructors Constructor Description ValidatedBeanListTableModel(java.util.List<? extends ColumnAdapter<? super T,?>> columnAdapters)
ValidatedBeanListTableModel(java.util.List<? extends ColumnAdapter<? super T,?>> columnAdapters, java.lang.Iterable<? extends TableDataProvider<T>> dataProviders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRow(int rowIndex, T bean)
void
fireTableCellUpdated(int rowIndex, int columnIndex)
void
fireTableRowsDeleted(int firstRow, int lastRow)
void
fireTableRowsUpdated(int firstRow, int lastRow)
boolean
isNoErrors()
void
setBeans(java.util.Collection<T> beans)
Replace all rows of the table model.java.lang.String
validateAt(int rowIndex, int columnIndex)
<V> java.lang.String
validateAt(int rowIndex, int columnIndex, V value)
protected void
validateCell(int rowIndex, int columnIndex)
protected void
validateRow(int rowIndex)
-
Methods inherited from class io.github.jonestimd.swing.table.model.BufferedBeanListTableModel
commit, getChangedRows, getPendingAdds, getPendingDeletes, getPendingUpdates, isCellEditable, isChanged, isChangedAt, isPendingAdd, isPendingDelete, queueAdd, queueAdd, queueDelete, revert, setRow, setValue, undoChangedAt, undoDelete
-
Methods inherited from class io.github.jonestimd.swing.table.model.BeanListTableModel
addRow, getBean, getBeanCount, getBeans, getColumnAdapter, getColumnClass, getColumnCount, getColumnIdentifier, getColumnName, getCursor, getRow, getRowCount, getValue, getValueAt, handleClick, indexOf, notifyDataProviders, removeAll, removeRow, removeRowAt, setValueAt, updateBeans
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableChanged, fireTableDataChanged, fireTableRowsInserted, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.jonestimd.swing.table.model.BeanTableModel
getBean, getBeanCount, getCursor, getValue, handleClick, updateBeans
-
Methods inherited from interface io.github.jonestimd.swing.table.model.ColumnIdentifier
getColumnIdentifier
-
-
-
-
Constructor Detail
-
ValidatedBeanListTableModel
public ValidatedBeanListTableModel(java.util.List<? extends ColumnAdapter<? super T,?>> columnAdapters)
-
ValidatedBeanListTableModel
public ValidatedBeanListTableModel(java.util.List<? extends ColumnAdapter<? super T,?>> columnAdapters, java.lang.Iterable<? extends TableDataProvider<T>> dataProviders)
-
-
Method Detail
-
setBeans
public void setBeans(java.util.Collection<T> beans)
Description copied from interface:BeanTableModel
Replace all rows of the table model.- Specified by:
setBeans
in interfaceBeanTableModel<T>
- Overrides:
setBeans
in classBufferedBeanListTableModel<T>
- Parameters:
beans
- the new rows
-
addRow
public void addRow(int rowIndex, T bean)
- Overrides:
addRow
in classBeanListTableModel<T>
-
validateRow
protected void validateRow(int rowIndex)
-
validateCell
protected void validateCell(int rowIndex, int columnIndex)
-
validateAt
public java.lang.String validateAt(int rowIndex, int columnIndex)
- Specified by:
validateAt
in interfaceValidatedTableModel
- Returns:
- error messages or
null
if current value valid.
-
validateAt
public <V> java.lang.String validateAt(int rowIndex, int columnIndex, V value)
- Specified by:
validateAt
in interfaceValidatedTableModel
- Returns:
- error message or
null
if specified value is valid.
-
isNoErrors
public boolean isNoErrors()
- Specified by:
isNoErrors
in interfaceValidatedTableModel
- Returns:
- true if there are no validation errors.
-
fireTableCellUpdated
public void fireTableCellUpdated(int rowIndex, int columnIndex)
- Overrides:
fireTableCellUpdated
in classjavax.swing.table.AbstractTableModel
-
fireTableRowsUpdated
public void fireTableRowsUpdated(int firstRow, int lastRow)
- Overrides:
fireTableRowsUpdated
in classjavax.swing.table.AbstractTableModel
-
fireTableRowsDeleted
public void fireTableRowsDeleted(int firstRow, int lastRow)
- Overrides:
fireTableRowsDeleted
in classjavax.swing.table.AbstractTableModel
-
-