All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sgi.sysadm.ui.RPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----javax.swing.JComponent
                           |
                           +----javax.swing.JPanel
                                   |
                                   +----com.sgi.sysadm.ui.RPanel

public class RPanel
extends JPanel
implements DynamicSize
RPanel is a subclass of JPanel which handles children which are dynamically sizable, meaning that their height depends on their width and they implement the DynamicSize interface. Normal Components are handled as well.

Since RPanel itself implements DynamicSize, RPanels can be nested inside one another and cooperate to implement multiple levels of dynamic sizing.

In order to properly implement dynamic sizing, RPanel must be used in conjunction with a LayoutManager that implements the DynamicSizeLayoutManager interface.

See Also:
DynamicSize, DynamicSizeLayoutManager

Constructor Index

 o RPanel()

Method Index

 o getPreferredHeight(int)
Get the preferred height of this RPanel given a width.
 o getPreferredSize()
Get the preferred size of this RPanel.
 o setPreferredWidth(int)
Set the preferred width of this component.
 o setupSizing(ResourceStack, String, String, String)
setupSizing looks up resources on the resource stack and sets the size of this RPanel accordingly.

Constructors

 o RPanel
 public RPanel()

Methods

 o getPreferredSize
 public Dimension getPreferredSize()
Get the preferred size of this RPanel. If setPreferredWidth has been called, and if the LayoutManager implements the DynamicSizeLayoutManager interface, this will calculate the height based on the width passed to setPreferredWidth.

Returns:
Preferred size of this panel.
Overrides:
getPreferredSize in class JComponent
 o getPreferredHeight
 public int getPreferredHeight(int width)
Get the preferred height of this RPanel given a width. This method will fail with a ClassCastException if this RPanel's LayoutManager does not implement the DynamicSizeLayoutManager interface.

Parameters:
width - Proposed width
Returns:
height we'd like to be if we're width wide.
 o setPreferredWidth
 public void setPreferredWidth(int width)
Set the preferred width of this component. Calling this method causes RPanel to use getPreferredHeight in its implementation of getPreferredSize. This means that getPreferredSize will throw a ClassCastException if this RPanel's LayoutManager does not implement the DynamicSizeLayoutManager interface.

Parameters:
width - Preferred width for this panel.
 o setupSizing
 public void setupSizing(ResourceStack rs,
                         String dynamicSizeResource,
                         String widthResource,
                         String heightResource)
setupSizing looks up resources on the resource stack and sets the size of this RPanel accordingly.

Parameters:
rs - resource stack for resources.
dynamicSizeResource - Boolean resource which determines whether we will do dynamic sizing.
widthResource - Integer resource determines width in points, which will be used in all cases.
heightResource - If dynamicSizing is off, and the heightResource is present, heightResource determines fixed height of this RPanel. If heightResource is not present, golden ratio is used.

All Packages  Class Hierarchy  This Package  Previous  Next  Index