Class PSectionHeader

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PSectionHeader extends JPanel
A panel representing a UI section header, used to separate data on a panel. This component can manifest itself in three different ways:
  • A solid colored bar (normal header)
  • A solid colored bar that can be expanded/collapsed (collapsable header)
  • An opaque bar surrounded by a light border that can be expanded/collapsed (a subheader)
It is up to the caller to determine the layout of this panel, but typical usage would involve a BorderLayout, a "description" panel added to the top (North) and a central panel (Center) that may or may not be collapsed.
For collapsable panels, a box is displayed on the left side containing a +/- symbol. Clicking this box controls the visibility of the component designated as the 'componentToCollapse'.
Version:
%version: 13 % %date_modified: Thu Oct 25 11:49:48 2001 % Continuus information --- %full_filespec: PSectionHeader.java~13:java:2 %
Author:
kapono
See Also:
  • Field Details

    • mHeaderLabel

      protected JComponent mHeaderLabel
    • mExpandState

      protected boolean mExpandState
    • mSubHeader

      protected boolean mSubHeader
    • mExpandable

      protected boolean mExpandable
    • mComp

      protected JComponent mComp
    • mOldBorder

      protected Border mOldBorder
    • adapter

      protected com.portal.ctrl.ButtonAdapter adapter
    • mHeaderComps

      protected JComponent[] mHeaderComps
    • SIZER

      protected static final JButton SIZER
    • UI

      protected static final ButtonUI UI
    • PREFERRED_SIZE

      protected static final Dimension PREFERRED_SIZE
    • sFm

      protected static FontMetrics sFm
    • HALF_SIZE

      protected static final int HALF_SIZE
      See Also:
    • FULL_SIZE

      protected static final int FULL_SIZE
      See Also:
    • SIZE

      protected static final int SIZE
      See Also:
  • Constructor Details

    • PSectionHeader

      public PSectionHeader()
      Creates a standard header component. By default, this is a regular header component. You can choose to make it expandable, or turn it into a subheader component via method calls after creating it.
    • PSectionHeader

      public PSectionHeader(JComponent c)
      Creates a collapsable header component, with the passed in component being designated as the 'collapsable' component
      Parameters:
      c - The component that should be collapsed when requested by the user.
  • Method Details

    • getPreferredSize

      public Dimension getPreferredSize()
      Returns the preferred size for a PSectionHeader. Uses JButton height and Font height to calculate a preferred size so that all PSectionHeader's will have a consistent size.
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      preferred size.
    • setComponentToCollapse

      public void setComponentToCollapse(JComponent c)
      Specifies the component to collapse
      Parameters:
      c - The component that should be collapsed when requested by the user.
    • getComponentToCollapse

      public JComponent getComponentToCollapse()
      Retrieves the collapsable component
      Returns:
      The component that is collapsed/expanded
    • setHeaderExpandable

      public void setHeaderExpandable(boolean b)
      Identifies this header instance as being expandable or not. By default, a header is not expandable. Note that this is mutually exclusive as it relates to subheaders - they are always expandable.
      Parameters:
      b -
    • isHeaderExpandable

      public boolean isHeaderExpandable()
      Determines if this header component contains an expand control
      Returns:
      Returns the expandle state of this header component
    • setSubHeader

      public void setSubHeader(boolean b)
      Used to turn this section header into a subheader. The visual representation will include an expand/collapse control, and a border instead of a solid colored background.
      By default, this is false.
      Parameters:
      b - If true, make a subheader; if false, make this a regular header
    • isSubHeader

      public boolean isSubHeader()
      Retrieves the subheader status of this component
      Returns:
      true if this is a subheader, false otherwise
    • setExpanded

      public void setExpanded(boolean b)
      This gets invoked by the lookinvalid input: '&feel' when the user selects the +/- button.
      Parameters:
      b - When true, expand the component; when false, collapse it
    • isExpanded

      public boolean isExpanded()
      Returns the visible state of the component to collapse
      Returns:
      true if the component to collapse is visible; false otherwise
    • setHeaderLabel

      public void setHeaderLabel(JComponent l)
      Identifies the component that displays the title for this header. This is a convenience API that will apply the correct system Font style for the title label.
      Parameters:
      The - label component
    • setHeaderComponents

      public void setHeaderComponents(JComponent[] comps)
    • addNotify

      public void addNotify()
      Overridden to apply the font style to the header label, and the correct look and feel color to the components in the header
      Overrides:
      addNotify in class JComponent