Top Description Inners Fields Constructors Methods
org.controlsfx.control.spreadsheet

public abstract Class SpreadsheetCellEditor

extends Object
Class Inheritance
Known Direct Subclasses
org.controlsfx.control.spreadsheet.SpreadsheetCellEditor.ObjectEditor, org.controlsfx.control.spreadsheet.SpreadsheetCellEditor.StringEditor, org.controlsfx.control.spreadsheet.SpreadsheetCellEditor.TextAreaEditor, org.controlsfx.control.spreadsheet.SpreadsheetCellEditor.DoubleEditor, org.controlsfx.control.spreadsheet.SpreadsheetCellEditor.IntegerEditor, org.controlsfx.control.spreadsheet.SpreadsheetCellEditor.ListEditor, org.controlsfx.control.spreadsheet.SpreadsheetCellEditor.DateEditor
Imports
impl.org.controlsfx.i18n.Localization, java.text.DecimalFormat, .DecimalFormatSymbols, .NumberFormat, .ParseException, .ParsePosition, java.time.LocalDate, java.util.List, javafx.beans.value.ChangeListener, .ObservableValue, javafx.collections.FXCollections, .ObservableList, javafx.event.EventHandler, javafx.scene.control.ComboBox, .Control, .DatePicker, .IndexRange, .TextArea, .TextField, javafx.scene.input.KeyCode, .KeyEvent, javafx.util.StringConverter

SpreadsheetCellEditor are used by SpreadsheetCellType and SpreadsheetCell in order to control how each value will be entered.

General behavior:

Editors will be displayed if the user double-click in an editable cell ( see SpreadsheetCell#setEditable(boolean) ).
If the user does anything outside the editor, the editor will be forced to try to commit the edition and close itself. If the value is not valid, the editor will cancel the value and close itself. The editor is just here to allow communication between the user and the 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.
You can abandon a current modification by pressing "esc" key.
You can specify a maximum height to your spreadsheetCellEditor with 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 TextAreaEditor want to grow with the cell in order to take full space for display.

Specific behavior:

This class offers some static classes in order to create a SpreadsheetCellEditor. Here are their properties:

Creating your editor:

You can of course create your own SpreadsheetCellEditor for displaying other controls.
You just have to override the four abstract methods. Remember that you will never call those methods directly. They will be called by the SpreadsheetView when needed.
Keep in mind that you will interact only with 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.

Use case :

Use case of SpreadsheetCellEditor

Visual:

String
Screenshot of SpreadsheetCellEditor.StringEditor
List
Screenshot of SpreadsheetCellEditor.ListEditor
Double
Screenshot of SpreadsheetCellEditor.DoubleEditor
Date
Screenshot of SpreadsheetCellEditor.DateEditor
See Also
SpreadsheetView, SpreadsheetCell, SpreadsheetCellType

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class
public static class
public static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
private static final DecimalFormat
private static final double
pack-priv SpreadsheetView

Constructor Summary

AccessConstructor and Description
public
SpreadsheetCellEditor(SpreadsheetView view)

Construct the SpreadsheetCellEditor.

Method Summary

Modifier and TypeMethod and Description
public abstract void
end()

This method will be called at the end of edition.

public final void
endEdit(boolean
true means commit, false means cancel
b
)

Whenever you want to stop the edition, you call that method.

public abstract String

Returns:

the value within your editor as a string.
getControlValue
()

Return the value within your editor as a string.

public abstract Control

Returns:

the control used.
getEditor
()

Return the control used for controlling the input.

public double

Returns:

50 by default.
getMaxHeight
()

Return the maximum height of the editor.

public void
startEdit(Object item)

This method will be called when edition start.

public abstract void
startEdit(Object item, String format, Object... options)

Does the same as startEdit(java.lang.Object) but you have also the SpreadsheetCell#getFormat() sent.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait