public class TabView extends ParentUiElement implements Navigatable
UiElement
of tabs that can be switched between by the playerModifier and Type | Field and Description |
---|---|
protected TabViewRenderNode |
renderNode |
protected java.util.List<Tab> |
tabs |
asyncAddQueue, asyncRemoveAll, asyncRemoveQueue, children
Constructor and Description |
---|
TabView()
Constructor.
|
TabView(java.lang.String id)
Constructor
|
TabView(java.lang.String id,
TabButton previousTabButton,
TabButton nextTabButton)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Tab tab)
|
void |
add(Tab tab)
|
void |
attach(ParentRenderNode<?,?> parentRenderNode)
Attaches a
RenderNode for this element to a parent
RenderNode |
void |
clearControllerHotkeys()
Unmaps all controller hotkeys
|
void |
clearHotkeys()
Unmaps all hotkeys
|
void |
clearKeyboardHotkeys()
Unmaps all keyboard hotkeys
|
boolean |
containsTab(Tab tab)
|
protected ParentRenderNode<?,?> |
createRenderNode(ParentRenderNode<?,?> parent)
Creates the
ParentRenderNode for this UiElement |
void |
detach(ParentRenderNode<?,?> parentRenderNode)
Detaches this element's
RenderNode from a parent
RenderNode |
Tab |
getCurrentTab()
Returns the currently visible
Tab |
int |
getCurrentTabIndex()
Returns the index of the currently visible
Tab |
UiElement |
getElementById(java.lang.String id)
Searches the UI for a
UiElement with a given id. |
java.lang.String |
getHorizontalLayout()
Returns the current horizontal layout rules
|
UiNavigation |
getNavigation()
Returns the
UiNavigation currently being navigated |
TabButton |
getNextTabButton() |
TabButton |
getPreviousTabButton() |
Tab |
getTab(int index)
Returns the
Tab at a specific index |
int |
getTotalTabs()
Returns the total number of tabs in this
TabView |
ActionableRenderNode |
hotkey(ControllerButton button)
Returns the corresponding
ActionableRenderNode mapped to a ControllerButton hotkey |
ActionableRenderNode |
hotkey(int keycode)
Returns the corresponding
ActionableRenderNode mapped to a keyboard hotkey |
ActionableRenderNode |
navigate(int keycode)
Triggers a navigation and returns the newly highlighted
ActionableRenderNode |
void |
nextTab()
Navigates to the next
Tab . |
void |
previousTab()
Navigates to the previous
Tab . |
Tab |
remove(int index)
|
boolean |
remove(Tab tab)
|
void |
setCurrentTab(Tab tab)
Sets the currently visible
Tab |
void |
setCurrentTabIndex(int currentTabIndex)
Sets the currently visible
Tab |
void |
setHorizontalLayout(java.lang.String layout)
Sets the current horizontal layout rules
|
void |
setHotkey(ControllerButton button,
Actionable actionable)
Maps a
ControllerButton to a Actionable |
void |
setHotkey(int keycode,
Actionable actionable)
Maps a keyboard button to a
Actionable |
void |
setNextTabButtonLayout(java.lang.String layout) |
void |
setNextTabHotkey(ControllerButton button)
Sets a
ControllerButton as the hotkey for changing to the next tab |
void |
setNextTabHotkey(int keycode)
Sets a keyboard key as the hotkey for changing to the next tab
|
void |
setPreviousTabButtonLayout(java.lang.String layout) |
void |
setPreviousTabHotkey(ControllerButton button)
Sets a
ControllerButton as the hotkey for changing to the previous tab |
void |
setPreviousTabHotkey(int keycode)
Sets a keyboard key as the hotkey for changing to the previous tab
|
void |
setStyleId(java.lang.String styleId)
Sets the style if for this
UiElement |
void |
setTabButtonLayout(java.lang.String layout) |
void |
setVisibility(Visibility visibility)
Sets the current
Visibility of this UiElement |
void |
setZIndex(int zIndex)
Sets the Z index of this
UiElement . |
void |
syncWithRenderNode()
Syncs data between the
UiElement and RenderNode |
void |
unsetHotkey(ControllerButton button)
Unmaps a
ControllerButton hotkey |
void |
unsetHotkey(int keycode)
Unmaps a keyboard hotkey
|
void |
unsetNextTabHotkey(ControllerButton button)
Unets a
ControllerButton as the hotkey for changing to the next tab |
void |
unsetNextTabHotkey(int keycode)
Unsets a keyboard key as the hotkey for changing to the next tab
|
void |
unsetPreviousTabHotkey(ControllerButton button)
Unets a
ControllerButton as the hotkey for changing to the previous tab |
void |
unsetPreviousTabHotkey(int keycode)
Unsets a keyboard key as the hotkey for changing to the previous tab
|
add, add, addAsync, get, getFlexDirection, getTotalChildren, getVerticalLayout, isOverflowClipped, remove, removeAll, removeAllAsync, removeAsync, setFlexDirection, setOverflowClipped, setVerticalLayout
addEffectListener, addHoverListener, applyEffect, defer, defer, equals, getId, getStyleId, getVisibility, getZIndex, hashCode, isDebugEnabled, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, processDeferred, removeEffectListener, removeHoverListener, setDebugEnabled
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getId
protected TabViewRenderNode renderNode
protected final java.util.List<Tab> tabs
public TabView()
TabView
public TabView(java.lang.String id)
id
- The unique ID of this TabView
public void add(int index, Tab tab)
index
- The index to insert attab
- The Tab
to insertpublic boolean remove(Tab tab)
public Tab remove(int index)
remove
in class ParentUiElement
index
- The index to removeTab
that was removedpublic boolean containsTab(Tab tab)
public int getTotalTabs()
TabView
Tab
s have been addedpublic void syncWithRenderNode()
UiElement
UiElement
and RenderNode
syncWithRenderNode
in class ParentUiElement
protected ParentRenderNode<?,?> createRenderNode(ParentRenderNode<?,?> parent)
ParentUiElement
ParentRenderNode
for this UiElement
createRenderNode
in class ParentUiElement
parent
- The parent of this nodeParentRenderNode
public void attach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
for this element to a parent
RenderNode
attach
in class ParentUiElement
parentRenderNode
- The parent RenderNode
to attach topublic void detach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
from a parent
RenderNode
detach
in class ParentUiElement
parentRenderNode
- The parent RenderNode
to detach frompublic void setVisibility(Visibility visibility)
UiElement
Visibility
of this UiElement
setVisibility
in class ParentUiElement
visibility
- The Visibility
to setpublic void setStyleId(java.lang.String styleId)
UiElement
UiElement
setStyleId
in class ParentUiElement
styleId
- The style id to setpublic void setZIndex(int zIndex)
UiElement
UiElement
. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)setZIndex
in class ParentUiElement
zIndex
- The Z indexpublic Tab getCurrentTab()
Tab
Tab
is visiblepublic int getCurrentTabIndex()
Tab
public void setCurrentTabIndex(int currentTabIndex)
Tab
currentTabIndex
- The index of the Tab
public void nextTab()
Tab
. If the current tab is the last tab,
this will loop back to the first tab.public void previousTab()
Tab
. If the current tab is the first
tab, this will loop to the last tab.public ActionableRenderNode navigate(int keycode)
Navigatable
ActionableRenderNode
navigate
in interface Navigatable
keycode
- The navigation Input.Keys
valueUiNavigation
is availablepublic ActionableRenderNode hotkey(int keycode)
Navigatable
ActionableRenderNode
mapped to a keyboard hotkeyhotkey
in interface Navigatable
keycode
- The Input.Keys
keycode that is the hotkeypublic ActionableRenderNode hotkey(ControllerButton button)
Navigatable
ActionableRenderNode
mapped to a ControllerButton
hotkeyhotkey
in interface Navigatable
button
- The ControllerButton
that is the hotkeypublic UiNavigation getNavigation()
Navigatable
UiNavigation
currently being navigatedgetNavigation
in interface Navigatable
public void setPreviousTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void setPreviousTabHotkey(ControllerButton button)
ControllerButton
as the hotkey for changing to the previous tabbutton
- The ControllerButton
public void setNextTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void setNextTabHotkey(ControllerButton button)
ControllerButton
as the hotkey for changing to the next tabbutton
- The ControllerButton
public void unsetPreviousTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void unsetPreviousTabHotkey(ControllerButton button)
ControllerButton
as the hotkey for changing to the previous tabbutton
- The ControllerButton
public void unsetNextTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void unsetNextTabHotkey(ControllerButton button)
ControllerButton
as the hotkey for changing to the next tabbutton
- The ControllerButton
public void setHotkey(ControllerButton button, Actionable actionable)
Navigatable
ControllerButton
to a Actionable
setHotkey
in interface Navigatable
button
- The ControllerButton
that is the hotkeyactionable
- The Actionable
to trigger when the hotkey is pressedpublic void setHotkey(int keycode, Actionable actionable)
Navigatable
Actionable
setHotkey
in interface Navigatable
keycode
- The Input.Keys
keycode that is the hotkeyactionable
- The Actionable
to trigger when the key is pressedpublic void unsetHotkey(ControllerButton button)
Navigatable
ControllerButton
hotkeyunsetHotkey
in interface Navigatable
button
- The ControllerButton
that is the hotkeypublic void unsetHotkey(int keycode)
Navigatable
unsetHotkey
in interface Navigatable
keycode
- The Input.Keys
keycode that is the hotkeypublic void clearControllerHotkeys()
Navigatable
clearControllerHotkeys
in interface Navigatable
public void clearKeyboardHotkeys()
Navigatable
clearKeyboardHotkeys
in interface Navigatable
public void clearHotkeys()
Navigatable
clearHotkeys
in interface Navigatable
public java.lang.String getHorizontalLayout()
ParentUiElement
getHorizontalLayout
in class ParentUiElement
public void setHorizontalLayout(java.lang.String layout)
ParentUiElement
setHorizontalLayout
in class ParentUiElement
public void setPreviousTabButtonLayout(java.lang.String layout)
public void setNextTabButtonLayout(java.lang.String layout)
public void setTabButtonLayout(java.lang.String layout)
public TabButton getPreviousTabButton()
public TabButton getNextTabButton()
public UiElement getElementById(java.lang.String id)
UiElement
UiElement
with a given id. Warning: This
can be an expensive operation for complex UIs. It is recommended you
cache results.getElementById
in class ParentUiElement
id
- The UiElement
identifier to search forUiElement
with the given id