Package muntjac :: Package ui :: Module tab_sheet :: Class TabSheet
[hide private]
[frames] | no frames]

Class TabSheet

source code

                             object --+                    
                                      |                    
                    util.IEventListener --+                
                                          |                
              terminal.paintable.IPaintable --+            
                                              |            
                                 object --+   |            
                                          |   |            
     terminal.variable_owner.IVariableOwner --+            
                                              |            
                                 object --+   |            
                                          |   |            
                terminal.sizeable.ISizeable --+            
                                              |            
                           component.IComponent --+        
                                                  |        
                                     object --+   |        
                                              |   |        
   event.method_event_source.IMethodEventSource --+        
                                                  |        
               abstract_component.AbstractComponent --+    
                                                      |    
                             object --+               |    
                                      |               |    
                    util.IEventListener --+           |    
                                          |           |    
              terminal.paintable.IPaintable --+       |    
                                              |       |    
                                 object --+   |       |    
                                          |   |       |    
     terminal.variable_owner.IVariableOwner --+       |    
                                              |       |    
                                 object --+   |       |    
                                          |   |       |    
                terminal.sizeable.ISizeable --+       |    
                                              |       |    
                           component.IComponent --+   |    
                                                  |   |    
            component_container.IComponentContainer --+    
                                                      |    
abstract_component_container.AbstractComponentContainer --+
                                                          |
                                                         TabSheet
Known Subclasses:

TabSheet component.

Tabs are typically identified by the component contained on the tab (see ComponentContainer), and tab metadata (including caption, icon, visibility, enabledness, closability etc.) is kept in separate {@link ITab} instances.

Tabs added with addComponent get the caption and the icon of the component at the time when the component is created, and these are not automatically updated after tab creation.

A tab sheet can have multiple tab selection listeners and one tab close handler (ICloseHandler), which by default removes the tab from the TabSheet.

The TabSheet can be styled with the .v-tabsheet, .v-tabsheet-tabs and .v-tabsheet-content styles. Themes may also have pre-defined variations of the tab sheet presentation, such as Reindeer.TABSHEET_BORDERLESS, Runo.TABSHEET_SMALL and several other styles in Reindeer.

The current implementation does not load the tabs to the UI before the first time they are shown, but this may change in future releases.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self)
Constructs a new Tabsheet.
source code
 
getComponentIterator(self)
Gets the component container iterator for going through all the components (tab contents).
source code
 
getComponentCount(self)
Gets the number of contained components (tabs).
source code
 
removeComponent(self, c)
Removes a component and its corresponding tab.
source code
 
removeTab(self, tab)
Removes a ITab and the component associated with it, as previously added with addTab, or addComponent.
source code
 
addComponent(self, c)
Adds a new tab into TabSheet.
source code
 
addTab(self, *args)
Adds a new tab into TabSheet.
source code
 
moveComponentsFrom(self, source)
Moves all components from another container to this container.
source code
 
paintContent(self, target)
Paints the content of this component.
source code
 
areTabsHidden(self)
Are the tab selection parts ("tabs") hidden.
source code
 
hideTabs(self, tabsHidden)
Hides or shows the tab selection parts ("tabs").
source code
 
getTabCaption(self, c)
Gets tab caption.
source code
 
setTabCaption(self, c, caption)
Sets tab caption.
source code
 
getTabIcon(self, c)
Gets the icon for a tab.
source code
 
setTabIcon(self, c, icon)
Sets icon for the given component.
source code
 
getTab(self, arg)
Returns the ITab (metadata) for a component.
source code
 
setSelectedTab(self, c)
Sets the selected tab.
source code
 
updateSelection(self)
Checks if the current selection is valid, and updates the selection if the previously selected component is not visible and enabled.
source code
 
getSelectedTab(self)
Gets the selected tab content component.
source code
 
changeVariables(self, source, variables)
Called when one or more variables handled by the implementing class are changed.
source code
 
replaceComponent(self, oldComponent, newComponent)
Replaces a component (tab content) with another.
source code
 
addListener(self, listener, iface=None)
Adds a tab selection listener
source code
 
addCallback(self, callback, eventType=None, *args) source code
 
