|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractCellEditor
org.tentackle.ui.FormComponentCellEditor
public class FormComponentCellEditor
Cell editor for FormComponents.
Provides cell editors for tables and trees.
| Field Summary | |
|---|---|
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 |
| Fields inherited from class javax.swing.AbstractCellEditor |
|---|
changeEvent, listenerList |
| Constructor Summary | |
|---|---|
FormComponentCellEditor()
Creates a cell-editor with a default editing component. |
|
FormComponentCellEditor(FormComponent editorComponent)
Creates a cell-editor from a FormComponent. |
|
| Method Summary | |
|---|---|
void |
cancelCellEditing()
Calls fireEditingCanceled. |
void |
clearInhibitCellTraversal()
Clears inhibit if for some reason set erroneously |
void |
clearStartOver()
clears the startOver flag |
Object |
getCellEditorValue()
Gets the form value of the editor. |
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)
Sets an initial value for the editor. |
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)
Sets an initial value for the editor. |
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)
Returns true. |
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)
Returns true. |
void |
startOver()
Sets a flag that will inhibit stopCellEditing() once, i.e. |
boolean |
stopCellEditing()
Calls fireEditingStopped and returns true. |
boolean |
wasEditingCanceled()
Determines whether editing was stopped due to canceling. |
| Methods inherited from class javax.swing.AbstractCellEditor |
|---|
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener |
| 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, removeCellEditorListener |
| Field Detail |
|---|
protected 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
| Constructor Detail |
|---|
public FormComponentCellEditor(FormComponent editorComponent)
editorComponent - the editor form componentpublic FormComponentCellEditor()
StringFormField| Method Detail |
|---|
public 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)
javax.swing.AbstractCellEditor
isCellEditable in interface CellEditorisCellEditable in class AbstractCellEditoranEvent - an event object
CellEditor.shouldSelectCell(java.util.EventObject)public boolean shouldSelectCell(EventObject anEvent)
javax.swing.AbstractCellEditor
shouldSelectCell in interface CellEditorshouldSelectCell in class AbstractCellEditoranEvent - an event object
CellEditor.isCellEditable(java.util.EventObject)public boolean stopCellEditing()
javax.swing.AbstractCellEditorfireEditingStopped and returns true.
stopCellEditing in interface CellEditorstopCellEditing in class AbstractCellEditorpublic void cancelCellEditing()
javax.swing.AbstractCellEditorfireEditingCanceled.
cancelCellEditing in interface CellEditorcancelCellEditing in class AbstractCellEditor
public 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 MySpecialAppDbObjectCellEditor() {
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 CellEditor
public FormComponent getTableCellEditorComponent(FormTable table,
boolean selected,
int row,
int column)
table - the formtableselected - true if cell is selectedrow - the table rowcolumn - the table column
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
javax.swing.table.TableCellEditorvalue for the editor. This will cause
the editor to stopEditing and lose any partially
edited value if the editor is editing when this method is called.
Returns the component that should be added to the client's
Component hierarchy. Once installed in the client's
hierarchy this component will then be able to draw and receive
user input.
getTableCellEditorComponent in interface TableCellEditortable - the JTable that is asking the
editor to edit; can be nullvalue - the value of the cell to be edited; it is
up to the specific editor to interpret
and draw the value. For example, if value is
the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null
is a valid valueisSelected - true if the cell is to be rendered with
highlightingrow - the row of the cell being editedcolumn - the column of the cell being edited
ClassCastException - if table is not a FormTable
public 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 edited
public Component getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
javax.swing.tree.TreeCellEditorReturns the component that should be added to the client's Component hierarchy. Once installed in the client's hierarchy this component will then be able to draw and receive user input.
getTreeCellEditorComponent in interface TreeCellEditortree - the JTree that is asking the editor to edit;
this parameter can be nullvalue - the value of the cell to be editedisSelected - true if the cell is to be rendered with
selection highlightingexpanded - true if the node is expandedleaf - true if the node is a leaf noderow - the row index of the node being edited
ClassCastException - if tree is not a FormTree
protected void prepareTableCellEditorComponent(FormTable table,
boolean selected,
int row,
int column)
table - the tableselected - true if cell is selectedrow - the table rowcolumn - the table column
protected 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 edited
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||