All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.widgets.NestedPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----com.ibm.beans.widgets.NestedPanel

public class NestedPanel
extends Panel
implements LayoutManager, MouseListener, PropertyChangeAnnouncer

The NestedPanel class is an enhanced Container class. A NestedPanel container can be expanded or collapsed to control whether its child components are visible. If the child components are visible, it draws a tree diagram connecting them.

Any AWT component (such as Button, TextArea, or Canvas) may be added to the NestedPanel. Arbitrary-depth trees may be drawn using multiple levels of NestedPanels.

A NestedPanel has an (optional) title component and an expander control. The expander control determines whether the non-title child components are visible.

When the panel is collapsed, the expander control is drawn as a raised triangle pointing toward the right. All child components of a collapsed panel are hidden.

When the panel is expanded, the expander control is drawn as a raised triangle pointing downward. All child components of an expanded panel are visible, and a tree diagram is drawn connecting them.


Variable Index

 o NESTED_PANEL_EXPANDED_PROPERTY
Property to notify listeners whenever this panel is expanded or collapsed.

Constructor Index

 o NestedPanel()
Creates a new NestedPanel instance.

Method Index

 o addAfter(Component, Component)
Adds the component to this container after the specified component.
 o addBefore(Component, Component)
Adds the component to this container before the specified component.
 o addFirst(Component)
Adds the component to the top of this container.
 o addImpl(Component, Object, int)
Adds a child component to this object.
 o addLast(Component)
Adds the component to the bottom of this container.
 o addLayoutComponent(String, Component)
Adds a component to the layout.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a PropertyChangeListener object to the listener list.
 o firePropertyChange(String, Object, Object)
Reports a bound property update to any registered listeners.
 o getExpanderSize()
Returns the expander area size for this container.
 o getInsets()
Returns the insets for this container.
 o getLayout()
Returns the layout manager.
 o getLayoutSpacing()
Returns the layout spacing.
 o getMinimumSize()
Returns the minimum size for this container.
 o getPreferredSize()
Returns the preferred size for this container.
 o getTitleComponent()
Returns the title component of this panel.
 o hasChildComponents()
Checks whether this panel has child components other than the title component.
 o isExpanded()
Checks whether this panel is expanded.
 o isNestedPanel(Object)
Checks whether a given object is a NestedPanel instance.
 o layoutContainer(Container)
Performs a layout of the components in a container
 o minimumLayoutSize(Container)
Calculates the minimum size for this layout.
 o mouseClicked(MouseEvent)
Handles the event generated when the mouse button is clicked on a component.
 o mouseEntered(MouseEvent)
Handles the event generated when the mouse pointer enters a component.
 o mouseExited(MouseEvent)
Handles the event generated when the mouse pointer exits a component.
 o mousePressed(MouseEvent)
Handles the event generated when a mouse button is pressed on a component.
 o mouseReleased(MouseEvent)
Handles the event generated when a mouse button is released on a component.
 o paint(Graphics)
Paints this container.
 o preferredLayoutSize(Container)
Calculates the preferred size for this layout.
 o remove(Component)
Removes the specified component from this container.
 o remove(int)
Removes the component at the specified index.
 o removeAll()
Removes all of the the components from this container.
 o removeLayoutComponent(Component)
Removes a component from the layout.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a PropertyChangeListener object from the listener list.
 o setExpanded(boolean)
Sets the expanded state of this panel.
 o setExpanderSize(int)
Sets the expander control size for this container.
 o setLayout(LayoutManager)
Sets the layout manager.
 o setLayoutSpacing(int)
Sets the layout spacing.
 o setTitleComponent(Component)
Sets the title component for this panel.
 o validate()
Validates this container.

Variables

 o NESTED_PANEL_EXPANDED_PROPERTY
 public static final String NESTED_PANEL_EXPANDED_PROPERTY
Property to notify listeners whenever this panel is expanded or collapsed.

Constructors

 o NestedPanel
 public NestedPanel()
Creates a new NestedPanel instance.

Methods

 o addImpl
 protected void addImpl(Component comp,
                        Object constraints,
                        int index)
Adds a child component to this object. This method is overridden so that this panel can control the visibility of child components. The child component visibility is based on whether this panel is expanded or collapsed.

Parameters:
comp - The new child component to be added.
constraints - The layout constraints for the child component.
index - The position index for the child component.
Overrides:
addImpl in class Container
 o addFirst
 public void addFirst(Component comp)
Adds the component to the top of this container.

Parameters:
comp - The component to add.
 o addLast
 public void addLast(Component comp)
Adds the component to the bottom of this container.

Parameters:
comp - The component to add.
 o addBefore
 public void addBefore(Component comp,
                       Component before)
Adds the component to this container before the specified component.

Parameters:
comp - The component to add.
before - Add the new component before this component.
 o addAfter
 public void addAfter(Component comp,
                      Component after)
Adds the component to this container after the specified component.

Parameters:
comp - The component to add.
after - Add the new component after this component.
 o getExpanderSize
 public int getExpanderSize()
Returns the expander area size for this container.

Returns:
The expander area size for this container.
 o getInsets
 public Insets getInsets()
Returns the insets for this container.

