com.sibvisions.rad.ui.swing.impl.container
Class SwingTabsetPanel

java.lang.Object
  extended by com.sibvisions.rad.ui.awt.impl.AwtResource<C>
      extended by com.sibvisions.rad.ui.awt.impl.AwtComponent<C>
          extended by com.sibvisions.rad.ui.awt.impl.AwtContainer<C>
              extended by com.sibvisions.rad.ui.swing.impl.SwingComponent<JVxTabbedPane>
                  extended by com.sibvisions.rad.ui.swing.impl.container.SwingTabsetPanel
All Implemented Interfaces:
ITabListener, ComponentListener, KeyListener, MouseListener, EventListener, ITabsetPanel, IAlignmentConstants, IComponent, IContainer, IResource, INamedObject

public class SwingTabsetPanel
extends SwingComponent<JVxTabbedPane>
implements ITabsetPanel, ITabListener

The SwingTabsetPanel is the ITabsetPanel implementation for swing.

See Also:
JTabbedPane, ITabsetPanel

Field Summary
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
eventComponentMoved, eventComponentResized, eventSource, factory, parent
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
resource
 
Fields inherited from interface javax.rad.ui.container.ITabsetPanel
PLACEMENT_BOTTOM, PLACEMENT_LEFT, PLACEMENT_RIGHT, PLACEMENT_TOP, TAB_LAYOUT_SCROLL, TAB_LAYOUT_WRAP
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
SwingTabsetPanel()
          Creates a new instance of SwingTabsetPanel.
 
Method Summary
 void add(IComponent pComponent, Object pConstraints, int pIndex)
          Adds the specified IComponent to this container with the specified constraints at the specified index.
 void closeTab(TabEvent pEvent)
          Invoked when a tab will be closed (before it will be closed).
 void deselectTab(TabEvent pEvent)
          Invoked when a tab will be deselected.
 TabsetHandler eventTabActivated()
          The TabsetHandler for the activated event.
 TabsetHandler eventTabClosed()
          The TabsetHandler for the closed event.
 TabsetHandler eventTabDeactivated()
          The TabsetHandler for the activated event.
 TabsetHandler eventTabMoved()
          The TabsetHandler for the moved event.
 IImage getIconAt(int pIndex)
          Returns the tab icon at pIndex.
 int getSelectedIndex()
          Returns the currently selected index for this tabbedpane.
 int getTabLayoutPolicy()
          Returns the policy used by the tabbedpane to layout the tabs when all the tabs will not fit within a single run.
 int getTabPlacement()
          Gets the tab placement.
 String getTextAt(int pIndex)
          Returns the tab text at pIndex.
 boolean isClosableAt(int pTabPosition)
          Returns whether a tab is closable.
 boolean isDragable()
          Returns whether the tabs are dragable.
 boolean isEnabledAt(int pTabPosition)
          Returns if a tab is en- or disabled.
 boolean isNavigationKeysEnabled()
          Determines whether the navigation with the keyboard is enabled.
 void moveTab(TabEvent pEvent)
          Invoked when a tab was moved from one index to another index.
 void remove(int pIndex)
          Removes the IComponent, specified by index, from this container.
 void selectTab(TabEvent pEvent)
          Invoked when a tab is the curent selected tab.
 void setClosableAt(int pTabPosition, boolean pEnabled)
          Sets a tab closable.
 void setDragable(boolean pDragable)
          Sets a tabs dragable.
 void setEnabledAt(int pTabPosition, boolean pEnabled)
          Sets a tab en- or disabled.
 void setIconAt(int pIndex, IImage pImage)
          Sets the icon at pIndex to pImage which can be null.
 void setNavigationKeysEnabled(boolean pEnabled)
          En- or disables the tab navigation with the keyboard.
 void setSelectedIndex(int pIndex)
          Sets the selected index for this tabbedpane.
 void setTabLayoutPolicy(int pLayoutPolicy)
          Sets the policy which the tabbedpane will use in laying out the tabs when all the tabs will not fit within a single run.
 void setTabPlacement(int pPlacement)
          Sets the tab placement.
 void setTextAt(int pIndex, String pText)
          Sets the text at pIndex to pText which can be null.
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.SwingComponent
capture, getToolTipText, setBackground, setToolTipText
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtContainer
add, add, add, addIntern, checkAdd, getComponent, getComponentCount, getLayout, indexOf, remove, removeAll, removeIntern, setLayout, setLayoutIntern
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
componentHidden, componentMoved, componentResized, componentShown, createImage, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getHorizontalAlignment, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getVerticalAlignment, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, requestFocus, setBounds, setCursor, setEnabled, setEventSource, setFactory, setFocusable, setFont, setForeground, setHorizontalAlignment, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setVerticalAlignment, setVisible, validate
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
equals, getResource, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.IContainer
add, add, add, getComponent, getComponentCount, getLayout, indexOf, remove, removeAll, setLayout
 
