Class symantec.itools.awt.BaseTabbedPanel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.BaseTabbedPanel

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----Panel
                           |
                           +----symantec.itools.awt.BaseTabbedPanel

public abstract class BaseTabbedPanel
extends Panel
BaseTabbedPanel is a Panel extension which provides for a tabbed dialog effect. It provides the visual aspect of tabs and allows the programmer to decide what action to take when a tab is activated. It can be used directly or extended. When extending from BaseTabbedPanel be sure to super() during construction and to super.handleEvent(evt) from handleEvent if you override it.

To add a new tab to the panel use the addTab() method. To update an existing tab use the setLabel() or setTab() method. To remove tabs use the removeTab() or removeAllTabs() method.

To enable or disable a tab use the setEnabled() method.

To show (activate) a tab use the showTab() method.

Version:
1.1, July 19, 1997
Author:
Symantec, Scott Fauerbach

Variable Index

 o BOTTOM
Position constant indicating tabs are to be put at the bottom of this panel.
 o ROUNDED
Style constant indicating tabs are to have rounded corners.
 o SQUARE
Style constant indicating tabs are to have square corners.
 o TF_BOTTOM
Internal tab margin constant.
 o TF_BTN_HEIGHT
Internal tab margin constant.
 o TF_LEFT
Internal tab margin constant.
 o TF_RIGHT
Internal tab margin constant.
 o TF_TOP
Internal tab margin constant.
 o TOP
Position constant indicating tabs are to be put at the top of this panel.
 o borderDarkColor
Color used in drawing of the border.
 o borderDarkerColor
Color used in drawing of the border.
 o borderLightColor
Color used in drawing of the border.
 o cachedBackground
Cached value of the background color.
 o cachedForeground
Cached value of the foreground color.
 o curIndex
Zero-relative index of currently shown tab.
 o dbLeft
A left-pointing button shown when there are too many tabs to display.
 o dbRight
A right-pointing button shown when there are too many tabs to display.
 o disabledTextColor
Color used in drawing of the disabled text.
 o fReg
The font used for drawing tab titles when they are not selected.
 o fSel
The font used for drawing tab titles when they are selected.
 o firstVisibleTab
The zero-relative index of the first visible tab.
 o nullPoly
An empty polygon.
 o suppressRepaints
A flag indicating repaints should be suppress during the setLabel() and setEnabled() methods.
 o vLabels
A Vector of tab label Strings.
 o vPolys
A Vector of Polygons, one for each tab.

Constructor Index

 o symantec.itools.awt.BaseTabbedPanel()
Constructs a BaseTabbedPanel with tabs on top and rounded.
 o symantec.itools.awt.BaseTabbedPanel(boolean)
 o symantec.itools.awt.BaseTabbedPanel(int, int)
Constructs a BaseTabbedPanel with the desired tab position and corner style.

Method Index

 o add(Component)
Takes no action, use addTab().
 o add(Component, int)
Takes no action, use addTab().
 o add(String, Component)
Takes no action, use addTab().
 o addCurrentTabListener(PropertyChangeListener)
Adds a listener for the CurrentTab property changes.
 o addCurrentTabListener(VetoableChangeListener)
Adds a vetoable listener for the CurrentTab property changes.
 o addNotify()
Tells this component that it has been added to a container.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all property changes.
 o addTab(String, boolean)
Appends a new tab and sets whether it is enabled.
 o addTab(String, boolean, int)
Adds a new tab at the specified position and sets whether it is enabled.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all property changes.
 o calculateBorderColors(Color)
Used to calculate the border colors from the background color.
 o calculateDisabledTextColor(Color)
Used to calculate the disabled text color from the foreground color.
 o calculateMakeTabVisible(int)
Determines the first tab that must be visible in order to make the given tab visible.
 o currentTabIndex()
 o enableTab(boolean, int)
 o getCurrentTab()
Determine the currently shown tab.
 o getLabel(int)
Gets the label of the tab at the specified index.
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o getTabsPosition()
Gets the current tabs position, TOP or BOTTOM.
 o getTabsStyle()
Gets the current tab style, ROUNDED or SQUARE.
 o insertTab(String, boolean, int)
