org.araneaframework.uilib.tab
Class TabContainerWidget
java.lang.Object
org.araneaframework.core.BaseComponent
org.araneaframework.core.BaseService
org.araneaframework.core.BaseWidget
org.araneaframework.core.BaseApplicationWidget
org.araneaframework.uilib.tab.TabContainerWidget
- All Implemented Interfaces:
- Serializable, Component, Composite, Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget, ApplicationComponent, ApplicationService, ApplicationWidget, Service, TabContainerContext, TabRegistrationContext, Viewable, Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget, Widget
public class TabContainerWidget
- extends BaseApplicationWidget
- implements TabContainerContext, TabRegistrationContext
This class represents a UI widget that contains tabs (TabWidget)s.
Only one tab can be selected (active) at a time, such tab is specified with
selectTab(String). When on creation the selected tab is not
specified, the first tab is marked as selected. Tabs are added with
addTab(String, String, Widget), removed with
removeTab(String) and disabled (user cannot select them) with
disableTab(String). By default tabs preserve the addition order and
are also presented in that order. When this TabContainerWidget has a
Comparator set, it will sort and present the tabs in an order
specified by that Comparator.
- Since:
- 1.1
- Author:
- Taimo Peelo (taimo@araneaframework.org)
- See Also:
- Serialized Form
| Methods inherited from class org.araneaframework.core.BaseApplicationWidget |
_getComposite, _getViewable, action, addActionListener, addEventListener, addWidget, addWidget, clearActionListeners, clearEventlisteners, clearGlobalEventListener, event, getActionId, getChildEnvironment, getChildren, getEnvironment, getEventId, getViewModel, getWidget, handleAction, handleEvent, handleUpdate, propagate, putViewData, putViewDataOnce, removeActionListener, removeEventListener, removeViewData, removeWidget, render, setGlobalEventListener, update |
| Methods inherited from class org.araneaframework.core.BaseComponent |
_addComponent, _addComponent, _checkCall, _disableComponent, _enableComponent, _endCall, _endWaitingCall, _getChildren, _getDisabledChildren, _propagate, _relocateComponent, _removeComponent, _setEnvironment, _setScope, _startCall, _startWaitingCall, _strictCheckCall, _strictStartCall, _waitNoCall, destroy, disable, enable, getScope, handleException, init, isAlive, isDead, isInitialized |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TAB_SELECT_EVENT_ID
public static final String TAB_SELECT_EVENT_ID
- See Also:
- Constant Field Values
tabs
protected Map tabs
selected
protected TabWidget selected
dying
protected transient boolean dying
- This is just to make sure that we do not initialize ANY tabs after
destroying process has already begun.
TabContainerWidget
public TabContainerWidget()
TabContainerWidget
public TabContainerWidget(Comparator comparator)
getChildWidgetEnvironment
protected Environment getChildWidgetEnvironment()
throws Exception
- Description copied from class:
BaseApplicationWidget
- Returns the widget's Environment by default. Usually overridden.
- Overrides:
getChildWidgetEnvironment in class BaseApplicationWidget
- Throws:
Exception
selectFirst
protected void selectFirst()
addTab
public void addTab(String id,
String labelId,
Widget contentWidget)
- Description copied from interface:
TabContainerContext
- Adds the stateful tab with specified identifier.
- Specified by:
addTab in interface TabContainerContext
- Parameters:
id - tab identifierlabelId - key to resource text to be used as tab labelcontentWidget - tab's content widget
addTab
public void addTab(String id,
String labelId,
WidgetFactory contentWidgetFactory)
- Description copied from interface:
TabContainerContext
- Adds the stateless (content widget is destroyed when tab is deselected) tab
with specified identifier.
- Specified by:
addTab in interface TabContainerContext
- Parameters:
id - tab identifierlabelId - key to resource text to be used as tab labelcontentWidgetFactory - WidgetFactory that produces tab's
contents.
addTab
public void addTab(String id,
Widget labelWidget,
Widget contentWidget)
- Description copied from interface:
TabContainerContext
- Adds the stateful tab with specified identifier.
- Specified by:
addTab in interface TabContainerContext
- Parameters:
id - tab identifierlabelWidget - tab's label widgetcontentWidget - tab's content widget
addTab
public void addTab(String id,
Widget labelWidget,
WidgetFactory contentWidgetFactory)
- Description copied from interface:
TabContainerContext
- Adds the stateless (content widget is destroyed when tab is deselected) tab
with specified identifier.
- Specified by:
addTab in interface TabContainerContext
- Parameters:
id - tab identifierlabelWidget - tab's label widget
disableTab
public boolean disableTab(String id)
- Description copied from interface:
TabContainerContext
- Disables the tab with given id — the label be shown but tab
cannot be selected before it is enabled again.
- Specified by:
disableTab in interface TabContainerContext
- Returns:
- whether tab with given id existed
enableTab
public boolean enableTab(String id)
- Description copied from interface:
TabContainerContext
- Enables the tab with the id that previously was disabled.
- Specified by:
enableTab in interface TabContainerContext
- Returns:
- whether the tab with given id existed.
removeTab
public boolean removeTab(String id)
- Description copied from interface:
TabContainerContext
- Removes tab with given id.
- Specified by:
removeTab in interface TabContainerContext
- Returns:
- whether the tab existed and was really removed
selectTab
public boolean selectTab(String id)
- Description copied from interface:
TabContainerContext
- Switches selected tab to one identified by id.
- Specified by:
selectTab in interface TabContainerContext
- Returns:
- whether tab with given id existed.
isTabSelected
public boolean isTabSelected(String id)
- Description copied from interface:
TabContainerContext
- Specifies whether the specified tab is currently active (selected).
- Specified by:
isTabSelected in interface TabContainerContext
- Returns:
- whether the specified tab is currently active (selected).
getSelectedTab
public TabContext getSelectedTab()
- Description copied from interface:
TabContainerContext
- Returns the currently selected tab widget, which is the container for the
widget that was added using the
addTab(..) method.
- Specified by:
getSelectedTab in interface TabContainerContext
- Returns:
- The currently selected
TabContext.
getTabs
public Map getTabs()
- Description copied from interface:
TabContainerContext
- Returns all the tabs present in this
TabContainerContext. Keys in
the map are tab identifiers, values are implementation dependent structures
that hold tab information. Returned Map must be
unmodifiable.
- Specified by:
getTabs in interface TabContainerContext
- Returns:
- A map of tabs.
registerTab
public TabWidget registerTab(TabWidget tabWidget)
- Description copied from interface:
TabRegistrationContext
- Invoked by
TabWidget when it is initialized.
- Specified by:
registerTab in interface TabRegistrationContext
- See Also:
TabRegistrationContext.registerTab(org.araneaframework.uilib.tab.TabWidget)
unregisterTab
public TabWidget unregisterTab(TabWidget tabWidget)
- Description copied from interface:
TabRegistrationContext
- Invoked by
TabWidget when it is destroyed.
- Specified by:
unregisterTab in interface TabRegistrationContext
- See Also:
TabRegistrationContext.unregisterTab(org.araneaframework.uilib.tab.TabWidget)
disableWidget
public void disableWidget(Object key)
- Overrides for disableWidget()/enableWidget()
- Overrides:
disableWidget in class BaseApplicationWidget
enableWidget
public void enableWidget(Object key)
- Description copied from class:
BaseApplicationWidget
- Enables the widget with the specified key. Only a disabled widgets can be enabled.
- Overrides:
enableWidget in class BaseApplicationWidget
_getComponent
public Component.Interface _getComponent()
- Description copied from interface:
Component
- The factory method returning the implementation of the Component.
- Specified by:
_getComponent in interface Component- Overrides:
_getComponent in class BaseComponent
- Returns:
- the implementation of the Component.