Methods inherited from interface javax.rad.ui.IComponent
capture, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, requestFocus, setBackground, setBounds, setCursor, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setToolTipText, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Constructor Detail

SwingTabsetPanel

public SwingTabsetPanel()
Creates a new instance of SwingTabsetPanel.

Method Detail

selectTab

public void selectTab(TabEvent pEvent)
Invoked when a tab is the curent selected tab.

Specified by:
selectTab in interface ITabListener
Parameters:
pEvent - the event

deselectTab

public void deselectTab(TabEvent pEvent)
                 throws Exception
Invoked when a tab will be deselected.

Specified by:
deselectTab in interface ITabListener
Parameters:
pEvent - the event
Throws:
Exception - when the tab should not be deselected

closeTab

public void closeTab(TabEvent pEvent)
              throws Exception
Invoked when a tab will be closed (before it will be closed).

Specified by:
closeTab in interface ITabListener
Parameters:
pEvent - the event
Throws:
Exception - if the close operation is not possible

moveTab

public void moveTab(TabEvent pEvent)
Invoked when a tab was moved from one index to another index.

Specified by:
moveTab in interface ITabListener
Parameters:
pEvent - the event

isEnabledAt

public boolean isEnabledAt(int pTabPosition)
Returns if a tab is en- or disabled.

Specified by:
isEnabledAt in interface ITabsetPanel
Parameters:
pTabPosition - the position of the tab
Returns:
true if the tab is enabled or false if the tab is disabled

setEnabledAt

public void setEnabledAt(int pTabPosition,
                         boolean pEnabled)
Sets a tab en- or disabled.

Specified by:
setEnabledAt in interface ITabsetPanel
Parameters:
pTabPosition - the position of the tab
pEnabled - true to enable and false to disable the tab

getTabPlacement

public int getTabPlacement()
Gets the tab placement.

Specified by:
getTabPlacement in interface ITabsetPanel
Returns:
one of the following values: ITabsetPanel.PLACEMENT_TOP, ITabsetPanel.PLACEMENT_LEFT, ITabsetPanel.PLACEMENT_RIGHT, ITabsetPanel.PLACEMENT_BOTTOM

setTabPlacement

public void setTabPlacement(int pPlacement)
Sets the tab placement.

Specified by:
setTabPlacement in interface ITabsetPanel
Parameters:
pPlacement - one of the following values: ITabsetPanel.PLACEMENT_TOP, ITabsetPanel.PLACEMENT_LEFT, ITabsetPanel.PLACEMENT_RIGHT, ITabsetPanel.PLACEMENT_BOTTOM

getTabLayoutPolicy

public int getTabLayoutPolicy()
Returns the policy used by the tabbedpane to layout the tabs when all the tabs will not fit within a single run.

Specified by:
getTabLayoutPolicy in interface ITabsetPanel
Returns:
the tab layout policy
See Also:
ITabsetPanel.setTabLayoutPolicy(int)

setTabLayoutPolicy

public void setTabLayoutPolicy(int pLayoutPolicy)
Sets the policy which the tabbedpane will use in laying out the tabs when all the tabs will not fit within a single run. Possible values are: The default value, if not set by the UI, is ITabsetPanel.TAB_LAYOUT_WRAP.

Specified by:
setTabLayoutPolicy in interface ITabsetPanel
Parameters:
pLayoutPolicy - the policy used to layout the tabs
See Also:
ITabsetPanel.getTabLayoutPolicy()

getSelectedIndex

public int getSelectedIndex()
Returns the currently selected index for this tabbedpane. Returns -1 if there is no currently selected tab.

Specified by:
getSelectedIndex in interface ITabsetPanel
Returns:
the index of the selected tab
See Also:
ITabsetPanel.setSelectedIndex(int)

setSelectedIndex

public void setSelectedIndex(int pIndex)
Sets the selected index for this tabbedpane. The index must be a valid tab index or -1, which indicates that no tab should be selected (can also be used when there are no tabs in the tabbedpane). If a -1 value is specified when the tabbedpane contains one or more tabs, then the results will be implementation defined.

Specified by:
setSelectedIndex in interface ITabsetPanel
Parameters:
pIndex - the index to be selected
See Also:
ITabsetPanel.getSelectedIndex()

getIconAt

public IImage getIconAt(int pIndex)
Returns the tab icon at pIndex.

Specified by:
getIconAt in interface ITabsetPanel
Parameters:
pIndex - the index of the item being queried
Returns:
the icon at pIndex
See Also:
ITabsetPanel.setIconAt(int, javax.rad.ui.IImage)

