public abstract class SpreadsheetCellEditor
extends java.lang.Object
SpreadsheetCellType and
SpreadsheetCell in order to control how each value will be entered. SpreadsheetCell.setEditable(boolean) ). SpreadsheetView.
It will just be given a value, and it will just give back another one after.
The policy regarding validation of a given value is defined in
SpreadsheetCellType.match(Object).
If the value doesn't meet the requirements when saving the cell, nothing
happens and the editor keeps editing. getMaxHeight(). This can be used in order to control the display of your editor. If they
should grow or not in a big cell. (for example a SpreadsheetCellEditor.TextAreaEditor want
to grow with the cell in order to take full space for display.
SpreadsheetCellEditor. Here are their properties: SpreadsheetCellEditor.StringEditor: Basic TextField, can accept all data and
save it as a string.SpreadsheetCellEditor.ListEditor: Display a ComboBox with the different values.
SpreadsheetCellEditor.DoubleEditor: Display a TextField which accepts only
double value. If the entered value is incorrect, the background will turn red
so that the user will know in advance if the data will be saved or not.SpreadsheetCellEditor.IntegerEditor: Display a TextField which accepts only
Integer value. If the entered value is incorrect, the background will turn red
so that the user will know in advance if the data will be saved or not.SpreadsheetCellEditor.DateEditor: Display a DatePicker.SpreadsheetCellEditor.ObjectEditor: Display a TextField , accept an Object.SpreadsheetCellEditor for displaying other controls.SpreadsheetView when needed.
startEdit(Object): You will configure your control with the
given value which is SpreadsheetCell.getItem() converted to an
object. You do not instantiate your control here, you do it in the
constructor.getEditor(): You will return which control you're using (for
display).getControlValue(): You will return the value inside your editor
in order to submit it for validation.end(): When editing is finished, you can properly close your own
control.endEdit(boolean) where
a true value means you want to commit, and a false means you
want to cancel. The SpreadsheetView will handle all the rest for you
and call your methods at the right moment. 
| String | ![]() |
| List | ![]() |
| Double | ![]() |
| Date | ![]() |
SpreadsheetView,
SpreadsheetCell,
SpreadsheetCellType| Modifier and Type | Class and Description |
|---|---|
static class |
SpreadsheetCellEditor.DateEditor
A
SpreadsheetCellEditor for SpreadsheetCellType.DateType
typed cells. |
static class |
SpreadsheetCellEditor.DoubleEditor
A
SpreadsheetCellEditor for
SpreadsheetCellType.DoubleType typed cells. |
static class |
SpreadsheetCellEditor.IntegerEditor
A
SpreadsheetCellEditor for
SpreadsheetCellType.DoubleType typed cells. |
static class |
SpreadsheetCellEditor.ListEditor<R>
A
SpreadsheetCellEditor for SpreadsheetCellType.ListType
typed cells. |
static class |
SpreadsheetCellEditor.ObjectEditor
A
SpreadsheetCellEditor for
SpreadsheetCellType.ObjectType typed cells. |
static class |
SpreadsheetCellEditor.StringEditor
A
SpreadsheetCellEditor for
SpreadsheetCellType.StringType typed cells. |
static class |
SpreadsheetCellEditor.TextAreaEditor
A
SpreadsheetCellEditor for
SpreadsheetCellType.StringType typed cells. |
| Constructor and Description |
|---|
SpreadsheetCellEditor(SpreadsheetView view)
Construct the SpreadsheetCellEditor.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
end()
This method will be called at the end of edition.
You will be offered the possibility to do the configuration post editing. |
void |
endEdit(boolean b)
Whenever you want to stop the edition, you call that method.
True means you're trying to commit the value, then SpreadsheetCellType.convertValue(Object) will be called in order
to verify that the value is correct.False means you're trying to cancel the value and it will be follow by end().See SpreadsheetCellEditor description |
abstract java.lang.String |
getControlValue()
Return the value within your editor as a string.
|
abstract javafx.scene.control.Control |
getEditor()
Return the control used for controlling the input.
|
double |
getMaxHeight()
Return the maximum height of the editor.
|
void |
startEdit(java.lang.Object item)
This method will be called when edition start.
You will then do all the configuration of your editor. |
abstract void |
startEdit(java.lang.Object item,
java.lang.String format,
java.lang.Object... options)
Does the same as
startEdit(java.lang.Object) but you have also
the SpreadsheetCell.getFormat() sent. |
public SpreadsheetCellEditor(SpreadsheetView view)
view - public final void endEdit(boolean b)
SpreadsheetCellType.convertValue(Object) will be called in order
to verify that the value is correct.end().b - true means commit, false means cancelpublic void startEdit(java.lang.Object item)
item - public abstract void startEdit(java.lang.Object item,
java.lang.String format,
java.lang.Object... options)
startEdit(java.lang.Object) but you have also
the SpreadsheetCell.getFormat() sent. This is useful when
editing Date for example, when you want to display it with the cell
format.
Also options given by a Spreadsheetcell with SpreadsheetCell.getOptionsForEditor() are given.item - format - options - public abstract javafx.scene.control.Control getEditor()
public abstract java.lang.String getControlValue()
SpreadsheetCellType.convertValue(Object) in order to compute
whether the value is valid regarding the SpreadsheetCellType
policy.public abstract void end()
public double getMaxHeight()