All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, HasMembersChangedHandlers

public class Deck extends Layout
A simple container that implements the policy that at most one of its contained components is visible at any given time.

The set of mutually exclusive components is specified by panes, and whichever component is visible fills the space of the Deck automatically.

To switch to a new pane, call setCurrentPane(), or simply call show() on the pane directly - the Deck will notice that you have shown a different pane and hide other panes automatically.

Deck.children may also be used; any components that are specified as children are unmanaged by the Deck and so can place themselves arbitrarily.

Deck achieves its mutually-exclusive display behavior by using the superclass Layout.members property, which means that properties such as Layout.layoutMargin and Layout.vPolicy do apply to deck. However, trying to manipulate deck.members with APIs such as Layout.addMember() is not supported and will have undefined results.

  • Constructor Details

  • Method Details

    • getOrCreateRef

      public static Deck getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class Layout
    • setCurrentPane

      public Deck setCurrentPane(Canvas currentPane)
      The pane to show, including initially, in this Deck. All other panes are hidden.

      The value identifies a widget in the panes array and can be directly set to a widget or to the local name, local ID or global ID of a widget.

      If this method is called after the component has been drawn/initialized: Change the CurrentPane.

      If the passed pane is not contained in this Deck, logs a warning and does nothing.

      Parameters:
      currentPane - the pane to show, as either a Canvas or the Canvas.ID. Default value is null
      Returns:
      Deck instance, for chaining setter calls
    • getCurrentPane

      public Canvas getCurrentPane()
      The pane to show, including initially, in this Deck. All other panes are hidden.

      The value identifies a widget in the panes array and can be directly set to a widget or to the local name, local ID or global ID of a widget.

      Returns:
      Current currentPane value. Default value is null
    • setCurrentPane

      public Deck setCurrentPane(String currentPane)
      The pane to show, including initially, in this Deck. All other panes are hidden.

      The value identifies a widget in the panes array and can be directly set to a widget or to the local name, local ID or global ID of a widget.

      If this method is called after the component has been drawn/initialized: Change the CurrentPane.

      If the passed pane is not contained in this Deck, logs a warning and does nothing.

      Parameters:
      currentPane - the pane to show, as either a Canvas or the Canvas.ID. Default value is null
      Returns:
      Deck instance, for chaining setter calls
    • getCurrentPaneAsString

      public String getCurrentPaneAsString()
      The pane to show, including initially, in this Deck. All other panes are hidden.

      The value identifies a widget in the panes array and can be directly set to a widget or to the local name, local ID or global ID of a widget.

      Returns:
      Current currentPane value. Default value is null
    • setPanes

      public Deck setPanes(Canvas... panes)
      Set of mutually exclusive panes displayed in this Deck.

      If currentPane is not set, when the Deck is first drawn, the first pane in this array becomes the currentPane.

      Parameters:
      panes - New panes value. Default value is null
      Returns:
      Deck instance, for chaining setter calls
    • getPanes

      public Canvas[] getPanes()
      Set of mutually exclusive panes displayed in this Deck.

      If currentPane is not set, when the Deck is first drawn, the first pane in this array becomes the currentPane.

      Returns:
      Current panes value. Default value is null
    • addPane

      public void addPane(Canvas pane)
      Add a pane to this deck. If the specified pane is already present in the deck, it will be moved to the specified position.
      Parameters:
      pane - pane to add
    • addPane

      public void addPane(Canvas pane, Integer index)
      Add a pane to this deck. If the specified pane is already present in the deck, it will be moved to the specified position.
      Parameters:
      pane - pane to add
      index - position for the new pane in the panes array. If no index is specified, the pane will be added to the end of the panes array.
    • currentPaneChanged

      public void currentPaneChanged(Canvas currentPane)
      Notification fired when the Deck's currentPane is changed. This notification will occur even if the pane is changed prior to the deck being drawn or while the deck is hidden.

      No notification is triggered, however, when the deck is drawn.

      Parameters:
      currentPane - the new currentPane, or null if no pane is currently visible.
    • hideCurrentPane

      public void hideCurrentPane()
      Hides the current pane, without showing any other pane.
    • removePane

      public void removePane(Canvas pane)
      Remove a pane from this deck.
      Parameters:
      pane - pane to remove
    • setDefaultProperties

      public static void setDefaultProperties(Deck deckProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      deckProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(DeckLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class Layout