Inserts a tab before the tab at the specified index.
 o insets()
Returns the amount of space used by the current border.
 o isEnabled(int)
Determines whether or not the tab at the index is enabled.
 o layout()
Handles the laying out of components within this component.
 o minimumSize()
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
 o remove(Component)
Removes the specified component from this container.
 o removeAll()
Removes all the components from this container.
 o removeAllTabs()
Removes all tabs.
 o removeCurrentTabListener(PropertyChangeListener)
Removes a listener for the CurrentTab property changes.
 o removeCurrentTabListener(VetoableChangeListener)
Removes a vetoable listener for the CurrentTab property changes.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all property changes.
 o removeTab(int)
Removes the tab at the specified index.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all property changes.
 o setCurrentTab(int)
Shows the tab at the specified index.
 o setEnabled(boolean, int)
Conditionally enables the tab at the specified index.
 o setLabel(String, int)
Changes the label of the tab at the specified index.
 o setLayout(LayoutManager)
Takes no action.
 o setPanel(Component)
Adds the panel to the base panel and shows it.
 o setSuppressRepaints(boolean)
Sets whether to suppress repainting when making changes to this component that affect its display.
 o setTab(String, boolean, int)
Labels and conditionally enables the tab at the specified index.
 o setTabsInfo(int, int)
Sets the position and style of all the tabs.
 o setTabsPosition(int)
Sets the position of the all tabs to the top or bottom of this panel.
 o setTabsStyle(int)
Sets the style of the tabs to ROUNDED or SQUARE.
 o showPanel(Component)
Adds the panel to the base panel and shows it.
 o showTab(int)
 o tabIsEnabled(int)
 o triggerRepaint()
Helper method to trigger a repaint if it hasn't been suppressed.

Variables

 o BOTTOM
public static final int BOTTOM
Position constant indicating tabs are to be put at the bottom of this panel.

 o ROUNDED
public static final int ROUNDED
Style constant indicating tabs are to have rounded corners.

 o SQUARE
public static final int SQUARE
Style constant indicating tabs are to have square corners.

 o TF_BOTTOM
protected int TF_BOTTOM
Internal tab margin constant.

 o TF_BTN_HEIGHT
protected int TF_BTN_HEIGHT
Internal tab margin constant.

 o TF_LEFT
protected int TF_LEFT
Internal tab margin constant.

 o TF_RIGHT
protected int TF_RIGHT
Internal tab margin constant.

 o TF_TOP
protected int TF_TOP
Internal tab margin constant.

 o TOP
public static final int TOP
Position constant indicating tabs are to be put at the top of this panel.

 o borderDarkColor
protected java.awt.Color borderDarkColor
Color used in drawing of the border.

 o borderDarkerColor
protected java.awt.Color borderDarkerColor
Color used in drawing of the border.

 o borderLightColor
protected java.awt.Color borderLightColor
Color used in drawing of the border.

 o cachedBackground
protected java.awt.Color cachedBackground
Cached value of the background color. Used to determine if calculated colors need to be updated.

 o cachedForeground
protected java.awt.Color cachedForeground
Cached value of the foreground color. Used to determine if calculated colors need to be updated.

 o curIndex
protected int curIndex
Zero-relative index of currently shown tab. -1 if no tabs exist or are shown.

 o dbLeft
protected symantec.itools.awt.DirectionButton dbLeft
A left-pointing button shown when there are too many tabs to display.

 o dbRight
protected symantec.itools.awt.DirectionButton dbRight
A right-pointing button shown when there are too many tabs to display.

 o disabledTextColor
protected java.awt.Color disabledTextColor
Color used in drawing of the disabled text.

 o fReg
protected java.awt.Font fReg
The font used for drawing tab titles when they are not selected.

 o fSel
protected java.awt.Font fSel
The font used for drawing tab titles when they are selected.

 o firstVisibleTab
protected int firstVisibleTab
The zero-relative index of the first visible tab.

 o nullPoly
protected java.awt.Polygon nullPoly
An empty polygon.

 o suppressRepaints
protected transient boolean suppressRepaints
A flag indicating repaints should be suppress during the setLabel() and setEnabled() methods.

 o vLabels
