- All Known Implementing Classes:
SpreadsheetCellBase
public interface SpreadsheetCell
Interface of the cells used in the
SpreadsheetView
.
See SpreadsheetCellBase
for a complete and detailed documentation.- See Also:
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.StringProperty
Returns theStringProperty
linked with the format.javafx.beans.property.ObjectProperty
<javafx.scene.Node> Returns theObjectProperty
representing this cell graphic.javafx.beans.property.ObjectProperty
<Object> The item property represents the currently-set value inside thisSpreadsheetCell
.javafx.beans.property.StringProperty
A string representation of the CSS style associated with this specific Node.javafx.beans.property.ReadOnlyStringProperty
Returns the StringProperty of the representation of the value. -
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
This enum states the four different corner available for positioning some elements in a cell. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final javafx.event.EventType
<javafx.event.Event> This EventType can be used with anEventHandler
in order to catch when a corner state of a SpreadsheetCell is changed.static final javafx.event.EventType
<javafx.event.Event> This EventType can be used with anEventHandler
in order to catch when the editable state of a SpreadsheetCell is changed.static final javafx.event.EventType
<javafx.event.Event> This EventType can be used with anEventHandler
in order to catch when the wrap text state of a SpreadsheetCell is changed. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateCorner
(SpreadsheetCell.CornerPosition position) Activates the givenCornerPosition
in order to display a little triangle in the cell.<E extends javafx.event.Event>
voidaddEventHandler
(javafx.event.EventType<E> eventType, javafx.event.EventHandler<? super E> eventHandler) Registers an event handler to this SpreadsheetCell.void
This deactivates the givenCornerPosition
so that no triangle will be shown for this cell.javafx.beans.property.StringProperty
Returns theStringProperty
linked with the format.Returns theSpreadsheetCellType
of this cell.int
Returns the column index of this cell.int
Returns how much this cell is spanning in column, 1 means the cell is not spanning.Returns the format of this cell or an empty string if no format has been specified.javafx.scene.Node
Returns the graphic node associated with this cell.getItem()
Returns the value contained in this cell.If some options cannot be factorized in aSpreadsheetCellType
and are specific to a cell, you can return them here and theSpreadsheetCellEditor
will receive them.List
<javafx.scene.control.MenuItem> IfhasPopup()
is set totrue
, this method will be called when the user clicks on the cell in order to gather theMenuItem
to show in the Popup.int
getRow()
Returns the row index of this cell.int
Returns how much this cell is spanning in row, 1 means the cell is not spanning.getStyle()
A string representation of the CSS style associated with this specific Node.javafx.collections.ObservableSet
<String> Returns anObservableList
ofString
of all the style class associated with this cell.getText()
Returns the String representation currently used for display in theSpreadsheetView
.Returns the tooltip for this cell.javafx.beans.property.ObjectProperty
<javafx.scene.Node> Returns theObjectProperty
representing this cell graphic.boolean
hasPopup()
Returns true if this cell needs to display a popup when clicked in order to show someMenuItem
like aMenuButton
.boolean
Returnstrue
if this cell contains something particular in its item and a Node given by theCellGraphicFactory
will be used to display it.boolean
Returnstrue
if a triangle is displayed in the cell for the givenCornerPosition
.boolean
Returnstrue
if this cell can be edited.boolean
If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.javafx.beans.property.ObjectProperty
<Object> The item property represents the currently-set value inside thisSpreadsheetCell
.boolean
Verifies that the upcoming cell value can be set to the current cell.<E extends javafx.event.Event>
voidremoveEventHandler
(javafx.event.EventType<E> eventType, javafx.event.EventHandler<? super E> eventHandler) Unregisters a previously registered event handler from this SpreadsheetCell.void
setCellGraphic
(boolean isCellGraphic) IfisCellGraphic
istrue
, this cell item contains something particular and should be display by usingCellGraphicFactory
object in the CellView.void
setColumnSpan
(int columnSpan) Sets how much this cell is spanning in column.void
setEditable
(boolean editable) Change the editable state of this cellvoid
Sets a new format for this cell.void
setGraphic
(javafx.scene.Node graphic) Sets a graphic for this cell.void
setHasPopup
(boolean value) Sets totrue
if this cell needs to display a popup when clicked in order to show someMenuItem
like aMenuButton
.void
Sets the value of the property Item.void
setRowSpan
(int rowSpan) Sets how much this cell is spanning in row.void
A string representation of the CSS style associated with this specific Node.void
setWrapText
(boolean wrapText) If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.javafx.beans.property.StringProperty
A string representation of the CSS style associated with this specific Node.javafx.beans.property.ReadOnlyStringProperty
Returns the StringProperty of the representation of the value.
-
Property Details
-
item
javafx.beans.property.ObjectProperty<Object> itemPropertyThe item property represents the currently-set value inside thisSpreadsheetCell
.- See Also:
-
style
javafx.beans.property.StringProperty stylePropertyA string representation of the CSS style associated with this specific Node. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.- See Also:
-
format
javafx.beans.property.StringProperty formatPropertyReturns theStringProperty
linked with the format.- See Also:
-
text
javafx.beans.property.ReadOnlyStringProperty textPropertyReturns the StringProperty of the representation of the value.- See Also:
-
graphic
javafx.beans.property.ObjectProperty<javafx.scene.Node> graphicPropertyReturns theObjectProperty
representing this cell graphic.- See Also:
-
-
Field Details
-
EDITABLE_EVENT_TYPE
static final javafx.event.EventType<javafx.event.Event> EDITABLE_EVENT_TYPEThis EventType can be used with anEventHandler
in order to catch when the editable state of a SpreadsheetCell is changed. -
WRAP_EVENT_TYPE
static final javafx.event.EventType<javafx.event.Event> WRAP_EVENT_TYPEThis EventType can be used with anEventHandler
in order to catch when the wrap text state of a SpreadsheetCell is changed. -
CORNER_EVENT_TYPE
static final javafx.event.EventType<javafx.event.Event> CORNER_EVENT_TYPEThis EventType can be used with anEventHandler
in order to catch when a corner state of a SpreadsheetCell is changed.
-
-
Method Details
-
match
Verifies that the upcoming cell value can be set to the current cell. This is currently used by the Copy/Paste.- Parameters:
value
- the value that needs to be tested- Returns:
true
if the upcoming cell value can be set to the current cell
-
setItem
Sets the value of the property Item. This should be used only at initialization. PreferGrid.setCellValue(int, int, Object)
after because it will compute correctly the modifiedCell. IfisEditable()
return false, nothing is done.- Parameters:
value
-
-
getItem
Object getItem()Returns the value contained in this cell.- Returns:
- the value contained in this cell
-
itemProperty
javafx.beans.property.ObjectProperty<Object> itemProperty()The item property represents the currently-set value inside thisSpreadsheetCell
.- Returns:
- the item property which contains the value.
- See Also:
-
isEditable
boolean isEditable()Returnstrue
if this cell can be edited.- Returns:
true
if this cell is editable
-
setEditable
void setEditable(boolean editable) Change the editable state of this cell- Parameters:
editable
-true
if this cell should be editable
-
isWrapText
boolean isWrapText()If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.- Returns:
true
if the text should wrap onto another line if it exceeds the width of theLabeled
-
isCellGraphic
boolean isCellGraphic()Returnstrue
if this cell contains something particular in its item and a Node given by theCellGraphicFactory
will be used to display it.- Returns:
true
if this cell item needs to be given to a particular Node
-
setCellGraphic
void setCellGraphic(boolean isCellGraphic) IfisCellGraphic
istrue
, this cell item contains something particular and should be display by usingCellGraphicFactory
object in the CellView.- Parameters:
isCellGraphic
- iftrue
, a Node will be used to display something particular for the cell
-
setWrapText
void setWrapText(boolean wrapText) If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.- Parameters:
wrapText
-true
if the text should wrap onto another line if it exceeds the width of theLabeled
-
getOptionsForEditor
If some options cannot be factorized in aSpreadsheetCellType
and are specific to a cell, you can return them here and theSpreadsheetCellEditor
will receive them.- Returns:
- a
List
of options for theSpreadsheetCellEditor
-
hasPopup
boolean hasPopup()Returns true if this cell needs to display a popup when clicked in order to show someMenuItem
like aMenuButton
. The items can be set ingetPopupItems()
.- Returns:
true
if this cell needs to display a popup
-
setHasPopup
void setHasPopup(boolean value) Sets totrue
if this cell needs to display a popup when clicked in order to show someMenuItem
like aMenuButton
.- Parameters:
value
-true
to display aPopup
when clicked
-
getPopupItems
List<javafx.scene.control.MenuItem> getPopupItems()IfhasPopup()
is set totrue
, this method will be called when the user clicks on the cell in order to gather theMenuItem
to show in the Popup.- Returns:
- the
MenuItem
to show in the Popup
-
setStyle
A string representation of the CSS style associated with this specific Node. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.- Parameters:
style
- a string representation of the CSS style associated with this specific Node
-
getStyle
String getStyle()A string representation of the CSS style associated with this specific Node. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.- Returns:
- The inline CSS style associated with this Node. If this Node does not have an inline style, an empty String is returned.
-
styleProperty
javafx.beans.property.StringProperty styleProperty()A string representation of the CSS style associated with this specific Node. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.- Returns:
- a string representation of the CSS style
- See Also:
-
activateCorner
Activates the givenCornerPosition
in order to display a little triangle in the cell.- Parameters:
position
- the position where the triangle should be displayed
-
deactivateCorner
This deactivates the givenCornerPosition
so that no triangle will be shown for this cell.- Parameters:
position
- the position where the triangle should be removed if displayed
-
isCornerActivated
Returnstrue
if a triangle is displayed in the cell for the givenCornerPosition
.- Parameters:
position
-- Returns:
true
if a triangle is displayed in the cell for the givenCornerPosition
-
formatProperty
javafx.beans.property.StringProperty formatProperty()Returns theStringProperty
linked with the format.- Returns:
- the
StringProperty
linked with the format state - See Also:
-
getFormat
String getFormat()Returns the format of this cell or an empty string if no format has been specified.- Returns:
- the format of this cell or an empty string if no format has been specified
-
setFormat
Sets a new format for this cell. This format will be used bySpreadsheetCellType.toString(java.lang.Object, java.lang.String)
. This should be used by numbers for example.- Parameters:
format
- a string pattern understood by theSpreadsheetCellType
-
textProperty
javafx.beans.property.ReadOnlyStringProperty textProperty()Returns the StringProperty of the representation of the value.- Returns:
- the StringProperty of the representation of the value
- See Also:
-
getText
String getText()Returns the String representation currently used for display in theSpreadsheetView
.- Returns:
- the text representation of the value
-
getCellType
SpreadsheetCellType getCellType()Returns theSpreadsheetCellType
of this cell.- Returns:
- the
SpreadsheetCellType
of this cell.
-
getRow
int getRow()Returns the row index of this cell.- Returns:
- the row index of this cell
-
getColumn
int getColumn()Returns the column index of this cell.- Returns:
- the column index of this cell
-
getRowSpan
int getRowSpan()Returns how much this cell is spanning in row, 1 means the cell is not spanning.- Returns:
- how much this cell is spanning in row, 1 is normal
-
setRowSpan
void setRowSpan(int rowSpan) Sets how much this cell is spanning in row. SeeSpreadsheetCell
description for information. You should useGrid.spanRow(int, int, int)
instead of using this method directly. 1 means the cell is not spanning. Thus, the rowSpan should not be inferior to 1.- Parameters:
rowSpan
- the rowSpan for this cell
-
getColumnSpan
int getColumnSpan()Returns how much this cell is spanning in column, 1 means the cell is not spanning.- Returns:
- how much this cell is spanning in column, 1 is normal.
-
setColumnSpan
void setColumnSpan(int columnSpan) Sets how much this cell is spanning in column. SeeSpreadsheetCell
description for information. You should useGrid.spanColumn(int, int, int)
instead of using this method directly. 1 means the cell is not spanning. Thus, the rowSpan should not be inferior to 1.- Parameters:
columnSpan
- the columnSpan for this cell
-
getStyleClass
javafx.collections.ObservableSet<String> getStyleClass()Returns anObservableList
ofString
of all the style class associated with this cell. You can easily modify its appearance by adding a style class (previously set in CSS).- Returns:
- an
ObservableList
ofString
of all the style class of this cell
-
graphicProperty
javafx.beans.property.ObjectProperty<javafx.scene.Node> graphicProperty()Returns theObjectProperty
representing this cell graphic.- Returns:
- an ObjectProperty wrapping a Node for the graphic
- See Also:
-
setGraphic
void setGraphic(javafx.scene.Node graphic) Sets a graphic for this cell. It is displayed aside with the text if any is specified. Otherwise it's fully displayed in the cell.- Parameters:
graphic
- a graphic to display for this cell
-
getGraphic
javafx.scene.Node getGraphic()Returns the graphic node associated with this cell. Returns null if nothing has been associated.- Returns:
- the graphic node associated with this cell
-
getTooltip
Returns the tooltip for this cell.- Returns:
- the tooltip associated with this
SpreadsheetCell
-
addEventHandler
<E extends javafx.event.Event> void addEventHandler(javafx.event.EventType<E> eventType, javafx.event.EventHandler<? super E> eventHandler) Registers an event handler to this SpreadsheetCell.- Parameters:
eventType
- the type of the events to receive by the handlereventHandler
- the handler to register- Throws:
NullPointerException
- if the event type or handler is null
-
removeEventHandler
<E extends javafx.event.Event> void removeEventHandler(javafx.event.EventType<E> eventType, javafx.event.EventHandler<? super E> eventHandler) Unregisters a previously registered event handler from this SpreadsheetCell.- Parameters:
eventType
- the event type from which to unregistereventHandler
- the handler to unregister- Throws:
NullPointerException
- if the event type or handler is null
-