jaxx.runtime.validator.swing
Class SwingValidatorMessageTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by jaxx.runtime.validator.swing.SwingValidatorMessageTableModel
All Implemented Interfaces:
Serializable, EventListener, TableModel, BeanValidatorListener

public class SwingValidatorMessageTableModel
extends AbstractTableModel
implements BeanValidatorListener

The model of the table of errors.

The model listens validators messages and update his internal model from it.

Since:
1.3
Author:
chemit
See Also:
Serialized Form

Field Summary
static Class<?>[] columnClasses
           
static String[] columnNames
           
protected  List<SwingValidatorMessage> data
          list of messages actual displayed
protected  List<SwingValidator<?>> validators
          list of registred validators
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
SwingValidatorMessageTableModel()
           
 
Method Summary
protected  void addMessages(JComponent editor, String fieldName, BeanValidatorScope scope, boolean sort, String... messages)
           
 void addMessages(JComponent editor, String fieldName, BeanValidatorScope scope, String... messages)
           
protected  void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean sort, String... messages)
           
 void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, String... messages)
           
protected  void addMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, boolean sort, String... messages)
           
 void addMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, String... messages)
           
 void clear()
           
protected  void ensureColumnIndex(int index)
           
protected  void ensureRowIndex(int rowIndex)
           
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
 SwingValidatorMessage getRow(int rowIndex)
          Obtain the message for a given row.
 int getRowCount()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int row, int column)
           
 void onFieldChanged(BeanValidatorEvent event)
          Invoked when a validator detects some changes on a field.
 void registerValidator(SwingValidator<?> validator)
          Register a validator for this model.
 void removeMessages(JComponent editor, BeanValidatorScope scope)
           
 void removeMessages(JComponent editor, String fieldName, BeanValidatorScope scope)
           
protected  void removeMessages(JComponent editor, String fieldName, BeanValidatorScope scope, boolean notify)
           
protected  void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean notify, String... messages)
           
 void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, String... messages)
           
protected  void removeMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, boolean notify, String... messages)
           
 void removeMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, String... messages)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnNames

public static final String[] columnNames

columnClasses

public static final Class<?>[] columnClasses

validators

protected transient List<SwingValidator<?>> validators
list of registred validators


data

protected List<SwingValidatorMessage> data
list of messages actual displayed

Constructor Detail

SwingValidatorMessageTableModel

public SwingValidatorMessageTableModel()
Method Detail

registerValidator

public void registerValidator(SwingValidator<?> validator)
Register a validator for this model.

Note: a validator can not be register twice in the same model.

Parameters:
validator - the validator to register

addMessages

public void addMessages(SwingValidator<?> validator,
                        String fieldName,
                        BeanValidatorScope scope,
                        String... messages)

addMessages

public void addMessages(JComponent editor,
                        String fieldName,
                        BeanValidatorScope scope,
                        String... messages)

addMessages

public void addMessages(SwingValidator<?> validator,
                        BeanValidatorField<?> field,
                        BeanValidatorScope scope,
                        String... messages)

removeMessages

public void removeMessages(JComponent editor,
                           BeanValidatorScope scope)

removeMessages

public void removeMessages(SwingValidator<?> validator,
                           String fieldName,
                           BeanValidatorScope scope,
                           String... messages)

removeMessages

public void removeMessages(JComponent editor,
                           String fieldName,
                           BeanValidatorScope scope)

removeMessages

public void removeMessages(SwingValidator<?> validator,
                           BeanValidatorField<?> field,
                           BeanValidatorScope scope,
                           String... messages)

clear

public void clear()

getRow

public SwingValidatorMessage getRow(int rowIndex)
Obtain the message for a given row.

Parameters:
rowIndex - the row index
Returns:
the message for the given row index

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

onFieldChanged

public void onFieldChanged(BeanValidatorEvent event)
Description copied from interface: BeanValidatorListener
Invoked when a validator detects some changes on a field.

Specified by:
onFieldChanged in interface BeanValidatorListener
Parameters:
event - the event

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

ensureRowIndex

protected void ensureRowIndex(int rowIndex)
                       throws ArrayIndexOutOfBoundsException
Throws:
ArrayIndexOutOfBoundsException

ensureColumnIndex

protected void ensureColumnIndex(int index)
                          throws ArrayIndexOutOfBoundsException
Throws:
ArrayIndexOutOfBoundsException

addMessages

protected void addMessages(SwingValidator<?> validator,
                           BeanValidatorField<?> field,
                           BeanValidatorScope scope,
                           boolean sort,
                           String... messages)

addMessages

protected void addMessages(SwingValidator<?> validator,
                           String fieldName,
                           BeanValidatorScope scope,
                           boolean sort,
                           String... messages)

addMessages

protected void addMessages(JComponent editor,
                           String fieldName,
                           BeanValidatorScope scope,
                           boolean sort,
                           String... messages)

removeMessages

protected void removeMessages(SwingValidator<?> validator,
                              BeanValidatorField<?> field,
                              BeanValidatorScope scope,
                              boolean notify,
                              String... messages)

removeMessages

protected void removeMessages(SwingValidator<?> validator,
                              String fieldName,
                              BeanValidatorScope scope,
                              boolean notify,
                              String... messages)

removeMessages

protected void removeMessages(JComponent editor,
                              String fieldName,
                              BeanValidatorScope scope,
                              boolean notify)


Copyright © 2008-2010 CodeLutin. All Rights Reserved.