org.wings
Class SDefaultCellEditor

java.lang.Object
  extended by org.wings.SDefaultCellEditor
All Implemented Interfaces:
Serializable, CellEditor, STableCellEditor

public class SDefaultCellEditor
extends Object
implements STableCellEditor

Default table cell editor.

Author:
Holger Engels
See Also:
Serialized Form

Nested Class Summary
protected  class SDefaultCellEditor.EditorDelegate
          The interface all editing boils down to: setting the value for the editor and retrieve its value.
 
Field Summary
protected  SClickable cancel
          If this button is pressed, editing is canceled.
protected  SDefaultCellEditor.EditorDelegate delegate
           
protected  SComponent editorComponent
           
protected  org.wings.SDefaultCellEditor.EditorPanel editorPanel
          Panel for edit fields.
protected  EventListenerList listenerList
          Store here the CellEditorListener
protected  SLabel messageLabel
          Label for displaying (error)-messages.
protected  SClickable ok
          If this button is pressed, editing is tried to stop.
 
Constructor Summary
  SDefaultCellEditor(SCheckBox x)
          Constructs a DefaultCellEditor object that uses a check box.
protected SDefaultCellEditor(SComponent editorComponent, boolean initializeButtons)
          Initialize the DefaultCellEditor with an editor component (like an text field for instance).
  SDefaultCellEditor(STextField x)
          Constructs a DefaultCellEditor that uses a text field.
 
Method Summary
 void addCellEditorListener(CellEditorListener l)
           
 void cancelCellEditing()
           
protected  void fireEditingCanceled()
           
protected  void fireEditingStopped()
           
 SClickable getCancelButton()
           
 Object getCellEditorValue()
           
 SComponent getComponent()
          Returns a reference to the editor component.
 boolean getFastEdit()
          Return if fast edit is activated.
 SClickable getOKButton()
           
 SComponent getTableCellEditorComponent(STable table, Object value, boolean isSelected, int row, int column)
           
 SComponent getTreeCellEditorComponent(STree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
           
protected  void initButtons()
          Intializes the buttons with default icons, tooltip text and listener.
 boolean isCellEditable(EventObject anEvent)
           
 void removeCellEditorListener(CellEditorListener l)
           
 void setFastEdit(boolean b)
          Fast edit support is editing with reduced interaction.
 boolean shouldSelectCell(EventObject anEvent)
           
 boolean stopCellEditing()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageLabel

protected final SLabel messageLabel
Label for displaying (error)-messages. It is unvisible, until a message is set.


editorPanel

protected final org.wings.SDefaultCellEditor.EditorPanel editorPanel
Panel for edit fields.


ok

protected final SClickable ok
If this button is pressed, editing is tried to stop. If input validation found no error, editing is stopped, else an error message is displayed


cancel

protected final SClickable cancel
If this button is pressed, editing is canceled.


listenerList

protected final EventListenerList listenerList
Store here the CellEditorListener


delegate

protected SDefaultCellEditor.EditorDelegate delegate

editorComponent

protected SComponent editorComponent
Constructor Detail

SDefaultCellEditor

protected SDefaultCellEditor(SComponent editorComponent,
                             boolean initializeButtons)
Initialize the DefaultCellEditor with an editor component (like an text field for instance). After calling this constructor, the SDefaultCellEditor.EditorDelegate, that links the CellEditor and the editorComponent has to be passed to the delegate instance variable.

Parameters:
editorComponent - the component used
initializeButtons - flag to indicate if the button texts and icons should be initialized.

SDefaultCellEditor

public SDefaultCellEditor(STextField x)
Constructs a DefaultCellEditor that uses a text field.

Parameters:
x - a STextField object ...

SDefaultCellEditor

public SDefaultCellEditor(SCheckBox x)
Constructs a DefaultCellEditor object that uses a check box.

Parameters:
x - a SCheckBox object ...
Method Detail

initButtons

protected void initButtons()
Intializes the buttons with default icons, tooltip text and listener.


getComponent

public final SComponent getComponent()
Returns a reference to the editor component.

Returns:
the editor Component

getOKButton

public final SClickable getOKButton()

getCancelButton

public final SClickable getCancelButton()

setFastEdit

public final void setFastEdit(boolean b)
Fast edit support is editing with reduced interaction. E.g. a boolean value can only have to states, true or false. So if editing is started, the editor just flips the state and fires editing stopped.

Parameters:
b - a boolean value

getFastEdit

public final boolean getFastEdit()
Return if fast edit is activated.

Returns:
a boolean value
See Also:
setFastEdit(boolean)

getCellEditorValue

public Object getCellEditorValue()
Specified by:
getCellEditorValue in interface CellEditor

isCellEditable

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

shouldSelectCell

public boolean shouldSelectCell(EventObject anEvent)
Specified by:
shouldSelectCell in interface CellEditor

stopCellEditing

public boolean stopCellEditing()
Specified by:
stopCellEditing in interface CellEditor

cancelCellEditing

public void cancelCellEditing()
Specified by:
cancelCellEditing in interface CellEditor

addCellEditorListener

public void addCellEditorListener(CellEditorListener l)
Specified by:
addCellEditorListener in interface CellEditor

removeCellEditorListener

public void removeCellEditorListener(CellEditorListener l)
Specified by:
removeCellEditorListener in interface CellEditor

fireEditingStopped

protected void fireEditingStopped()

fireEditingCanceled

protected void fireEditingCanceled()

getTreeCellEditorComponent

public SComponent getTreeCellEditorComponent(STree tree,
                                             Object value,
                                             boolean isSelected,
                                             boolean expanded,
                                             boolean leaf,
                                             int row)

getTableCellEditorComponent

public SComponent getTableCellEditorComponent(STable table,
                                              Object value,
                                              boolean isSelected,
                                              int row,
                                              int column)
Specified by:
getTableCellEditorComponent in interface STableCellEditor


wingS Swings ;-)