protected java.util.Vector vLabels
A Vector of tab label Strings.

 o vPolys
protected java.util.Vector vPolys
A Vector of Polygons, one for each tab.

Constructors

 o BaseTabbedPanel
public BaseTabbedPanel()
Constructs a BaseTabbedPanel with tabs on top and rounded.

 o BaseTabbedPanel
public BaseTabbedPanel(boolean bTabsOnTop)
Note: BaseTabbedPanel() is deprecated.

See Also:
BaseTabbedPanel(int, int)
 o BaseTabbedPanel
public BaseTabbedPanel(int tabsPostion,
                       int tabsStyle)
Constructs a BaseTabbedPanel with the desired tab position and corner style.

Parameters:
tabsPostion - a constant indicating TOP or BOTTOM tab location
tabsStyle - a constant indicating ROUNDED or SQUARE tabs

Methods

 o add
public java.awt.Component add(Component comp)
Takes no action, use addTab(). This is a standard Java AWT method which gets called to add a component to a container. It is overridden here to do nothing, so the user cannot change the way this container works. Use setPanel, showPanel, addTab, and setTab instead.

Parameters:
comp - the component to add (IGNORED)
Returns:
the component parameter
Overrides:
add in class Container
See Also:
setPanel, showPanel, addTab, setTab, remove
 o add
public synchronized java.awt.Component add(Component comp,
                                           int pos)
Takes no action, use addTab(). This is a standard Java AWT method which gets called to add a component to a container. It is overridden here to do nothing, so the user cannot change the way this container works. Use setPanel, showPanel, addTab, and setTab instead.

Parameters:
comp - the component to add (IGNORED)
pos - the zero-relative index at which to add the component or -1 for end (IGNORED)
Returns:
the component parameter
Overrides:
add in class Container
See Also:
setPanel, showPanel, addTab, setTab, remove
 o add
public synchronized java.awt.Component add(String name,
                                           Component comp)
Takes no action, use addTab(). This is a standard Java AWT method which gets called to add a component to a container. It is overridden here to do nothing, so the user cannot change the way this container works. Use setPanel, showPanel, addTab, and setTab instead.

Parameters:
name - the positioning directive for the layout manager (IGNORED)
comp - the component to add (IGNORED)
Returns:
the component parameter
Overrides:
add in class Container
See Also:
setPanel, showPanel, addTab, setTab, remove
 o addCurrentTabListener
public synchronized void addCurrentTabListener(PropertyChangeListener listener)
Adds a listener for the CurrentTab property changes.

Parameters:
listener - the listener to add.
See Also:
removePropertyChangeListener
 o addCurrentTabListener
public synchronized void addCurrentTabListener(VetoableChangeListener listener)
Adds a vetoable listener for the CurrentTab property changes.

Parameters:
listener - the listener to add.
See Also:
removeVetoableChangeListener
 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to hook-up event listeners.

Overrides:
addNotify in class Panel
See Also:
removeNotify
 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all property changes.

Parameters:
listener - the listener to add.
See Also:
removePropertyChangeListener
 o addTab
public int addTab(String sLabel,
                  boolean bEnabled)
Appends a new tab and sets whether it is enabled.

Parameters:
sLabel - the tab label
bEnabled - enable the tab or not
Returns:
the zero-relative index of the newly added tab
See Also:
setTab, setLabel
 o addTab
public int addTab(String sLabel,
                  boolean bEnabled,
                  int pos)
Adds a new tab at the specified position and sets whether it is enabled.

Parameters:
sLabel - the tab label
bEnabled - enable the tab or not
pos - the zero-relative index for the new tab
Returns:
the zero-relative index of the newly added tab
See Also:
setTab, setLabel
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all property changes.

Parameters:
listener - the listener to add.
See Also:
removeVetoableChangeListener
 o calculateBorderColors
protected void calculateBorderColors(Color c)
Used to calculate the border colors from the background color.

See Also:
paint
 o calculateDisabledTextColor
protected void calculateDisabledTextColor(Color c)
Used to calculate the disabled text color from the foreground color.

See Also:
paint
 o calculateMakeTabVisible
protected int calculateMakeTabVisible(int index)
Determines the first tab that must be visible in order to make the given tab visible.

