public class FormComponentCellEditor extends AbstractCellEditor implements TableCellEditor, TreeCellEditor
| Modifier and Type | Field and Description |
|---|---|
protected int |
clickCountToStart
number of clicks to start editing (default is 2)
|
protected int |
column
current column (table only)
|
protected FormComponent |
editor
the editor component
|
protected boolean |
expanded
true if cell is expanded (tree only)
|
protected boolean |
leaf
true if cell is a leaf node (tree only)
|
protected int |
row
current row (table and tree)
|
protected boolean |
selected
true if cell is selected (table only)
|
protected FormTable<?> |
table
last table referenced
|
protected FormTree |
tree
last tree referenced
|
changeEvent, listenerList| Constructor and Description |
|---|
FormComponentCellEditor()
Creates a cell-editor with a default editing component.
|
FormComponentCellEditor(FormComponent editorComponent)
Creates a cell-editor from a FormComponent.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelCellEditing() |
void |
clearInhibitCellTraversal()
Clears inhibit if for some reason set erroneously
|
void |
clearStartOver()
clears the startOver flag
|
Object |
getCellEditorValue() |
int |
getClickCountToStart()
Gets the number of clicks to start editing.
|
FormComponent |
getEditorComponent()
Gets the current editor component.
|
FormTable<?> |
getFormTable()
Gets the table.
|
FormComponent |
getTableCellEditorComponent(FormTable<?> table,
boolean selected,
int row,
int column)
Returns the editor initialized for the table cell.
Does _not_ set the value. |
Component |
getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column) |
FormComponent |
getTreeCellEditorComponent(FormTree tree,
boolean selected,
boolean expanded,
boolean leaf,
int row)
Returns the editor initialized for the tree cell.
Does _not_ set the value. |
Component |
getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row) |
void |
inhibitCellTraversal()
Inhibits enter-key traversal once.
Useful if we should stay in selected field even after Enter-key has been pressed. |
boolean |
isAutoRowHeight()
Returns whether auto row height is enabled.
|
boolean |
isCellEditable(EventObject anEvent) |
void |
prepare(FormTableEntry<?> entry,
int column)
In some cases it is necessary to update celleditors before
invocations of getTableCellEditorComponent(), especially if FormTableEntry.isCellEditorFixed()==true,
which is the default.
|
protected void |
prepareTableCellEditorComponent(FormTable<?> table,
boolean selected,
int row,
int column)
Prepares the table cell editor.
|
protected void |
prepareTreeCellEditorComponent(FormTree tree,
boolean selected,
boolean expanded,
boolean leaf,
int row)
Prepares the tree cell editor.
|
boolean |
requestFocusInWindow()
Requests the focus of the editing component.
|
void |
requestFocusLater()
Requests the focus of the editing component as late as possible.
|
void |
setAutoRowHeight(boolean autoRowHeight)
Turns automatic adjustment of the row height on/off.
|
void |
setClickCountToStart(int clicks)
Sets the number of clicks to start editing.
|
void |
setEditorComponent(FormComponent editor)
Sets the editor Component.
|
boolean |
shouldSelectCell(EventObject anEvent) |
void |
startOver()
Sets a flag that will inhibit stopCellEditing() once, i.e.
|
boolean |
stopCellEditing() |
boolean |
wasEditingCanceled()
Determines whether editing was stopped due to canceling.
|
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddCellEditorListener, removeCellEditorListenerprotected FormTable<?> table
protected FormTree tree
protected int row
protected int column
protected boolean selected
protected boolean expanded
protected boolean leaf
protected FormComponent editor
protected int clickCountToStart
public FormComponentCellEditor(FormComponent editorComponent)
editorComponent - the editor form componentpublic FormComponentCellEditor()
StringFormFieldpublic void setEditorComponent(FormComponent editor)
editor - the editor componentpublic FormComponent getEditorComponent()
public void setAutoRowHeight(boolean autoRowHeight)
autoRowHeight - true to enable automatic row height, false if fixedpublic boolean isAutoRowHeight()
public void startOver()
public void clearStartOver()
public void inhibitCellTraversal()
public void clearInhibitCellTraversal()
public boolean wasEditingCanceled()
public boolean requestFocusInWindow()
public void requestFocusLater()
public void setClickCountToStart(int clicks)
clicks - the number of clicks to start editingpublic int getClickCountToStart()
public FormTable<?> getFormTable()
public boolean isCellEditable(EventObject anEvent)
isCellEditable in interface CellEditorisCellEditable in class AbstractCellEditorpublic boolean shouldSelectCell(EventObject anEvent)
shouldSelectCell in interface CellEditorshouldSelectCell in class AbstractCellEditorpublic boolean stopCellEditing()
stopCellEditing in interface CellEditorstopCellEditing in class AbstractCellEditorpublic void cancelCellEditing()
cancelCellEditing in interface CellEditorcancelCellEditing in class AbstractCellEditorpublic void prepare(FormTableEntry<?> entry, int column)
FormTable will invoke prepare() *before* getTableCellEditorComponent() for every FormComponentCellEditor. The default implementation does nothing. Usually, the method will be overridden in a FormTableEntry like this:
public TableCellEditor getCellEditor(int col) {
return new MySpecialPdoCellEditor() {
public void prepare(FormTableEntry entry, int column) {
setContextDb(contextDb);
}
}
}
entry - is the FormTableEntry the editor will edit some data ofcolumn - is the column index (table-column)public Object getCellEditorValue()
getCellEditorValue in interface CellEditorpublic FormComponent getTableCellEditorComponent(FormTable<?> table, boolean selected, int row, int column)
table - the formtableselected - true if cell is selectedrow - the table rowcolumn - the table columnpublic Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
getTableCellEditorComponent in interface TableCellEditorClassCastException - if table is not a FormTablepublic FormComponent getTreeCellEditorComponent(FormTree tree, boolean selected, boolean expanded, boolean leaf, int row)
tree - the formtreeselected - true if cell is selectedexpanded - if tree node is expandedleaf - is node is a leaf noderow - the row index of the node being editedpublic Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
getTreeCellEditorComponent in interface TreeCellEditorClassCastException - if tree is not a FormTreeprotected void prepareTableCellEditorComponent(FormTable<?> table, boolean selected, int row, int column)
table - the tableselected - true if cell is selectedrow - the table rowcolumn - the table columnprotected void prepareTreeCellEditorComponent(FormTree tree, boolean selected, boolean expanded, boolean leaf, int row)
tree - the treeselected - true if cell is selectedexpanded - if tree node is expandedleaf - is node is a leaf noderow - the row index of the node being editedTentackle - a domain driven enterprise framework