Class DeckLayout

java.lang.Object
java.awt.CardLayout
com.portal.pfc.ui.wizard.DeckLayout
All Implemented Interfaces:
LayoutManager, LayoutManager2, Serializable

public class DeckLayout extends CardLayout
DeckLayout treats each component in the container as a card. Only one card is visible at a time, and the container acts like a deck of cards. The ordering of cards is determined by the container's own internal ordering of its component objects. DeckLayout defines a set of methods that allow an application to flip through the cards sequentially, or to show a specified card. The addLayoutComponent method can be used to associate a string identifier with a given card for faster random access.
See Also:
  • Field Details

    • mCompMap

      protected HashMap mCompMap
  • Constructor Details

    • DeckLayout

      public DeckLayout()
  • Method Details

    • addLayoutComponent

      public void addLayoutComponent(Component comp, Object constraints)
      Adds the specified component to this deck layout's internal table, by name. The object specified by constraints must be a string. The deck layout stores this string as a key-value pair that can be used for random access to a particular card. By calling the show method, an application can display the component with the specified name.
      Specified by:
      addLayoutComponent in interface LayoutManager2
      Overrides:
      addLayoutComponent in class CardLayout
      Parameters:
      comp - The component to be added.
      constraints - A name that identifies the component
    • addLayoutComponent

      public void addLayoutComponent(String name, Component comp)
      Deprecated.
      replaced by addLayoutComponent(Component, Object)
      Specified by:
      addLayoutComponent in interface LayoutManager
      Overrides:
      addLayoutComponent in class CardLayout
    • removeLayoutComponent

      public void removeLayoutComponent(Component comp)
      Removes the specified component from the layout.
      Specified by:
      removeLayoutComponent in interface LayoutManager
      Overrides:
      removeLayoutComponent in class CardLayout
      Parameters:
      comp - The component to be removed.
    • preferredLayoutSize

      public Dimension preferredLayoutSize(Container parent)
      Calculates the preferred size for the specified panel.
      Specified by:
      preferredLayoutSize in interface LayoutManager
      Overrides:
      preferredLayoutSize in class CardLayout
      Parameters:
      parent - The name of the parent container
      Returns:
      minimum dimensions required to lay out the components.
    • minimumLayoutSize

      public Dimension minimumLayoutSize(Container parent)
      Calculates the minimum size for the specified panel.
      Specified by:
      minimumLayoutSize in interface LayoutManager
      Overrides:
      minimumLayoutSize in class CardLayout
      Parameters:
      parent - The name of the parent container
      Returns:
      minimum dimensions required to lay out the components.
    • layoutContainer

      public void layoutContainer(Container parent)
      Lays out the specified container using this deck layout. Each component in the parent container is reshaped to be the same size as the container, minus insets, horizontal and vertical gaps.
      Specified by:
      layoutContainer in interface LayoutManager
      Overrides:
      layoutContainer in class CardLayout
      Parameters:
      parent - The name of the parent container
    • first

      public void first(Container parent)
      Flips to the first card of the container.
      Overrides:
      first in class CardLayout
      Parameters:
      parent - The name of the parent container
    • next

      public void next(Container parent)
      Flips to the next card of the specified container. If the currently visible card is the last one, this method flips to the first card in the layout.
      Overrides:
      next in class CardLayout
      Parameters:
      parent - The name of the parent container
    • previous

      public void previous(Container parent)
      Flips to the previous card of the specified container. If the currently visible card is the first one, this method flips to the last card in the layout.
      Overrides:
      previous in class CardLayout
      Parameters:
      parent - The name of the parent container
    • last

      public void last(Container parent)
      Flips to the last card of the container.
      Overrides:
      last in class CardLayout
      Parameters:
      parent - The name of the parent container
    • show

      public void show(Container parent, String name)
      Flips to the component that was added to this layout using the specified name. If no such component exists, nothing happens.
      Overrides:
      show in class CardLayout
      Parameters:
      parent - The name of the parent container in which to do the layout.
      name - The component name.
    • show

      public void show(Container parent, int index)
      Flips to the component at the numbered position. If no such component exists, nothing happens.
      Parameters:
      parent - The name of the parent container in which to do the layout.
      index - The index (between 0 and component count - 1)
    • getComponent

      public Component getComponent(String name)
      Get the component whose name is specified
      Parameters:
      name - of the component to be retrieved
      Returns:
      The component
    • getName

      public String getName(Container parent, int index)
      Get the name of the component specified in the component heirarchy of the container specified
      Parameters:
      parent - The parent container
      index - The index of the component whose name is asked for
      Returns:
      The name
    • getIndex

      public int getIndex(Container parent, String name)
      Get the index of the component specified in the component heirarchy of the container specified
      Parameters:
      parent - The parent container
      name - The name of the component whose index is asked for
      Returns:
      The index