-
- All Known Implementing Classes:
SpreadsheetCellBase
public interface SpreadsheetCellInterface of the cells used in theSpreadsheetView. SeeSpreadsheetCellBasefor a complete and detailed documentation.- See Also:
SpreadsheetCellBase
-
-
Property Summary
Properties Type Property Description StringPropertyformatReturns theStringPropertylinked with the format.ObjectProperty<Node>graphicReturns theObjectPropertyrepresenting this cell graphic.ObjectProperty<Object>itemThe item property represents the currently-set value inside thisSpreadsheetCell.StringPropertystyleA string representation of the CSS style associated with this specific Node.ReadOnlyStringPropertytextReturns the StringProperty of the representation of the value.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSpreadsheetCell.CornerPositionThis enum states the four different corner available for positioning some elements in a cell.
-
Field Summary
Fields Modifier and Type Field Description static EventType<Event>CORNER_EVENT_TYPEThis EventType can be used with anEventHandlerin order to catch when a corner state of a SpreadsheetCell is changed.static EventType<Event>EDITABLE_EVENT_TYPEThis EventType can be used with anEventHandlerin order to catch when the editable state of a SpreadsheetCell is changed.static EventType<Event>WRAP_EVENT_TYPEThis EventType can be used with anEventHandlerin order to catch when the wrap text state of a SpreadsheetCell is changed.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidactivateCorner(SpreadsheetCell.CornerPosition position)Activates the givenCornerPositionin order to display a little triangle in the cell.voidaddEventHandler(EventType<Event> eventType, EventHandler<Event> eventHandler)Registers an event handler to this SpreadsheetCell.voiddeactivateCorner(SpreadsheetCell.CornerPosition position)This deactivates the givenCornerPositionso that no triangle will be shown for this cell.StringPropertyformatProperty()Returns theStringPropertylinked with the format.SpreadsheetCellTypegetCellType()Returns theSpreadsheetCellTypeof this cell.intgetColumn()Returns the column index of this cell.intgetColumnSpan()Returns how much this cell is spanning in column, 1 means the cell is not spanning.StringgetFormat()Returns the format of this cell or an empty string if no format has been specified.NodegetGraphic()Returns the graphic node associated with this cell.ObjectgetItem()Returns the value contained in this cell.List<Object>getOptionsForEditor()If some options cannot be factorized in aSpreadsheetCellTypeand are specific to a cell, you can return them here and theSpreadsheetCellEditorwill receive them.List<MenuItem>getPopupItems()IfhasPopup()is set totrue, this method will be called when the user clicks on the cell in order to gather theMenuItemto show in the Popup.intgetRow()Returns the row index of this cell.intgetRowSpan()Returns how much this cell is spanning in row, 1 means the cell is not spanning.StringgetStyle()A string representation of the CSS style associated with this specific Node.ObservableSet<String>getStyleClass()Returns anObservableListofStringof all the style class associated with this cell.StringgetText()Returns the String representation currently used for display in theSpreadsheetView.Optional<String>getTooltip()Returns the tooltip for this cell.ObjectProperty<Node>graphicProperty()Returns theObjectPropertyrepresenting this cell graphic.booleanhasPopup()Returns true if this cell needs to display a popup when clicked in order to show someMenuItemlike aMenuButton.booleanisCellGraphic()Returnstrueif this cell contains something particular in its item and a Node given by theCellGraphicFactorywill be used to display it.booleanisCornerActivated(SpreadsheetCell.CornerPosition position)Returnstrueif a triangle is displayed in the cell for the givenCornerPosition.booleanisEditable()Returnstrueif this cell can be edited.booleanisWrapText()If a run of text exceeds the width of the Labeled, then this variable indicates whether the text should wrap onto another line.ObjectProperty<Object>itemProperty()The item property represents the currently-set value inside thisSpreadsheetCell.booleanmatch(Object value)Verifies that the upcoming cell value can be set to the current cell.voidremoveEventHandler(EventType<Event> eventType, EventHandler<Event> eventHandler)Unregisters a previously registered event handler from this SpreadsheetCell.voidsetCellGraphic(boolean isCellGraphic)IfisCellGraphicistrue, this cell item contains something particular and should be display by usingCellGraphicFactoryobject in the CellView.voidsetColumnSpan(int columnSpan)Sets how much this cell is spanning in column.voidsetEditable(boolean editable)Change the editable state of this cellvoidsetFormat(String format)Sets a new format for this cell.voidsetGraphic(Node graphic)Sets a graphic for this cell.voidsetHasPopup(boolean value)Sets totrueif this cell needs to display a popup when clicked in order to show someMenuItemlike aMenuButton.voidsetItem(Object value)Sets the value of the property Item.voidsetRowSpan(int rowSpan)Sets how much this cell is spanning in row.voidsetStyle(String style)A string representation of the CSS style associated with this specific Node.voidsetWrapText(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.StringPropertystyleProperty()A string representation of the CSS style associated with this specific Node.ReadOnlyStringPropertytextProperty()Returns the StringProperty of the representation of the value.
-
-
-
Property Detail
-
item
ObjectProperty<Object> itemProperty
The item property represents the currently-set value inside thisSpreadsheetCell.- See Also:
getItem(),setItem(Object)
-
style
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.- See Also:
getStyle(),setStyle(String)
-
format
StringProperty formatProperty
Returns theStringPropertylinked with the format.- See Also:
getFormat(),setFormat(String)
-
text
ReadOnlyStringProperty textProperty
Returns the StringProperty of the representation of the value.- See Also:
getText()
-
graphic
ObjectProperty<Node> graphicProperty
Returns theObjectPropertyrepresenting this cell graphic.- See Also:
getGraphic(),setGraphic(Node)
-
-
Field Detail
-
EDITABLE_EVENT_TYPE
static final EventType<Event> EDITABLE_EVENT_TYPE
This EventType can be used with anEventHandlerin order to catch when the editable state of a SpreadsheetCell is changed.
-
WRAP_EVENT_TYPE
static final EventType<Event> WRAP_EVENT_TYPE
This EventType can be used with anEventHandlerin order to catch when the wrap text state of a SpreadsheetCell is changed.
-
CORNER_EVENT_TYPE
static final EventType<Event> CORNER_EVENT_TYPE
This EventType can be used with anEventHandlerin order to catch when a corner state of a SpreadsheetCell is changed.
-
-
Method Detail
-
match
boolean match(Object value)
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:
trueif the upcoming cell value can be set to the current cell
-
setItem
void setItem(Object value)
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
ObjectProperty<Object> itemProperty()
The item property represents the currently-set value inside thisSpreadsheetCell.- See Also:
getItem(),setItem(Object)
-
isEditable
boolean isEditable()
Returnstrueif this cell can be edited.- Returns:
trueif this cell is editable
-
setEditable
void setEditable(boolean editable)
Change the editable state of this cell- Parameters:
editable-trueif 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:
trueif the text should wrap onto another line if it exceeds the width of theLabeled
-
isCellGraphic
boolean isCellGraphic()
Returnstrueif this cell contains something particular in its item and a Node given by theCellGraphicFactorywill be used to display it.- Returns:
trueif this cell item needs to be given to a particular Node
-
setCellGraphic
void setCellGraphic(boolean isCellGraphic)
IfisCellGraphicistrue, this cell item contains something particular and should be display by usingCellGraphicFactoryobject 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-trueif the text should wrap onto another line if it exceeds the width of theLabeled
-
getOptionsForEditor
List<Object> getOptionsForEditor()
If some options cannot be factorized in aSpreadsheetCellTypeand are specific to a cell, you can return them here and theSpreadsheetCellEditorwill receive them.- Returns:
- a
Listof options for theSpreadsheetCellEditor
-
hasPopup
boolean hasPopup()
Returns true if this cell needs to display a popup when clicked in order to show someMenuItemlike aMenuButton. The items can be set ingetPopupItems().- Returns:
trueif this cell needs to display a popup
-
setHasPopup
void setHasPopup(boolean value)
Sets totrueif this cell needs to display a popup when clicked in order to show someMenuItemlike aMenuButton.- Parameters:
value-trueto display aPopupwhen clicked
-
getPopupItems
List<MenuItem> getPopupItems()
IfhasPopup()is set totrue, this method will be called when the user clicks on the cell in order to gather theMenuItemto show in the Popup.- Returns:
- the
MenuItemto show in the Popup
-
setStyle
void setStyle(String style)
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
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.- See Also:
getStyle(),setStyle(String)
-
activateCorner
void activateCorner(SpreadsheetCell.CornerPosition position)
Activates the givenCornerPositionin order to display a little triangle in the cell.- Parameters:
position- the position where the triangle should be displayed
-
deactivateCorner
void deactivateCorner(SpreadsheetCell.CornerPosition position)
This deactivates the givenCornerPositionso that no triangle will be shown for this cell.- Parameters:
position- the position where the triangle should be removed if displayed
-
isCornerActivated
boolean isCornerActivated(SpreadsheetCell.CornerPosition position)
Returnstrueif a triangle is displayed in the cell for the givenCornerPosition.- Parameters:
position-- Returns:
trueif a triangle is displayed in the cell for the givenCornerPosition
-
formatProperty
StringProperty formatProperty()
Returns theStringPropertylinked with the format.- See Also:
getFormat(),setFormat(String)
-
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
void setFormat(String format)
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
ReadOnlyStringProperty textProperty()
Returns the StringProperty of the representation of the value.- See Also:
getText()
-
getText
String getText()
Returns the String representation currently used for display in theSpreadsheetView.- Returns:
- the text representation of the value
-
getCellType
SpreadsheetCellType getCellType()
Returns theSpreadsheetCellTypeof this cell.- Returns:
- the
SpreadsheetCellTypeof 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. SeeSpreadsheetCelldescription 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. SeeSpreadsheetCelldescription 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
ObservableSet<String> getStyleClass()
Returns anObservableListofStringof 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
ObservableListofStringof all the style class of this cell
-
graphicProperty
ObjectProperty<Node> graphicProperty()
Returns theObjectPropertyrepresenting this cell graphic.- See Also:
getGraphic(),setGraphic(Node)
-
setGraphic
void setGraphic(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
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
Optional<String> getTooltip()
Returns the tooltip for this cell.- Returns:
- the tooltip associated with this
SpreadsheetCell
-
addEventHandler
void addEventHandler(EventType<Event> eventType, EventHandler<Event> 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
void removeEventHandler(EventType<Event> eventType, EventHandler<Event> 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
-
-