removeListener(self, listener, iface=None)
Removes a tab selection listener
source code
 
removeCallback(self, callback, eventType=None) source code
 
fireSelectedTabChange(self)
Sends an event that the currently selected tab has changed.
source code
 
setCloseHandler(self, handler)
Provide a custom ICloseHandler for this TabSheet if you wish to perform some additional tasks when a user clicks on a tabs close button, e.g.
source code
 
setTabPosition(self, tab, position)
Sets the position of the tab.
source code
 
getTabPosition(self, tab)
Gets the position of the tab
source code

Inherited from abstract_component_container.AbstractComponentContainer: attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, getInvalidSizedChildren, removeAllComponents, repaintChangedChildTrees, repaintChildTrees, requestRepaintAll, setEnabled, setHeight, setWidth

Inherited from abstract_component.AbstractComponent: __getstate__, __setstate__, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, fireRequestRepaintEvent, focus, getApplication, getCSSHeight, getCSSWidth, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, hasListeners, isEnabled, isImmediate, isReadOnly, isVisible, paint, parseStringSize, registerCallback, registerListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidthUnits, withdrawCallback, withdrawListener

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  CLIENT_WIDGET = None
hash(x)

Inherited from abstract_component.AbstractComponent: SIZE_PATTERN

Inherited from terminal.sizeable.ISizeable: SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS, UNIT_SYMBOLS

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Constructs a new Tabsheet. Tabsheet is immediate by default, and the default close handler removes the tab being closed.

Overrides: object.__init__

getComponentIterator(self)

source code 

Gets the component container iterator for going through all the components (tab contents).

Returns:
the unmodifiable Iterator of the tab content components
Overrides: component_container.IComponentContainer.getComponentIterator

getComponentCount(self)

source code 

Gets the number of contained components (tabs). Consistent with the iterator returned by getComponentIterator.

Returns:
the number of contained components

removeComponent(self, c)

source code 

Removes a component and its corresponding tab.

If the tab was selected, the first eligible (visible and enabled) remaining tab is selected.

Parameters:
  • c - the component to be removed.
Overrides: component_container.IComponentContainer.removeComponent

removeTab(self, tab)

source code 

Removes a ITab and the component associated with it, as previously added with addTab, or addComponent.

If the tab was selected, the first eligible (visible and enabled) remaining tab is selected.

Parameters:
  • tab - the ITab to remove

addComponent(self, c)

source code 

Adds a new tab into TabSheet. IComponent caption and icon are copied to the tab metadata at creation time.

Parameters:
  • c - the component to be added.
Overrides: component_container.IComponentContainer.addComponent

See Also: addTab

addTab(self, *args)

source code 

Adds a new tab into TabSheet.

The first tab added to a tab sheet is automatically selected and a tab selection event is fired.

If the component is already present in the tab sheet, changes its caption and icon and returns the corresponding (old) tab, preserving other tab metadata.

Parameters:
  • args - tuple of the form
    • (c, caption, icon)
      1. the component to be added onto tab - should not be null.
      2. the caption to be set for the component and used rendered in tab bar
      3. the icon to be set for the component and used rendered in tab bar
    • (c, caption, icon, position)
      1. the component to be added onto tab - should not be null.
      2. the caption to be set for the component and used rendered in tab bar
      3. the icon to be set for the component and used rendered in tab bar
      4. the position at where the the tab should be added
    • (c)
      1. the component to be added onto tab - should not be null.
    • (c, position)
      1. the component to be added onto tab - should not be null.
      2. The position where the tab should be added
    • (c, caption)
      1. the component to be added onto tab - should not be null.
      2. the caption to be set for the component and used rendered in tab bar
Returns:
the created ITab

moveComponentsFrom(self, source)

source code 

Moves all components from another container to this container. The components are removed from the other container.

If the source container is a TabSheet, component captions and icons are copied from it.

Parameters:
  • source - the container components are removed from.
Overrides: component_container.IComponentContainer.moveComponentsFrom

paintContent(self, target)

source code 

Paints the content of this component.

Parameters:
  • target - the paint target
Raises:
Overrides: abstract_component.AbstractComponent.paintContent

areTabsHidden(self)

source code 

Are the tab selection parts ("tabs") hidden.

Returns:
true if the tabs are hidden in the UI

hideTabs(self, tabsHidden)

source code 

Hides or shows the tab selection parts ("tabs").

Parameters:
  • tabsHidden - true if the tabs should be hidden

getTabCaption(self, c)

source code 

Gets tab caption. The tab is identified by the tab content component.

Parameters:
  • c - the component in the tab

Deprecated: Use getTab and ITab.getCaption instead.

setTabCaption(self, c, caption)

source code 

Sets tab caption. The tab is identified by the tab content component.

Parameters:
  • c - the component in the tab
  • caption - the caption to set.

Deprecated: Use getTab and ITab.setCaption instead.

getTabIcon(self, c)

source code 

Gets the icon for a tab. The tab is identified by the tab content component.

Parameters:
  • c - the component in the tab

Deprecated: Use getTab and ITab.getIcon instead.

setTabIcon(self, c, icon)

source code 

Sets icon for the given component. The tab is identified by the tab content component.

Parameters:
  • c - the component in the tab
  • icon - the icon to set

Deprecated: Use getTab and ITab.setIcon instead.

getTab(self, arg)

source code 

Returns the ITab (metadata) for a component. The ITab object can be used for setting caption,icon, etc for the tab.

Parameters:
  • arg - the component or the position of the tab

setSelectedTab(self, c)

source code 

Sets the selected tab. The tab is identified by the tab content component.

updateSelection(self)

source code 

Checks if the current selection is valid, and updates the selection if the previously selected component is not visible and enabled. The first visible and enabled tab is selected if the current selection is empty or invalid.

This method does not fire tab change events, but the caller should do so if appropriate.

Returns:
true if selection was changed, false otherwise

getSelectedTab(self)

source code 

Gets the selected tab content component.

Returns:
the selected tab contents

changeVariables(self, source, variables)

source code 

Called when one or more variables handled by the implementing class are changed.

Parameters:
  • source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
  • variables - the Mapping from variable names to new variable values.
Overrides: terminal.variable_owner.IVariableOwner.changeVariables
(inherited documentation)

replaceComponent(self, oldComponent, newComponent)

source code 

Replaces a component (tab content) with another. This can be used to change tab contents or to rearrange tabs. The tab position and some metadata are preserved when moving components within the same TabSheet.

If the oldComponent is not present in the tab sheet, the new one is added at the end.

If the oldComponent is already in the tab sheet but the newComponent isn't, the old tab is replaced with a new one, and the caption and icon of the old one are copied to the new tab.

If both old and new components are present, their positions are swapped.

Parameters:
  • oldComponent - the old component that will be replaced.
  • newComponent - the new component to be replaced.
Overrides: component_container.IComponentContainer.replaceComponent

addListener(self, listener, iface=None)

source code 

Adds a tab selection listener

Parameters:
  • listener - the Listener to be added.
Raises:
  • ValueError - unless method has a match in object
Overrides: event.method_event_source.IMethodEventSource.addListener

addCallback(self, callback, eventType=None, *args)

source code 
Overrides: terminal.paintable.IPaintable.addCallback

removeListener(self, listener, iface=None)

source code 

Removes a tab selection listener

Parameters:
  • listener - the Listener to be removed.
Overrides: event.method_event_source.IMethodEventSource.removeListener

removeCallback(self, callback, eventType=None)

source code 
Overrides: terminal.paintable.IPaintable.removeCallback

setCloseHandler(self, handler)

source code 

Provide a custom ICloseHandler for this TabSheet if you wish to perform some additional tasks when a user clicks on a tabs close button, e.g. show a confirmation dialogue before removing the tab.

To remove the tab, if you provide your own close handler, you must call removeComponent yourself.

The default ICloseHandler for TabSheet will only remove the tab.

setTabPosition(self, tab, position)

source code 

Sets the position of the tab.

Parameters:
  • tab - The tab
  • position - The new position of the tab

getTabPosition(self, tab)

source code 

Gets the position of the tab

Parameters:
  • tab - The tab