setIconAt

public void setIconAt(int pIndex,
                      IImage pImage)
Sets the icon at pIndex to pImage which can be null. This does not set disabled icon at icon. If the new Icon is different than the current Icon and disabled icon is not explicitly set, the LookAndFeel will be asked to generate a disabled Icon. To explicitly set disabled icon, use setDisableIconAt(). An internal exception is raised if there is no tab at that index.

Specified by:
setIconAt in interface ITabsetPanel
Parameters:
pIndex - the tab index where the icon should be set
pImage - the icon to be displayed in the tab
See Also:
ITabsetPanel.getIconAt(int)

isClosableAt

public boolean isClosableAt(int pTabPosition)
Returns whether a tab is closable.

Specified by:
isClosableAt in interface ITabsetPanel
Parameters:
pTabPosition - the position of the tab
Returns:
true if the tab is closable or false if the tab is not closable

setClosableAt

public void setClosableAt(int pTabPosition,
                          boolean pEnabled)
Sets a tab closable.

Specified by:
setClosableAt in interface ITabsetPanel
Parameters:
pTabPosition - the position of the tab
pEnabled - true to set closable and false to be not closable

isDragable

public boolean isDragable()
Returns whether the tabs are dragable.

Specified by:
isDragable in interface ITabsetPanel
Returns:
true if the tabs are dragable or false if the they are not dragable.

setDragable

public void setDragable(boolean pDragable)
Sets a tabs dragable.

Specified by:
setDragable in interface ITabsetPanel
Parameters:
pDragable - true to set the tabs dragable and false prevent.

setTextAt

public void setTextAt(int pIndex,
                      String pText)
Sets the text at pIndex to pText which can be null.

Specified by:
setTextAt in interface ITabsetPanel
Parameters:
pIndex - the tab index where the text should be set
pText - the text to be displayed in the tab
See Also:
ITabsetPanel.getTextAt(int)

getTextAt

public String getTextAt(int pIndex)
Returns the tab text at pIndex.

Specified by:
getTextAt in interface ITabsetPanel
Parameters:
pIndex - the index of the tab
Returns:
the text at pIndex
See Also:
ITabsetPanel.setTextAt(int, String)

setNavigationKeysEnabled

public void setNavigationKeysEnabled(boolean pEnabled)
En- or disables the tab navigation with the keyboard.

Specified by:
setNavigationKeysEnabled in interface ITabsetPanel
Parameters:
pEnabled - true to enable the navigation with the keyboard, otherwise false

isNavigationKeysEnabled

public boolean isNavigationKeysEnabled()
Determines whether the navigation with the keyboard is enabled.

Specified by:
isNavigationKeysEnabled in interface ITabsetPanel
Returns:
true if the keyboard navigation is enabled, otherwise false

eventTabClosed

public TabsetHandler eventTabClosed()
The TabsetHandler for the closed event.

Specified by:
eventTabClosed in interface ITabsetPanel
Returns:
the TabsetHandler for the closed event.

eventTabMoved

public TabsetHandler eventTabMoved()
The TabsetHandler for the moved event.

Specified by:
eventTabMoved in interface ITabsetPanel
Returns:
the TabsetHandler for the moved event.

eventTabActivated

public TabsetHandler eventTabActivated()
The TabsetHandler for the activated event.

Specified by:
eventTabActivated in interface ITabsetPanel
Returns:
the TabsetHandler for the activated event.

eventTabDeactivated

public TabsetHandler eventTabDeactivated()
The TabsetHandler for the activated event.

Specified by:
eventTabDeactivated in interface ITabsetPanel
Returns:
the TabsetHandler for the deactivated event.

add

public void add(IComponent pComponent,
                Object pConstraints,
                int pIndex)
Adds the specified IComponent to this container with the specified constraints at the specified index. Also notifies the layout manager to add the component to the this container's layout using the specified constraints object.

Specified by:
add in interface IContainer
Overrides:
add in class AwtContainer<JVxTabbedPane>
Parameters:
pComponent - the IComponent to be added
pConstraints - an object expressing layout contraints for this
pIndex - the position in the container's list at which to insert the IComponent; -1 means insert at the end component
See Also:
IComponent

remove

public void remove(int pIndex)
Removes the IComponent, specified by index, from this container. This method also notifies the layout manager to remove the component from this container's layout via the removeLayoutComponent method.

Specified by:
remove in interface IContainer
Overrides:
remove in class AwtContainer<JVxTabbedPane>
Parameters:
pIndex - the index of the IComponent to be removed
See Also:
IContainer.add(javax.rad.ui.IComponent), IContainer.getComponentCount()


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.