public class WTabSheet extends WComponentGroup
Modifier and Type | Class and Description |
---|---|
class |
WTabSheet.WTab
A tab.
|
Modifier and Type | Field and Description |
---|---|
protected com.vaadin.ui.TabSheet.CloseHandler |
closeHandler |
form, INTERNAL_STATE_RECORD_PROPERTY
Constructor and Description |
---|
WTabSheet() |
Modifier and Type | Method and Description |
---|---|
protected com.vaadin.ui.AbstractComponentContainer |
createWidget()
Called once, to create the actual Vaadin component.
|
String |
getCustomErrorMessage(RecordHolder tab) |
String |
getDescription(RecordHolder tab)
Gets the tab's description
|
RecordHolder |
getSelectedTab()
Returns currently selected forms::Tab
|
String |
getStyleName(RecordHolder tab)
Gets the style name of the tab
|
RecordHolder |
getTabByComponent(RecordHolder child)
Gets a tab containing the given content.
|
RecordHolder |
getTabByIndex(Decimal tabIndex)
Gets a tab at the given index.
|
String |
getTabCaption(RecordHolder tab)
Gets the caption of the tab.
|
ClosureHolder |
getTabChangedListener()
Gets the current tab change listener
|
RecordHolder |
getTabContents(RecordHolder tab)
Gets the content of the given tab.
|
Decimal |
getTabIndex(RecordHolder tab) |
ListHolder |
getTabs()
Gets a list of tabs in this tab sheet.
|
com.vaadin.ui.TabSheet |
getWidget()
Gets the Vaadin representation of this component.
|
boolean |
isClosable(RecordHolder tab)
Deprecated.
|
boolean |
isEnabled(RecordHolder tab)
Indicates whether a tab is enabled.
|
boolean |
isVisible(RecordHolder tab)
Indicates whether the tab is visible or not.
|
void |
preventGC(Set<ValueHolder> set)
Override for all components which are actively using some record holders, not directly linked to the model.
|
void |
removeAllComponents()
Removes all components from this component group.
|
void |
removeComponent(RecordHolder child)
Removes the child component from this component group.
|
void |
removeTab(RecordHolder tab)
Removes tab from tab sheet.
|
protected void |
restoreInternalState(Map<String,Object> state)
Restores the UI state of this component which was previously written
by
FormComponent.writeInternalState(Map) . |
void |
setClosable(RecordHolder tab,
boolean closable)
Deprecated.
|
void |
setCustomErrorMessage(RecordHolder tab,
String description)
Set error message to the tab.
|
void |
setDescription(RecordHolder tab,
String description)
Sets the tab's description
|
void |
setEnabled(RecordHolder tab,
boolean enabled)
Sets the enabled flag to a tab.
|
void |
setIcon(RecordHolder tab,
RecordHolder resource)
Sets the tab's icon
|
void |
setSelectedTab(RecordHolder tab)
Selects a tab.
|
void |
setSelectedTabByIndex(Decimal tabIndex)
Selects a tab.
|
void |
setStyleName(RecordHolder tab,
String styleName)
Sets a style name to a tab.
|
void |
setTabCaption(RecordHolder tab,
String caption)
Sets a caption to the tab.
|
void |
setTabChangedListener(ClosureHolder tabChangedListener)
Sets a tab change listener.
|
void |
setVisible(RecordHolder tab,
boolean visible)
Sets visibility to a tab.
|
protected void |
writeInternalState(Map<String,Object> state)
Writes the UI state of this component to the provided map.
|
addComponent, addComponentInt, getChildren, getComponentAt, getComponentCount, getComponents, getExpandRatio, getHasChildrenAdapter, isMargin, isSpacing, restoreChildComponents, setExpandRatio, setMargin, setSpacing, writeChildComponents
addDataErrorMessage, addStyleName, attach, call, clearDataErrorMessages, createEvent, equals, getCaption, getComponentAlignment, getContextClickHandler, getCustomErrorMessage, getDataErrorMessages, getDescription, getExpandRatio, getHeight, getIcon, getModelingId, getNamespace, getStyleName, getTabIndex, getWidth, hashCode, isEnabled, isReadOnly, isVisible, localize, markAsDirty, removeStyleName, restoreState, saveState, setCaption, setComponentAlignment, setContextClickHandler, setContextMenuItems, setCustomErrorMessage, setDescription, setEnabled, setExpandRatio, setHeight, setIcon, setReadOnly, setStyleName, setTabIndex, setVisible, setWidth, toString
public com.vaadin.ui.TabSheet getWidget()
FormComponent
getWidget
in class WComponentGroup
protected com.vaadin.ui.AbstractComponentContainer createWidget()
FormComponent
createWidget
in class WComponentGroup
public void removeComponent(RecordHolder child)
WComponentGroup
removeComponent
in class WComponentGroup
child
- the component to removepublic void removeTab(RecordHolder tab)
tab
- public void removeAllComponents()
WComponentGroup
removeAllComponents
in class WComponentGroup
public RecordHolder getTabByComponent(RecordHolder child)
child
- the content of the tabpublic RecordHolder getTabByIndex(Decimal tabIndex)
tabIndex
- public String getTabCaption(RecordHolder tab)
tab
- public void setTabCaption(RecordHolder tab, String caption)
tab
- caption
- public void setTabChangedListener(ClosureHolder tabChangedListener)
tabChangedListener
- public ClosureHolder getTabChangedListener()
null
if no closure is setpublic RecordHolder getSelectedTab()
public void setSelectedTab(RecordHolder tab)
tab
- the tab to selectpublic void setSelectedTabByIndex(Decimal tabIndex)
tabIndex
- of the tab to selectpublic RecordHolder getTabContents(RecordHolder tab)
tab
- public ListHolder getTabs()
public Decimal getTabIndex(RecordHolder tab)
tab
- public void preventGC(Set<ValueHolder> set)
FormComponent
WTabSheet
maintains a set of opened tabs. These tab records are not referenced
directly from forms::TabSheet and will therefore be garbage-collected. We however need those records to not to be GCed as the user
may ask for them simply by calling getTab(Integer).
Please note that the component definition records (e.g. forms::Button) are already GC-protected and they do not need to be added to this set.
Also, any child components currently attached to the UI are automatically protected and are not required to be registered in the set.preventGC
in class FormComponent
set
- a set of records which are to be GC-prevented, never null. The component should add any records here.
Default implementation does nothing.public boolean isVisible(RecordHolder tab)
tab
- true
if the tab is visiblepublic void setVisible(RecordHolder tab, boolean visible)
tab
- the tabvisible
- public boolean isEnabled(RecordHolder tab)
tab
- true
if the tab is enabledpublic void setEnabled(RecordHolder tab, boolean enabled)
tab
- enabled
- @Deprecated public boolean isClosable(RecordHolder tab)
tab
- true
if the tab is closable@Deprecated public void setClosable(RecordHolder tab, boolean closable)
tab
- closable
- public String getStyleName(RecordHolder tab)
tab
- public void setStyleName(RecordHolder tab, String styleName)
tab
- the tabstyleName
- the style name to set to the tabpublic void setIcon(RecordHolder tab, RecordHolder resource)
tab
- resource
- a resource representing the iconpublic String getDescription(RecordHolder tab)
tab
- public void setDescription(RecordHolder tab, String description)
tab
- description
- the description to setpublic String getCustomErrorMessage(RecordHolder tab)
tab
- public void setCustomErrorMessage(RecordHolder tab, String description)
tab
- description
- protected void writeInternalState(Map<String,Object> state)
FormComponent
Many UI attributes such as size, caption, etc. are not held in the records but are stored exclusively in the Vaadin components. In the records the getter/setter methods of such attributes directly delegate to the underlying component. For the purposes of the Save Document/Todo use case the state of such attributes has to be preserved.
Subclasses should override this method. The overriding method should call
super.writeInternalState(state)
to store the state form the super
class as well. The attributes should be written to the provided state
parameter. The type of the values written to the state
can only by
Java representation of LSPS types. That is java.util.Date
,
java.lang.String
, Decimal
, RecordHolder
,
ListHolder
, ... The name of the attributes stored in the map
should be unique and should not collide with the names used by any
of the superclass. It is the responsibility of the overridden method to ensure
that.
Subclasses overriding this method should also override
FormComponent.restoreInternalState(Map)
and restore the state written
by this method.
writeInternalState
in class WComponentGroup
state
- a map to which this method should write the component's UI state.FormComponent.restoreInternalState(Map)
,
FormComponent.saveState()
protected void restoreInternalState(Map<String,Object> state)
FormComponent
FormComponent.writeInternalState(Map)
.
Subclasses should override and call super.restoreInternalState(state);
restoreInternalState
in class WComponentGroup
state
- a map of attributes and their valuesFormComponent.writeInternalState(Map)
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.