Class ScrolledPageBook

All Implemented Interfaces:
Drawable

public class ScrolledPageBook extends SharedScrolledComposite
ScrolledPageBook is a class that is capable of stacking several composites (pages), while showing one at a time. The content is scrolled if there is not enough space to fit it in the client area.
Since:
3.0
  • Constructor Details

    • ScrolledPageBook

      public ScrolledPageBook(Composite parent)
      Creates a new instance in the provided parent
      Parameters:
      parent - the parent composite
    • ScrolledPageBook

      public ScrolledPageBook(Composite parent, int style)
      Creates a new instance in the provided parent and with the provided style.
      Parameters:
      parent - the control parent
      style - the style to use
  • Method Details

    • computeSize

      public Point computeSize(int wHint, int hHint, boolean changed)
      Removes the default size of the composite, allowing the control to shrink to the trim.
      Overrides:
      computeSize in class Control
      Parameters:
      wHint - the width hint
      hHint - the height hint
      changed - if true, do not use cached values
      Returns:
      the preferred size of the control.
      See Also:
    • hasPage

      public boolean hasPage(Object key)
      Tests if the page under the provided key is currently in the book.
      Parameters:
      key - the page key
      Returns:
      true if page exists, false otherwise.
    • createPage

      public Composite createPage(Object key)
      Creates a new page for the provided key. Use the returned composite to create children in it.
      Parameters:
      key - the page key
      Returns:
      the newly created page composite
    • getContainer

      public Composite getContainer()
      Returns the page book container.
      Returns:
      the page book container
    • registerPage

      public void registerPage(Object key, Control page)
      Registers a page under the privided key to be managed by the page book. The page must be a direct child of the page book container.
      Parameters:
      key - the page key
      page - the page composite to register
      See Also:
    • removePage

      public void removePage(Object key)
      Removes the page under the provided key from the page book. Does nothing if page with that key does not exist.
      Parameters:
      key - the page key.
    • removePage

      public void removePage(Object key, boolean showEmptyPage)
      Removes the page under the provided key from the page book. Does nothing if page with that key does not exist.
      Parameters:
      key - the page key.
      showEmptyPage - if true, shows the empty page after page removal.
    • showPage

      public void showPage(Object key)
      Shows the page with the provided key and hides the page previously showing. Does nothing if the page with that key does not exist.
      Parameters:
      key - the page key
    • showEmptyPage

      public void showEmptyPage()
      Shows a page with no children to be used if the desire is to not show any registered page.
    • setFocus

      public boolean setFocus()
      Sets focus on the current page if shown.
      Overrides:
      setFocus in class SharedScrolledComposite
      Returns:
      true if the control got focus, and false if it was unable to.
      See Also:
    • getCurrentPage

      public Control getCurrentPage()
      Returns the page currently showing.
      Returns:
      the current page