Parameters:
index - the zero-relative tab index
Returns:
the zero-relative index of the first visible tab
 o currentTabIndex
public int currentTabIndex()
Note: currentTabIndex() is deprecated.

See Also:
getCurrentTab
 o enableTab
public void enableTab(boolean bEnabled,
                      int index) throws PropertyVetoException
Note: enableTab() is deprecated.

Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
setEnabled(boolean, int)
 o getCurrentTab
public int getCurrentTab()
Determine the currently shown tab.

Returns:
zero-relative index of the currently shown tab
See Also:
setCurrentTab(int)
 o getLabel
public synchronized java.lang.String getLabel(int index)
Gets the label of the tab at the specified index.

Parameters:
index - the zero-relative index of the tab
Returns:
the tab label
See Also:
setLabel
 o getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Overrides:
getMinimumSize in class Container
See Also:
getPreferredSize
 o getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Overrides:
getPreferredSize in class Container
See Also:
getMinimumSize
 o getTabsPosition
public int getTabsPosition()
Gets the current tabs position, TOP or BOTTOM.

Returns:
the position constant TOP or BOTTOM, indicating the current tabs position
See Also:
setTabsPosition, TOP, BOTTOM
 o getTabsStyle
public int getTabsStyle()
Gets the current tab style, ROUNDED or SQUARE.

Returns:
the style constant ROUNDED or SQUARE, indicating the current tab style
See Also:
setTabsStyle, ROUNDED, SQUARE
 o insertTab
public synchronized void insertTab(String sLabel,
                                   boolean bEnabled,
                                   int index)
Inserts a tab before the tab at the specified index.

Parameters:
sLabel - label of the new tab to insert
bEnabled - enable the tab or not
index - the zero-relative index at which the tab will be inserted.
 o insets
public java.awt.Insets insets()
Returns the amount of space used by the current border. This is a standard Java AWT method which gets called to determine the size of the current border. The returned value is the width of each border side in pixels.

Returns:
the current border insets
Overrides:
insets in class Container
 o isEnabled
public boolean isEnabled(int index)
Determines whether or not the tab at the index is enabled.

Parameters:
index - the zero-relative index of the tab
Returns:
true if the tab at the index is enabled
 o layout
public void layout()
Handles the laying out of components within this component. This is a standard Java AWT method which gets called by the AWT when this component is validated with the validate() method.

Overrides:
layout in class Container
See Also:
validate
 o minimumSize
public java.awt.Dimension minimumSize()
Note: minimumSize() is deprecated.

Overrides:
minimumSize in class Container
See Also:
getMinimumSize
 o paint
public synchronized void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its [0,0] coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Container
See Also:
repaint, update
 o preferredSize
public java.awt.Dimension preferredSize()
Note: preferredSize() is deprecated.

Overrides:
preferredSize in class Container
See Also:
getPreferredSize
 o remove
public synchronized void remove(Component comp)
Removes the specified component from this container. This is a standard Java AWT method which gets called to remove a component from a container. When this happens the component's removeNotify() will also get called to indicate component removal.

Parameters:
comp - the component to remove
Overrides:
remove in class Container
See Also:
removeAll, addTab
 o removeAll
public synchronized void removeAll()
Removes all the components from this container. This is a standard Java AWT method which gets called to remove all the components from a container. When this happens each component's removeNotify() will also get called to indicate component removal.

Overrides:
removeAll in class Container
See Also:
remove, addTab
 o removeAllTabs
public void removeAllTabs()
Removes all tabs.

 o removeCurrentTabListener
public synchronized void removeCurrentTabListener(PropertyChangeListener listener)
Removes a listener for the CurrentTab property changes.

Parameters:
listener - the listener to remove.
See Also:
addPropertyChangeListener
 o removeCurrentTabListener
public synchronized void removeCurrentTabListener(VetoableChangeListener listener)
Removes a vetoable listener for the CurrentTab property changes.

Parameters:
listener - the listener to remove.
See Also:
addVetoableChangeListener
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

Overrides:
removeNotify in class Container
See Also:
addNotify
 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all property changes.

Parameters:
listener - the listener to remove.
See Also:
addPropertyChangeListener
 o removeTab
