|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eointerface.swing.EOColumnEditor
EOColumnEditor is an abstract class that implements generalized cell editing management for javax.swing.JTables
.
Swing specifies that JTable cell editing is performed by an object implementing the javax.swing.table.TableCellEditor
interface.
EOColumnEditor implements this interface in a generalized way, and concrete subclasses such as EOTextColumnEditor
perform component-specific instantiation and event communication.
EOColumnEditor is used together with EOTableColumnAssociation to allow editing of values displayed in tables. The most important function of an EOColumnEditor instance is mediating between its Component and the EOTableColumnAssociation that's bound to the edited column. This mediation enables the validation of edited values that associations are required to perform.
Create a subclass of EOColumnEditor if you want to use a Component for JTable editing for which no EOColumnEditor is implemented.
EOTextColumnEditor
Constructor Summary | |
EOColumnEditor()
Constructs a new EOColumnEditor. |
Method Summary | |
void |
addCellEditorListener(CellEditorListener listener)
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor method to add a
listener to the list that's notified when the editor starts, stops or cancels editing. |
protected void |
beginEditing()
Invoked from shouldSelectCell and getTableCellEditorComponent to inform the receiver that it should begin editing. |
void |
cancelCellEditing()
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor method to cancel editing. |
protected abstract Component |
createEditorComponent()
Creates and returns a Component to perform the editing -- a JTextField or JComboBox, for example. |
EOTableColumnAssociation |
editingTableColumnAssociation()
Returns the EOTableColumnAssociation that's bound to the column being edited (the column is cached in EOColumnEditor's implementation of shouldSelectCell and getTableCellEditorComponent ). |
Component |
editorComponent()
Returns the receiver's editor Component -- a user interface control that implements the editing mechanism. |
protected void |
endEditing()
Invoked from cancelCellEditing and stopCellEditing to inform
the receiver that it should end editing. |
protected void |
fireEditingCanceled()
Sends editingCanceled to all cell editor listeners registered with the column editor. |
protected void |
fireEditingStopped()
Sends editingStopped to all cell editor listeners registered with the column editor. |
Object |
getCellEditorValue()
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor method to return the current value in the editor. |
Component |
getTableCellEditorComponent(JTable table,
Object initialValue,
boolean isSelected,
int rowIndex,
int columnIndex)
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor method to set an inital value for the editor. |
boolean |
isCellEditable(EventObject event)
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor method to determine whether a cell can start editing. |
void |
removeCellEditorListener(CellEditorListener listener)
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor method to remove a
listener from the list that's notified when the editor starts, stops or cancels editing. |
protected abstract void |
setCellEditorValue(Object value)
Invoked from getTableCellEditorComponent to assign value as the inital editor value. |
void |
setEditorComponent(Component editorComponent)
Sets the receiver's editor component to editorComponent . |
boolean |
shouldSelectCell(EventObject event)
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor
method to determine whether a cell should be selected when edited or not. |
boolean |
stopCellEditing()
EOColumnEditor's implementation of the javax.swing.table.TableCellEditor method to finish and accept editing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EOColumnEditor()
Method Detail |
public void addCellEditorListener(CellEditorListener listener)
javax.swing.table.TableCellEditor
method to add a
listener to the list that's notified when the editor starts, stops or cancels editing.
addCellEditorListener
in interface CellEditor
listener
- protected void beginEditing()
widgetDidBeginEditing
to the EOTableColumnAssociation that's bound to the receiver's TableColumn.
Subclasses should invoke super's implementation after activating their editor Component.
shouldSelectCell(java.util.EventObject)
,
getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
public void cancelCellEditing()
javax.swing.table.TableCellEditor
method to cancel editing.
cancelCellEditing
in interface CellEditor
protected abstract Component createEditorComponent()
public EOTableColumnAssociation editingTableColumnAssociation()
shouldSelectCell
and getTableCellEditorComponent
).
shouldSelectCell(java.util.EventObject)
,
getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
public Component editorComponent()
createEditorComponent
).
createEditorComponent()
protected void endEditing()
cancelCellEditing
and stopCellEditing
to inform
the receiver that it should end editing. EOColumnEditor's implementation sends widgetDidEndEditing
to the EOTableColumnAssociation that's bound to the receiver's TableColumn.
Subclasses should invoke super
's implementation after deactivating their editor Component.
cancelCellEditing()
,
stopCellEditing()
protected void fireEditingCanceled()
editingCanceled
to all cell editor listeners registered with the column editor.
protected void fireEditingStopped()
editingStopped
to all cell editor listeners registered with the column editor.
public Object getCellEditorValue()
javax.swing.table.TableCellEditor
method to return the current value in the editor.
Simply returns null
, so subclasses should override this method.
getCellEditorValue
in interface CellEditor
public Component getTableCellEditorComponent(JTable table, Object initialValue, boolean isSelected, int rowIndex, int columnIndex)
javax.swing.table.TableCellEditor
method to set an inital value for the editor.
Sets the initial editor value through setCellEditorValue
and invokes beginEditing
.
EOColumnEditor creates the component in the constructor (through the method createEditorComponent
).
getTableCellEditorComponent
in interface TableCellEditor
table
- the JTable asking the editor to editinitialValue
- the value of the cell to be editedisSelected
- true
if the cell is to be rendered with highlightingrowIndex
- the row of the cell being editedcolumnIndex
- the column of the cell being edited
setCellEditorValue(java.lang.Object)
,
beginEditing()
,
createEditorComponent()
public boolean isCellEditable(EventObject event)
javax.swing.table.TableCellEditor
method to determine whether a cell can start editing.
Returns false
so that by default all EOColumnEditors do not start editing.
isCellEditable
in interface CellEditor
event
- the event to be used by the editor to consider whether editing can start or not
public void removeCellEditorListener(CellEditorListener listener)
javax.swing.table.TableCellEditor
method to remove a
listener from the list that's notified when the editor starts, stops or cancels editing.
removeCellEditorListener
in interface CellEditor
listener
- protected abstract void setCellEditorValue(Object value)
getTableCellEditorComponent
to assign value
as the inital editor value.
Subclasses must override this method.
value
- the editor valuegetTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
public void setEditorComponent(Component editorComponent)
editorComponent
.
Invoked in EOColumnEditor's constructor.
editorComponent
- the Component returned from createEditorComponent
createEditorComponent()
public boolean shouldSelectCell(EventObject event)
javax.swing.table.TableCellEditor
method to determine whether a cell should be selected when edited or not.
Invokes beginEditing
and returns true
so that by default all EOColumnEditors select the cell.
shouldSelectCell
in interface CellEditor
event
- the event the editor should use to start editing
beginEditing()
public boolean stopCellEditing()
javax.swing.table.TableCellEditor
method to finish and accept editing.
stopCellEditing
in interface CellEditor
true
if the editing was stopped
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |