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
-
BOTTOM
- Position constant indicating tabs are to be put at the bottom of this panel.
-
ROUNDED
- Style constant indicating tabs are to have rounded corners.
-
SQUARE
- Style constant indicating tabs are to have square corners.
-
TF_BOTTOM
- Internal tab margin constant.
-
TF_BTN_HEIGHT
- Internal tab margin constant.
-
TF_LEFT
- Internal tab margin constant.
-
TF_RIGHT
- Internal tab margin constant.
-
TF_TOP
- Internal tab margin constant.
-
TOP
- Position constant indicating tabs are to be put at the top of this panel.
-
borderDarkColor
- Color used in drawing of the border.
-
borderDarkerColor
- Color used in drawing of the border.
-
borderLightColor
- Color used in drawing of the border.
-
cachedBackground
- Cached value of the background color.
-
cachedForeground
- Cached value of the foreground color.
-
curIndex
- Zero-relative index of currently shown tab.
-
dbLeft
- A left-pointing button shown when there are too many tabs to display.
-
dbRight
- A right-pointing button shown when there are too many tabs to display.
-
disabledTextColor
- Color used in drawing of the disabled text.
-
fReg
- The font used for drawing tab titles when they are not selected.
-
fSel
- The font used for drawing tab titles when they are selected.
-
firstVisibleTab
- The zero-relative index of the first visible tab.
-
nullPoly
- An empty polygon.
-
suppressRepaints
- A flag indicating repaints should be suppress during the setLabel()
and setEnabled() methods.
-
vLabels
- A Vector of tab label Strings.
-
vPolys
- A Vector of Polygons, one for each tab.
-
symantec.itools.awt.BaseTabbedPanel()
- Constructs a BaseTabbedPanel with tabs on top and rounded.
-
symantec.itools.awt.BaseTabbedPanel(boolean)
-
-
symantec.itools.awt.BaseTabbedPanel(int, int)
- Constructs a BaseTabbedPanel with the desired tab position
and corner style.
-
add(Component)
- Takes no action, use addTab().
-
add(Component, int)
- Takes no action, use addTab().
-
add(String, Component)
- Takes no action, use addTab().
-
addCurrentTabListener(PropertyChangeListener)
- Adds a listener for the CurrentTab property changes.
-
addCurrentTabListener(VetoableChangeListener)
- Adds a vetoable listener for the CurrentTab property changes.
-
addNotify()
- Tells this component that it has been added to a container.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener for all property changes.
-
addTab(String, boolean)
- Appends a new tab and sets whether it is enabled.
-
addTab(String, boolean, int)
- Adds a new tab at the specified position and sets whether it is enabled.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a vetoable listener for all property changes.
-
calculateBorderColors(Color)
- Used to calculate the border colors from the background color.
-
calculateDisabledTextColor(Color)
- Used to calculate the disabled text color from the foreground color.
-
calculateMakeTabVisible(int)
- Determines the first tab that must be visible in order to make
the given tab visible.
-
currentTabIndex()
-
-
enableTab(boolean, int)
-
-
getCurrentTab()
- Determine the currently shown tab.
-
getLabel(int)
- Gets the label of the tab at the specified index.
-
getMinimumSize()
- Returns the minimum dimensions to properly display this component.
-
getPreferredSize()
- Returns the recommended dimensions to properly display this component.
-
getTabsPosition()
- Gets the current tabs position, TOP or BOTTOM.
-
getTabsStyle()
- Gets the current tab style, ROUNDED or SQUARE.
-
insertTab(String, boolean, int)
- Inserts a tab before the tab at the specified index.
-
insets()
- Returns the amount of space used by the current border.
-
isEnabled(int)
- Determines whether or not the tab at the index is enabled.
-
layout()
- Handles the laying out of components within this component.
-
minimumSize()
-
-
paint(Graphics)
- Paints this component using the given graphics context.
-
preferredSize()
-
-
remove(Component)
- Removes the specified component from this container.
-
removeAll()
- Removes all the components from this container.
-
removeAllTabs()
- Removes all tabs.
-
removeCurrentTabListener(PropertyChangeListener)
- Removes a listener for the CurrentTab property changes.
-
removeCurrentTabListener(VetoableChangeListener)
- Removes a vetoable listener for the CurrentTab property changes.
-
removeNotify()
- Tells this component that it is being removed from a container.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a listener for all property changes.
-
removeTab(int)
- Removes the tab at the specified index.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable listener for all property changes.
-
setCurrentTab(int)
- Shows the tab at the specified index.
-
setEnabled(boolean, int)
- Conditionally enables the tab at the specified index.
-
setLabel(String, int)
- Changes the label of the tab at the specified index.
-
setLayout(LayoutManager)
- Takes no action.
-
setPanel(Component)
- Adds the panel to the base panel and shows it.
-
setSuppressRepaints(boolean)
- Sets whether to suppress repainting when making changes to this component
that affect its display.
-
setTab(String, boolean, int)
- Labels and conditionally enables the tab at the specified index.
-
setTabsInfo(int, int)
- Sets the position and style of all the tabs.
-
setTabsPosition(int)
- Sets the position of the all tabs to the top or bottom of this panel.
-
setTabsStyle(int)
- Sets the style of the tabs to ROUNDED or SQUARE.
-
showPanel(Component)
- Adds the panel to the base panel and shows it.
-
showTab(int)
-
-
tabIsEnabled(int)
-
-
triggerRepaint()
- Helper method to trigger a repaint if it hasn't been suppressed.
BOTTOM
public static final int BOTTOM
- Position constant indicating tabs are to be put at the bottom of this panel.
ROUNDED
public static final int ROUNDED
- Style constant indicating tabs are to have rounded corners.
SQUARE
public static final int SQUARE
- Style constant indicating tabs are to have square corners.
TF_BOTTOM
protected int TF_BOTTOM
- Internal tab margin constant.
TF_BTN_HEIGHT
protected int TF_BTN_HEIGHT
- Internal tab margin constant.
TF_LEFT
protected int TF_LEFT
- Internal tab margin constant.
TF_RIGHT
protected int TF_RIGHT
- Internal tab margin constant.
TF_TOP
protected int TF_TOP
- Internal tab margin constant.
TOP
public static final int TOP
- Position constant indicating tabs are to be put at the top of this panel.
borderDarkColor
protected java.awt.Color borderDarkColor
- Color used in drawing of the border.
borderDarkerColor
protected java.awt.Color borderDarkerColor
- Color used in drawing of the border.
borderLightColor
protected java.awt.Color borderLightColor
- Color used in drawing of the border.
cachedBackground
protected java.awt.Color cachedBackground
- Cached value of the background color. Used to determine if calculated colors need to be updated.
cachedForeground
protected java.awt.Color cachedForeground
- Cached value of the foreground color. Used to determine if calculated colors need to be updated.
curIndex
protected int curIndex
- Zero-relative index of currently shown tab. -1 if no tabs exist or are shown.
dbLeft
protected symantec.itools.awt.DirectionButton dbLeft
- A left-pointing button shown when there are too many tabs to display.
dbRight
protected symantec.itools.awt.DirectionButton dbRight
- A right-pointing button shown when there are too many tabs to display.
disabledTextColor
protected java.awt.Color disabledTextColor
- Color used in drawing of the disabled text.
fReg
protected java.awt.Font fReg
- The font used for drawing tab titles when they are not selected.
fSel
protected java.awt.Font fSel
- The font used for drawing tab titles when they are selected.
firstVisibleTab
protected int firstVisibleTab
- The zero-relative index of the first visible tab.
nullPoly
protected java.awt.Polygon nullPoly
- An empty polygon.
suppressRepaints
protected transient boolean suppressRepaints
- A flag indicating repaints should be suppress during the setLabel()
and setEnabled() methods.
vLabels
protected java.util.Vector vLabels
- A Vector of tab label Strings.
vPolys
protected java.util.Vector vPolys
- A Vector of Polygons, one for each tab.
BaseTabbedPanel
public BaseTabbedPanel()
- Constructs a BaseTabbedPanel with tabs on top and rounded.
BaseTabbedPanel
public BaseTabbedPanel(boolean bTabsOnTop)
- Note: BaseTabbedPanel() is deprecated.
-
- See Also:
- BaseTabbedPanel(int, int)
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
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
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
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
addCurrentTabListener
public synchronized void addCurrentTabListener(PropertyChangeListener listener)
- Adds a listener for the CurrentTab property changes.
- Parameters:
- listener - the listener to add.
- See Also:
- removePropertyChangeListener
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
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
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener for all property changes.
- Parameters:
- listener - the listener to add.
- See Also:
- removePropertyChangeListener
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
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
addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a vetoable listener for all property changes.
- Parameters:
- listener - the listener to add.
- See Also:
- removeVetoableChangeListener
calculateBorderColors
protected void calculateBorderColors(Color c)
- Used to calculate the border colors from the background color.
- See Also:
- paint
calculateDisabledTextColor
protected void calculateDisabledTextColor(Color c)
- Used to calculate the disabled text color from the foreground color.
- See Also:
- paint
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
currentTabIndex
public int currentTabIndex()
- Note: currentTabIndex() is deprecated.
-
- See Also:
- getCurrentTab
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)
getCurrentTab
public int getCurrentTab()
- Determine the currently shown tab.
- Returns:
- zero-relative index of the currently shown tab
- See Also:
- setCurrentTab(int)
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
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
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
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
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
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.
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
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
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
minimumSize
public java.awt.Dimension minimumSize()
- Note: minimumSize() is deprecated.
-
- Overrides:
- minimumSize in class Container
- See Also:
- getMinimumSize
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
preferredSize
public java.awt.Dimension preferredSize()
- Note: preferredSize() is deprecated.
-
- Overrides:
- preferredSize in class Container
- See Also:
- getPreferredSize
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
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
removeAllTabs
public void removeAllTabs()
- Removes all tabs.
removeCurrentTabListener
public synchronized void removeCurrentTabListener(PropertyChangeListener listener)
- Removes a listener for the CurrentTab property changes.
- Parameters:
- listener - the listener to remove.
- See Also:
- addPropertyChangeListener
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
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
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener for all property changes.
- Parameters:
- listener - the listener to remove.
- See Also:
- addPropertyChangeListener
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
removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable listener for all property changes.
- Parameters:
- listener - the listener to remove.
- See Also:
- addVetoableChangeListener
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
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
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
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
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
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
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
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
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
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
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
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)
tabIsEnabled
public boolean tabIsEnabled(int index)
- Note: tabIsEnabled() is deprecated.
-
- See Also:
- isEnabled(int)
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