org.millstone.base.ui
Class TabSheet

java.lang.Object
  |
  +--org.millstone.base.ui.AbstractComponent
        |
        +--org.millstone.base.ui.AbstractComponentContainer
              |
              +--org.millstone.base.ui.TabSheet
All Implemented Interfaces:
Component, ComponentContainer, java.util.EventListener, MethodEventSource, Paintable, VariableOwner

public class TabSheet
extends AbstractComponentContainer

Tabsheet component.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Nested Class Summary
 class TabSheet.SelectedTabChangeEvent
          Selected Tab Change event.
static interface TabSheet.SelectedTabChangeListener
          Selected Tab Change Event listener
 
Nested classes inherited from class org.millstone.base.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Nested classes inherited from class org.millstone.base.ui.Component
Component.Listener
 
Nested classes inherited from class org.millstone.base.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Constructor Summary
TabSheet()
          Construct new Tabsheet.
 
Method Summary
 void addComponent(Component c)
          Add a component into this container.
 void addListener(TabSheet.SelectedTabChangeListener listener)
          Add selected tab change listener
 void addTab(Component c, java.lang.String caption, Resource icon)
          Add a new tab into TabSheet.
 boolean areTabsHidden()
          Are tabs hidden.
 void changeVariables(java.lang.Object source, java.util.Map variables)
          Invoked when the value of a variable has changed.
protected  void fireSelectedTabChange()
          Emit options change event.
 java.util.Iterator getComponentIterator()
          Get component container iterator for going trough all the components in the container.
 Component getSelectedTab()
          Get the selected tab
 java.lang.String getTabCaption(Component c)
          Get the caption for a component
 Resource getTabIcon(Component c)
          Get the icon for a component
 java.lang.String getTag()
          Get component UIDL tag.
 void hideTabs(boolean tabsHidden)
          Setter for property tabsHidden.
 void moveComponentsFrom(ComponentContainer source)
          Move all components from another container to this container.
 void paintContent(PaintTarget target)
          Paint the content of this component.
 void removeComponent(Component c)
          Remove a component from this container.
 void removeListener(TabSheet.SelectedTabChangeListener listener)
          Remove selected tab change listener
 void replaceComponent(Component oldComponent, Component newComponent)
          Replace a component in the container with another one without changing position.
 void setSelectedTab(Component c)
          Set the selected tab
 void setTabCaption(Component c, java.lang.String caption)
          Set the caption for a component
 void setTabIcon(Component c, Resource icon)
          Set the icon for a component
 
Methods inherited from class org.millstone.base.ui.AbstractComponentContainer
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, removeAllComponents, removeListener, removeListener
 
Methods inherited from class org.millstone.base.ui.AbstractComponent
addListener, addListener, addListener, addListener, childRequestedRepaint, dependsOn, fireComponentEvent, fireEvent, getApplication, getCaption, getComponentError, getDescription, getDirectDependencies, getErrorMessage, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeDirectDependency, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setDescription, setEnabled, setIcon, setImmediate, setLocale, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.millstone.base.ui.Component
addListener, childRequestedRepaint, getApplication, getCaption, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, setEnabled, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from interface org.millstone.base.terminal.Paintable
addListener, paint, removeListener, requestRepaint, requestRepaintRequests
 
Methods inherited from interface org.millstone.base.terminal.VariableOwner
dependsOn, getDirectDependencies, removeDirectDependency
 

Constructor Detail

TabSheet

public TabSheet()
Construct new Tabsheet. Tabsheet is immediate by default.

Method Detail

getComponentIterator

public java.util.Iterator getComponentIterator()
Get component container iterator for going trough all the components in the container.

Returns:
Iterator of the components inside the container.

removeComponent

public void removeComponent(Component c)
Remove a component from this container.

Specified by:
removeComponent in interface ComponentContainer
Overrides:
removeComponent in class AbstractComponentContainer
Parameters:
c - The component to be removed.
See Also:
ComponentContainer.removeComponent(Component)

addComponent

public void addComponent(Component c)
Add a component into this container. The component is added as a tab where its default tab-caption is the caption of the component.

Specified by:
addComponent in interface ComponentContainer
Overrides:
addComponent in class AbstractComponentContainer
Parameters:
c - The component to be added.
See Also:
ComponentContainer.addComponent(Component)

addTab

public void addTab(Component c,
                   java.lang.String caption,
                   Resource icon)
Add a new tab into TabSheet.

Parameters:
c - The component to be added onto tab.
caption - The caption of the tab.
icon - Set the icon of the tab.

getTag

public java.lang.String getTag()
Get component UIDL tag.

Specified by:
getTag in class AbstractComponent
Returns:
Component UIDL tag as string.

moveComponentsFrom

public void moveComponentsFrom(ComponentContainer source)
Move all components from another container to this container. The components are removed from the other container.

Specified by:
moveComponentsFrom in interface ComponentContainer
Overrides:
moveComponentsFrom in class AbstractComponentContainer
Parameters:
source - The container components are removed from.

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Paint the content of this component.

Overrides:
paintContent in class AbstractComponent
Parameters:
target - target UIDL stream where the component should paint itself to
Throws:
PaintException - The paint operation failed.

areTabsHidden

public boolean areTabsHidden()
Are tabs hidden.

Returns:
Property visibility

hideTabs

public void hideTabs(boolean tabsHidden)
Setter for property tabsHidden.

Parameters:
tabsHidden - True if the tabs should be hidden.

getTabCaption

public java.lang.String getTabCaption(Component c)
Get the caption for a component


setTabCaption

public void setTabCaption(Component c,
                          java.lang.String caption)
Set the caption for a component


getTabIcon

public Resource getTabIcon(Component c)
Get the icon for a component


setTabIcon

public void setTabIcon(Component c,
                       Resource icon)
Set the icon for a component


setSelectedTab

public void setSelectedTab(Component c)
Set the selected tab


getSelectedTab

public Component getSelectedTab()
Get the selected tab


changeVariables

public void changeVariables(java.lang.Object source,
                            java.util.Map variables)
Invoked when the value of a variable has changed.

Specified by:
changeVariables in interface VariableOwner
Overrides:
changeVariables in class AbstractComponent
Parameters:
source - Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
variables - Mapping from variable names to new variable values

replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
Description copied from interface: ComponentContainer
Replace a component in the container with another one without changing position.

This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.

Parameters:
oldComponent - The old component that will be replaced.
newComponent - The new component to be replaced

addListener

public void addListener(TabSheet.SelectedTabChangeListener listener)
Add selected tab change listener

Parameters:
listener - Listener to be added.

removeListener

public void removeListener(TabSheet.SelectedTabChangeListener listener)
Remove selected tab change listener

Parameters:
listener - Listener to be removed.

fireSelectedTabChange

protected void fireSelectedTabChange()
Emit options change event.



Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.