JIDE 3.5.15

com.jidesoft.grid
Class AbstractJideCellEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by com.jidesoft.grid.AbstractJideCellEditor
All Implemented Interfaces:
JideCellEditor, Serializable, CellEditor
Direct Known Subclasses:
ContextSensitiveCellEditor

public abstract class AbstractJideCellEditor
extends AbstractCellEditor
implements JideCellEditor

AbstractJideCellEditor adds the validation support to AbstractCellEditor.

See Also:
Serialized Form

Field Summary
protected  int _clickCountToStart
          An integer specifying the number of clicks needed to start editing.
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
AbstractJideCellEditor()
           
 
Method Summary
 void addValidationListener(Validator l)
          Adds a Validator to the listener list.
 int getClickCountToStart()
          Returns the number of clicks needed to start editing.
 int getDefaultErrorBehavior()
          Gets the default validation error behavior.
 Validator[] getValidationListeners()
          Returns an array of all the Validators added to this AbstractCellEditor with addValidationListener().
 boolean isAutoStopCellEditing()
          Checks if the cell editor will stop editing when value is changed.
 boolean isCellEditable(EventObject anEvent)
           
 boolean isPassEnterKeyToTable()
          Checks if the ENTER key should be delegated to the table.
 void removeValidationListener(Validator l)
          Removes a Validator from the listener list.
 void setAutoStopCellEditing(boolean autoStopCellEditing)
          Sets the flag if the cell editor will stop editing when value is changed.
 void setClickCountToStart(int count)
          Specifies the number of clicks needed to start editing.
 void setDefaultErrorBehavior(int defaultErrorBehavior)
          Sets the default validation error behavior.
 void setPassEnterKeyToTable(boolean passEnterKeyToTable)
          If this flag is set to true, the editor should pass the ENTER key to the table after it is processed.
 ValidationResult validate(Object oldValue, Object newValue)
          Returns the state after validation.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener, shouldSelectCell, stopCellEditing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.CellEditor
addCellEditorListener, cancelCellEditing, getCellEditorValue, removeCellEditorListener, shouldSelectCell, stopCellEditing
 

Field Detail

_clickCountToStart

protected int _clickCountToStart
An integer specifying the number of clicks needed to start editing. Even if clickCountToStart is defined as zero, it will not initiate until a click occurs.

Constructor Detail

AbstractJideCellEditor

public AbstractJideCellEditor()
Method Detail

isCellEditable

public boolean isCellEditable(EventObject anEvent)
Specified by:
isCellEditable in interface CellEditor
Overrides:
isCellEditable in class AbstractCellEditor

setClickCountToStart

public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.

Parameters:
count - an int specifying the number of clicks needed to start editing
See Also:
getClickCountToStart()

getClickCountToStart

public int getClickCountToStart()
Returns the number of clicks needed to start editing.

Returns:
the number of clicks needed to start editing

addValidationListener

public void addValidationListener(Validator l)
Adds a Validator to the listener list.

Parameters:
l - the new listener to be added

removeValidationListener

public void removeValidationListener(Validator l)
Removes a Validator from the listener list.

Parameters:
l - the listener to be removed

getValidationListeners

public Validator[] getValidationListeners()
Returns an array of all the Validators added to this AbstractCellEditor with addValidationListener().

Returns:
all of the Validators added or an empty array if no listeners have been added
Since:
1.4

validate

public ValidationResult validate(Object oldValue,
                                 Object newValue)
Returns the state after validation.

Specified by:
validate in interface JideCellEditor
Parameters:
oldValue - the old value
newValue - the new value
Returns:
ValidateState. If it's null, it means validation passed. Only when the validation fails, it returns ValidationState.

getDefaultErrorBehavior

public int getDefaultErrorBehavior()
Gets the default validation error behavior. The valid values are ValidationResult.FAIL_BEHAVIOR_PERSIST, ValidationResult.FAIL_BEHAVIOR_RESET, and ValidationResult.FAIL_BEHAVIOR_REVERT. For example, in DateCellEditor, this is used when the date entered by user is out of the range of valid dates as defined in DateModel.

Returns:
the default validation error behavior.

setDefaultErrorBehavior

public void setDefaultErrorBehavior(int defaultErrorBehavior)
Sets the default validation error behavior. The valid values are ValidationResult.FAIL_BEHAVIOR_PERSIST, ValidationResult.FAIL_BEHAVIOR_RESET, and ValidationResult.FAIL_BEHAVIOR_REVERT. For example, in DateCellEditor, this is used when the date entered by user is out of the range of valid dates as defined in DateModel. By default, the valid is ValidationResult.ERROR_BEHAVIOR_REVERT.

Parameters:
defaultErrorBehavior - the default error behavior.

isAutoStopCellEditing

public boolean isAutoStopCellEditing()
Checks if the cell editor will stop editing when value is changed. Default is true.

Returns:
true if the cell editor will stop editing. Otherwise false.

setAutoStopCellEditing

public void setAutoStopCellEditing(boolean autoStopCellEditing)
Sets the flag if the cell editor will stop editing when value is changed.

Parameters:
autoStopCellEditing - true or false.

isPassEnterKeyToTable

public boolean isPassEnterKeyToTable()
Checks if the ENTER key should be delegated to the table.

Returns:
true or false.

setPassEnterKeyToTable

public void setPassEnterKeyToTable(boolean passEnterKeyToTable)
If this flag is set to true, the editor should pass the ENTER key to the table after it is processed. The reason for this is to save one ENTER key. Otherwise user has to press ENTER to stop cell editing first, then press ENTER key again to go to the next cell in the same column (such as in PropertyTable case).

Parameters:
passEnterKeyToTable - true or false.

JIDE 3.5.15