Returns:
The insets for this container.
Overrides:
getInsets in class Container
 o getLayout
 public LayoutManager getLayout()
Returns the layout manager. This method is overriden because this component acts as its own layout manager.

Returns:
This component, which is also the layout manager.
Overrides:
getLayout in class Container
 o getLayoutSpacing
 public int getLayoutSpacing()
Returns the layout spacing.

Returns:
The layout spacing.
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size for this container.

Returns:
The preferred size for this container.
Overrides:
getPreferredSize in class Container
 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum size for this container.

Returns:
The minimum size for this container.
Overrides:
getMinimumSize in class Container
 o getTitleComponent
 public Component getTitleComponent()
Returns the title component of this panel.

Returns:
The title component.
 o hasChildComponents
 public boolean hasChildComponents()
Checks whether this panel has child components other than the title component.

Returns:
true if this panel has non-title child components; false otherwise.
 o isExpanded
 public boolean isExpanded()
Checks whether this panel is expanded.

Returns:
true if this panel is expanded; false otherwise.
 o isNestedPanel
 public static boolean isNestedPanel(Object candidate)
Checks whether a given object is a NestedPanel instance.

Parameters:
candidate - The object to be tested.
Returns:
true if the object is a NestedPanel instance; false otherwise.
 o paint
 public void paint(Graphics g)
Paints this container.

Parameters:
g - The graphics context for this container.
Overrides:
paint in class Container
 o remove
 public void remove(Component comp)
Removes the specified component from this container.

Parameters:
comp - The component to be removed.
Overrides:
remove in class Container
 o remove
 public void remove(int index) throws ArrayIndexOutOfBoundsException
Removes the component at the specified index.

Parameters:
index - The index of the component to be removed.
Overrides:
remove in class Container
 o removeAll
 public void removeAll()
Removes all of the the components from this container. This method is overridden to immediately restore the title component (if any). To remove the title component, use the setTitleComponent(null) method.

Overrides:
removeAll in class Container
See Also:
setTitleComponent
 o setExpanded
 public void setExpanded(boolean newExpand)
Sets the expanded state of this panel. This method controls whether the child components are visible.

Parameters:
newExpand -
true if this panel should be expanded; false otherwise.
 o setExpanderSize
 public void setExpanderSize(int newSize)
Sets the expander control size for this container.

Parameters:
newSize - The new expander control size.
 o setLayout
 public void setLayout(LayoutManager ignored)
Sets the layout manager. This method is overridden because this component acts as its own layout manager and does not work well with other layout managers.

Parameters:
ignored - The new layout manager.
Overrides:
setLayout in class Container
 o setLayoutSpacing
 public void setLayoutSpacing(int spacing)
Sets the layout spacing.

Parameters:
spacing - The new layout spacing.
 o setTitleComponent
 public void setTitleComponent(Component newTitle)
Sets the title component for this panel.

Parameters:
newTitle - The new title component.
 o validate
 public void validate()
Validates this container.

Overrides:
validate in class Container
 o addLayoutComponent
 public void addLayoutComponent(String name,
                                Component comp)
Adds a component to the layout.

Parameters:
name - The new component name.
comp - The new component.
 o removeLayoutComponent
 public void removeLayoutComponent(Component comp)
Removes a component from the layout.

Parameters:
comp - The new component.
 o preferredLayoutSize
 public Dimension preferredLayoutSize(Container parent)
Calculates the preferred size for this layout.

Parameters:
parent - The container which this layout manages.
Returns:
The preferred layout size.
 o minimumLayoutSize
 public Dimension minimumLayoutSize(Container parent)
Calculates the minimum size for this layout.

Parameters:
parent - The container which this layout manages.
Returns:
The minimum layout size.
 o layoutContainer
 public void layoutContainer(Container parent)
Performs a layout of the components in a container

Parameters:
parent - The container which this layout manages.
 o mouseClicked
 public void mouseClicked(MouseEvent e)
Handles the event generated when the mouse button is clicked on a component.

Parameters:
e - The mouse event.
 o mouseEntered
 public void mouseEntered(MouseEvent e)
Handles the event generated when the mouse pointer enters a component.

Parameters:
e - The mouse event.
 o mouseExited
 public void mouseExited(MouseEvent e)
Handles the event generated when the mouse pointer exits a component.

Parameters:
e - The mouse event.
 o mousePressed
 public void mousePressed(MouseEvent e)
Handles the event generated when a mouse button is pressed on a component.

Parameters:
e - The mouse event.
 o mouseReleased
 public void mouseReleased(MouseEvent e)
Handles the event generated when a mouse button is released on a component.

Parameters:
e - The mouse event.
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener object to the listener list.

Parameters:
listener - The listener to be added.
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener object from the listener list.

Parameters:
listener - The listener to be removed.
 o firePropertyChange
 public void firePropertyChange(String propertyName,
                                Object oldValue,
                                Object newValue)
Reports a bound property update to any registered listeners. No event should be fired if the old and new values are equal and non-null.

Parameters:
propertyName - The name of the property that was changed.
oldValue - The old value of the property.
newValue - The new value of the property.

All Packages  Class Hierarchy  This Package  Previous  Next  Index