@DefaultProperty(value="content") @IDProperty(value="id") public class Tab extends java.lang.Object implements EventTarget, Styleable
Tabs are placed within a TabPane
, where each tab represents a single
'page'.
Tabs can contain any Node
such as UI controls or groups
of nodes added to a layout container.
When the user clicks on a Tab in the TabPane the Tab content becomes visible to the user.
Constructor and Description |
---|
Tab()
Creates a tab with no title.
|
Tab(java.lang.String text)
Creates a tab with a text title.
|
Tab(java.lang.String text,
Node content)
Creates a tab with a text title and the specified content node.
|
Modifier and Type | Method and Description |
---|---|
EventDispatchChain |
buildEventDispatchChain(EventDispatchChain tail)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
BooleanProperty |
closableProperty()
The closable state for this tab.
|
ObjectProperty<Node> |
contentProperty()
The content associated with the tab.
|
ObjectProperty<ContextMenu> |
contextMenuProperty()
The context menu associated with the tab.
|
ReadOnlyBooleanProperty |
disabledProperty()
Indicates whether or not this
Tab is disabled. |
private ReadOnlyBooleanWrapper |
disabledPropertyImpl() |
BooleanProperty |
disableProperty()
Sets the disabled state of this tab.
|
static java.util.List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
Node |
getContent()
The content associated with the tab.
|
ContextMenu |
getContextMenu()
The context menu associated with the tab.
|
java.util.List<CssMetaData<? extends Styleable,?>> |
getCssMetaData()
The CssMetaData of this Styleable.
|
Node |
getGraphic()
The graphic shown in the tab.
|
java.lang.String |
getId()
The id of this tab.
|
EventHandler<Event> |
getOnClosed()
The event handler that is associated with the tab when the tab is closed.
|
EventHandler<Event> |
getOnCloseRequest() |
EventHandler<Event> |
getOnSelectionChanged()
The event handler that is associated with a selection on the tab.
|
ObservableMap<java.lang.Object,java.lang.Object> |
getProperties()
Returns an observable map of properties on this Tab for use primarily
by application developers.
|
ObservableSet<PseudoClass> |
getPseudoClassStates()
Return the pseudo-class state of this Styleable.
|
java.lang.String |
getStyle()
The CSS style string associated to this tab.
|
Styleable |
getStyleableParent()
Return the parent of this Styleable, or null if there is no parent.
|
ObservableList<java.lang.String> |
getStyleClass()
A list of String identifiers which can be used to logically group
Nodes, specifically for an external style engine.
|
TabPane |
getTabPane()
A reference to the TabPane that contains this tab instance.
|
java.lang.String |
getText()
The text shown in the tab.
|
Tooltip |
getTooltip()
The tooltip associated with this tab.
|
java.lang.String |
getTypeSelector()
The type of this
Styleable that is to be used in selector matching. |
java.lang.Object |
getUserData()
Returns a previously set Object property, or null if no such property
has been set using the
setUserData(java.lang.Object) method. |
ObjectProperty<Node> |
graphicProperty()
The graphic in the tab.
|
boolean |
hasProperties()
Tests if this Tab has properties.
|
StringProperty |
idProperty()
The id of this tab.
|
boolean |
isClosable()
Returns
true if this tab is closable. |
boolean |
isDisable()
Returns
true if this tab is disable. |
boolean |
isDisabled()
|
boolean |
isSelected()
Represents whether this tab is the currently selected tab,
To change the selected Tab use
tabPane.getSelectionModel().select() |
(package private) Node |
lookup(java.lang.String selector) |
(package private) java.util.List<Node> |
lookupAll(java.lang.String selector) |
ObjectProperty<EventHandler<Event>> |
onClosedProperty()
The event handler that is associated with the tab when the tab is closed.
|
ObjectProperty<EventHandler<Event>> |
onCloseRequestProperty() |
ObjectProperty<EventHandler<Event>> |
onSelectionChangedProperty()
The event handler that is associated with a selection on the tab.
|
ReadOnlyBooleanProperty |
selectedProperty()
The currently selected tab.
|
private ReadOnlyBooleanWrapper |
selectedPropertyImpl() |
void |
setClosable(boolean value)
Sets
true if the tab is closable. |
void |
setContent(Node value)
The content to show within the main TabPane area.
|
void |
setContextMenu(ContextMenu value)
Specifies the context menu to show when the user right-clicks on the tab.
|
void |
setDisable(boolean value)
Sets the disabled state of this tab.
|
private void |
setDisabled(boolean value) |
protected <E extends Event> |
setEventHandler(EventType<E> eventType,
EventHandler<E> eventHandler)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
setGraphic(Node value)
Sets the graphic to show in the tab to allow the user to differentiate
between the function of each tab.
|
void |
setId(java.lang.String value)
Sets the id of this tab.
|
void |
setOnClosed(EventHandler<Event> value)
Defines a function to be called when the tab is closed.
|
void |
setOnCloseRequest(EventHandler<Event> value) |
void |
setOnSelectionChanged(EventHandler<Event> value)
Defines a function to be called when a selection changed has occurred on the tab.
|
(package private) void |
setSelected(boolean value) |
void |
setStyle(java.lang.String value)
A string representation of the CSS style associated with this
tab.
|
(package private) void |
setTabPane(TabPane value) |
void |
setText(java.lang.String value)
Sets the text to show in the tab to allow the user to differentiate between
the function of each tab.
|
void |
setTooltip(Tooltip value)
Specifies the tooltip to show when the user hovers over the tab.
|
void |
setUserData(java.lang.Object value)
Convenience method for setting a single Object property that can be
retrieved at a later date.
|
StringProperty |
styleProperty()
The CSS style string associated to this tab.
|
ReadOnlyObjectProperty<TabPane> |
tabPaneProperty()
The TabPane that contains this tab.
|
private ReadOnlyObjectWrapper<TabPane> |
tabPanePropertyImpl() |
StringProperty |
textProperty()
The text shown in the tab.
|
ObjectProperty<Tooltip> |
tooltipProperty()
The tooltip associated with this tab.
|
private void |
updateDisabled() |
private StringProperty id
private StringProperty style
private ReadOnlyBooleanWrapper selected
private ReadOnlyObjectWrapper<TabPane> tabPane
private final InvalidationListener parentDisabledChangedListener
private StringProperty text
private ObjectProperty<Node> graphic
private ObjectProperty<Node> content
private ObjectProperty<ContextMenu> contextMenu
private BooleanProperty closable
public static final EventType<Event> SELECTION_CHANGED_EVENT
Called when the tab becomes selected or unselected.
private ObjectProperty<EventHandler<Event>> onSelectionChanged
public static final EventType<Event> CLOSED_EVENT
Called when a user closes this tab. This is useful for freeing up memory.
private ObjectProperty<EventHandler<Event>> onClosed
private ObjectProperty<Tooltip> tooltip
private final ObservableList<java.lang.String> styleClass
private BooleanProperty disable
private ReadOnlyBooleanWrapper disabled
public static final EventType<Event> TAB_CLOSE_REQUEST_EVENT
Tab
.
The installed event handler can prevent tab closing by consuming the
received event.private ObjectProperty<EventHandler<Event>> onCloseRequest
Tab
.
The installed event handler can prevent tab closing by consuming the
received event.private static final java.lang.Object USER_DATA_KEY
private ObservableMap<java.lang.Object,java.lang.Object> properties
private final EventHandlerManager eventHandlerManager
private static final java.lang.String DEFAULT_STYLE_CLASS
public Tab()
public Tab(java.lang.String text)
text
- The title of the tab.public Tab(java.lang.String text, Node content)
text
- The title of the tab.content
- The content of the tab.public final void setId(java.lang.String value)
TabPane
. The default value is null
.public final java.lang.String getId()
public final StringProperty idProperty()
public final void setStyle(java.lang.String value)
Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead.
public final java.lang.String getStyle()
public final StringProperty styleProperty()
final void setSelected(boolean value)
public final boolean isSelected()
Represents whether this tab is the currently selected tab,
To change the selected Tab use tabPane.getSelectionModel().select()
public final ReadOnlyBooleanProperty selectedProperty()
private ReadOnlyBooleanWrapper selectedPropertyImpl()
final void setTabPane(TabPane value)
public final TabPane getTabPane()
A reference to the TabPane that contains this tab instance.
public final ReadOnlyObjectProperty<TabPane> tabPaneProperty()
private ReadOnlyObjectWrapper<TabPane> tabPanePropertyImpl()
public final void setText(java.lang.String value)
Sets the text to show in the tab to allow the user to differentiate between the function of each tab. The text is always visible
public final java.lang.String getText()
public final StringProperty textProperty()
public final void setGraphic(Node value)
Sets the graphic to show in the tab to allow the user to differentiate between the function of each tab. By default the graphic does not rotate based on the TabPane.tabPosition value, but it can be set to rotate by setting TabPane.rotateGraphic to true.
public final Node getGraphic()
public final ObjectProperty<Node> graphicProperty()
public final void setContent(Node value)
The content to show within the main TabPane area. The content can be any Node such as UI controls or groups of nodes added to a layout container.
public final Node getContent()
The content associated with the tab.
public final ObjectProperty<Node> contentProperty()
The content associated with the tab.
public final void setContextMenu(ContextMenu value)
Specifies the context menu to show when the user right-clicks on the tab.
public final ContextMenu getContextMenu()
public final ObjectProperty<ContextMenu> contextMenuProperty()
public final void setClosable(boolean value)
Sets true
if the tab is closable. If this is set to false
,
then regardless of the TabClosingPolicy, it will not be
possible for the user to close this tab. Therefore, when this
property is false
, no 'close' button will be shown on the tab.
The default is true
.
public final boolean isClosable()
true
if this tab is closable.true
if the tab is closable.public final BooleanProperty closableProperty()
public final void setOnSelectionChanged(EventHandler<Event> value)
public final EventHandler<Event> getOnSelectionChanged()
public final ObjectProperty<EventHandler<Event>> onSelectionChangedProperty()
public final void setOnClosed(EventHandler<Event> value)
public final EventHandler<Event> getOnClosed()
public final ObjectProperty<EventHandler<Event>> onClosedProperty()
public final void setTooltip(Tooltip value)
Specifies the tooltip to show when the user hovers over the tab.
public final Tooltip getTooltip()
public final ObjectProperty<Tooltip> tooltipProperty()
public final void setDisable(boolean value)
value
- the state to set this tabpublic final boolean isDisable()
true
if this tab is disable.public final BooleanProperty disableProperty()
TabPane.getSelectionModel()
.private final void setDisabled(boolean value)
public final boolean isDisabled()
public final ReadOnlyBooleanProperty disabledProperty()
Tab
is disabled. A Tab
will become disabled if disable
is set to true
on either
itself or if the TabPane
is disabled.private ReadOnlyBooleanWrapper disabledPropertyImpl()
private void updateDisabled()
public final ObjectProperty<EventHandler<Event>> onCloseRequestProperty()
public EventHandler<Event> getOnCloseRequest()
public void setOnCloseRequest(EventHandler<Event> value)
public final ObservableMap<java.lang.Object,java.lang.Object> getProperties()
public boolean hasProperties()
public void setUserData(java.lang.Object value)
getUserData()
.value
- The value to be stored - this can later be retrieved by calling
getUserData()
.public java.lang.Object getUserData()
setUserData(java.lang.Object)
method.public ObservableList<java.lang.String> getStyleClass()
getStyleClass
in interface Styleable
public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
EventTarget
EventTarget
. This event target is
not automatically added to the chain, so if it wants to process events,
it needs to add an EventDispatcher
for itself to the chain.
In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target.
The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain.
The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.
buildEventDispatchChain
in interface EventTarget
tail
- the initial chain to build fromprotected <E extends Event> void setEventHandler(EventType<E> eventType, EventHandler<E> eventHandler)
Node lookup(java.lang.String selector)
java.util.List<Node> lookupAll(java.lang.String selector)
public java.lang.String getTypeSelector()
Styleable
that is to be used in selector matching.
This is analogous to an "element" in HTML.
(CSS Type Selector).getTypeSelector
in interface Styleable
public Styleable getStyleableParent()
getStyleableParent
in interface Styleable
getTabPane()
public final ObservableSet<PseudoClass> getPseudoClassStates()
getPseudoClassStates
in interface Styleable
public java.util.List<CssMetaData<? extends Styleable,?>> getCssMetaData()
getCssMetaData
in interface Styleable
public static java.util.List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()