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.
-
NESTED_PANEL_EXPANDED_PROPERTY
- Property to notify listeners whenever this panel is expanded
or collapsed.
-
NestedPanel()
- Creates a new NestedPanel instance.
-
addAfter(Component, Component)
- Adds the component to this container after the specified component.
-
addBefore(Component, Component)
- Adds the component to this container before the specified component.
-
addFirst(Component)
- Adds the component to the top of this container.
-
addImpl(Component, Object, int)
- Adds a child component to this object.
-
addLast(Component)
- Adds the component to the bottom of this container.
-
addLayoutComponent(String, Component)
- Adds a component to the layout.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a PropertyChangeListener object to the listener list.
-
firePropertyChange(String, Object, Object)
- Reports a bound property update to any registered listeners.
-
getExpanderSize()
- Returns the expander area size for this container.
-
getInsets()
- Returns the insets for this container.
-
getLayout()
- Returns the layout manager.
-
getLayoutSpacing()
- Returns the layout spacing.
-
getMinimumSize()
- Returns the minimum size for this container.
-
getPreferredSize()
- Returns the preferred size for this container.
-
getTitleComponent()
- Returns the title component of this panel.
-
hasChildComponents()
- Checks whether this panel has child components other than
the title component.
-
isExpanded()
- Checks whether this panel is expanded.
-
isNestedPanel(Object)
- Checks whether a given object is a NestedPanel instance.
-
layoutContainer(Container)
- Performs a layout of the components in a container
-
minimumLayoutSize(Container)
- Calculates the minimum size for this layout.
-
mouseClicked(MouseEvent)
- Handles the event generated when the mouse button is clicked
on a component.
-
mouseEntered(MouseEvent)
- Handles the event generated when the mouse pointer enters a component.
-
mouseExited(MouseEvent)
- Handles the event generated when the mouse pointer exits a component.
-
mousePressed(MouseEvent)
- Handles the event generated when a mouse button is pressed
on a component.
-
mouseReleased(MouseEvent)
- Handles the event generated when a mouse button is released
on a component.
-
paint(Graphics)
- Paints this container.
-
preferredLayoutSize(Container)
- Calculates the preferred size for this layout.
-
remove(Component)
- Removes the specified component from this container.
-
remove(int)
- Removes the component at the specified index.
-
removeAll()
- Removes all of the the components from this container.
-
removeLayoutComponent(Component)
- Removes a component from the layout.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a PropertyChangeListener object from the listener list.
-
setExpanded(boolean)
- Sets the expanded state of this panel.
-
setExpanderSize(int)
- Sets the expander control size for this container.
-
setLayout(LayoutManager)
- Sets the layout manager.
-
setLayoutSpacing(int)
- Sets the layout spacing.
-
setTitleComponent(Component)
- Sets the title component for this panel.
-
validate()
- Validates this container.
NESTED_PANEL_EXPANDED_PROPERTY
public static final String NESTED_PANEL_EXPANDED_PROPERTY
- Property to notify listeners whenever this panel is expanded
or collapsed.
NestedPanel
public NestedPanel()
- Creates a new NestedPanel instance.
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
addFirst
public void addFirst(Component comp)
- Adds the component to the top of this container.
- Parameters:
- comp - The component to add.
addLast
public void addLast(Component comp)
- Adds the component to the bottom of this container.
- Parameters:
- comp - The component to add.
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.
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.
getExpanderSize
public int getExpanderSize()
- Returns the expander area size for this container.
- Returns:
- The expander area size for this container.
getInsets
public Insets getInsets()
- Returns the insets for this container.
- Returns:
- The insets for this container.
- Overrides:
- getInsets in class Container
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
getLayoutSpacing
public int getLayoutSpacing()
- Returns the layout spacing.
- Returns:
- The layout spacing.
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size for this container.
- Returns:
- The preferred size for this container.
- Overrides:
- getPreferredSize in class Container
getMinimumSize
public Dimension getMinimumSize()
- Returns the minimum size for this container.
- Returns:
- The minimum size for this container.
- Overrides:
- getMinimumSize in class Container
getTitleComponent
public Component getTitleComponent()
- Returns the title component of this panel.
- Returns:
- The title component.
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.
isExpanded
public boolean isExpanded()
- Checks whether this panel is expanded.
- Returns:
-
- true if this panel is expanded;
false otherwise.
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.
paint
public void paint(Graphics g)
- Paints this container.
- Parameters:
- g - The graphics context for this container.
- Overrides:
- paint in class Container
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
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
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
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.
setExpanderSize
public void setExpanderSize(int newSize)
- Sets the expander control size for this container.
- Parameters:
- newSize - The new expander control size.
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
setLayoutSpacing
public void setLayoutSpacing(int spacing)
- Sets the layout spacing.
- Parameters:
- spacing - The new layout spacing.
setTitleComponent
public void setTitleComponent(Component newTitle)
- Sets the title component for this panel.
- Parameters:
- newTitle - The new title component.
validate
public void validate()
- Validates this container.
- Overrides:
- validate in class Container
addLayoutComponent
public void addLayoutComponent(String name,
Component comp)
- Adds a component to the layout.
- Parameters:
- name - The new component name.
- comp - The new component.
removeLayoutComponent
public void removeLayoutComponent(Component comp)
- Removes a component from the layout.
- Parameters:
- comp - The new component.
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.
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.
layoutContainer
public void layoutContainer(Container parent)
- Performs a layout of the components in a container
- Parameters:
- parent - The container which this layout manages.
mouseClicked
public void mouseClicked(MouseEvent e)
- Handles the event generated when the mouse button is clicked
on a component.
- Parameters:
- e - The mouse event.
mouseEntered
public void mouseEntered(MouseEvent e)
- Handles the event generated when the mouse pointer enters a component.
- Parameters:
- e - The mouse event.
mouseExited
public void mouseExited(MouseEvent e)
- Handles the event generated when the mouse pointer exits a component.
- Parameters:
- e - The mouse event.
mousePressed
public void mousePressed(MouseEvent e)
- Handles the event generated when a mouse button is pressed
on a component.
- Parameters:
- e - The mouse event.
mouseReleased
public void mouseReleased(MouseEvent e)
- Handles the event generated when a mouse button is released
on a component.
- Parameters:
- e - The mouse event.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a PropertyChangeListener object to the listener list.
- Parameters:
- listener - The listener to be added.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a PropertyChangeListener object from the listener list.
- Parameters:
- listener - The listener to be removed.
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