public void removeTab(int index)
Removes the tab at the specified index. The currently shown tab cannot be removed.

Parameters:
index - the zero-relative index of the tab to remove
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all property changes.

Parameters:
listener - the listener to remove.
See Also:
addVetoableChangeListener
 o setCurrentTab
public void setCurrentTab(int index) throws PropertyVetoException
Shows the tab at the specified index. The tab must be enabled for it to be shown.

Parameters:
index - the zero-relative index of the tab to show
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getCurrentTab
 o setEnabled
public synchronized void setEnabled(boolean bEnabled,
                                    int index) throws PropertyVetoException
Conditionally enables the tab at the specified index. The currently active tab cannot be disabled. This performs the same action as enableTab().

Parameters:
bEnable - true to enable, false to disable
index - the zero-relative index of the tab
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setLabel
public synchronized void setLabel(String sLabel,
                                  int index) throws PropertyVetoException
Changes the label of the tab at the specified index.

Parameters:
sLabel - the new label for the specified tab
index - the zero-relative index of the tab
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getLabel, addTab, setTab
 o setLayout
public void setLayout(LayoutManager mgr)
Takes no action. This is a standard Java AWT method which gets called to specify which layout manager should be used to layout the components in standard containers. Since layout managers CANNOT BE USED with this container the standard setLayout has been OVERRIDDEN for this container and does nothing.

Parameters:
mgr - the layout manager to use to layout this container's components (IGNORED)
Overrides:
setLayout in class Container
See Also:
getLayout
 o setPanel
public void setPanel(Component p) throws PropertyVetoException
Adds the panel to the base panel and shows it. Removes all other previous panels from base panel.

Parameters:
p - the panel to add and show
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setSuppressRepaints
public boolean setSuppressRepaints(boolean b)
Sets whether to suppress repainting when making changes to this component that affect its display. If false method calls that might change the appearance of this component automatically repaint the component. If true those repaints are prevented.

Parameters:
b - true to prevent repaints, false to repaint anytime it might be needed.
Returns:
the previous value of the suppress repaints flag
 o setTab
public synchronized void setTab(String sLabel,
                                boolean bEnabled,
                                int index) throws PropertyVetoException
Labels and conditionally enables the tab at the specified index.

Parameters:
sLabel - the tab label
bEnabled - enable the tab or not
index - the zero-relative index of the tab
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
addTab, setLabel
 o setTabsInfo
public void setTabsInfo(int tabsPosition,
                        int tabsStyle)
Sets the position and style of all the tabs. Note that if the tabs are on top they are always rounded.

Parameters:
tabsPosition - a constant indicating TOP or BOTTOM
tabsStyle - a constant indicating ROUNDED or SQUARE
See Also:
getTabsPosition, getTabsStyle, TOP, BOTTOM, ROUNDED, SQUARE
 o setTabsPosition
public void setTabsPosition(int tabsPosition) throws PropertyVetoException
Sets the position of the all tabs to the top or bottom of this panel. Note that if the tabs are on top they are always rounded.

Parameters:
tabsPosition - constant indicating TOP or BOTTOM
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getTabsPosition, TOP, BOTTOM
 o setTabsStyle
public void setTabsStyle(int tabsStyle) throws PropertyVetoException
Sets the style of the tabs to ROUNDED or SQUARE. Note that if the tabs are on top they are always rounded.

Parameters:
tabsStyle - a constant indicating ROUNDED or SQUARE
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getTabsStyle, ROUNDED, SQUARE
 o showPanel
public void showPanel(Component p)
Adds the panel to the base panel and shows it. Hides all other (previous) panels instead of removing them.

Parameters:
p - the Panel to add and show
 o showTab
public void showTab(int index) throws PropertyVetoException
Note: showTab() is deprecated.

Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
setCurrentTab(int)
 o tabIsEnabled
public boolean tabIsEnabled(int index)
Note: tabIsEnabled() is deprecated.

See Also:
isEnabled(int)
 o triggerRepaint
protected void triggerRepaint()
Helper method to trigger a repaint if it hasn't been suppressed.

See Also:
setSuppressRepaints

All Packages  Class Hierarchy  This Package  Previous  Next  Index