Class DeckLayoutPanel

    • Constructor Detail

      • DeckLayoutPanel

        public DeckLayoutPanel()
        Creates an empty deck panel.
    • Method Detail

      • add

        public void add​(Widget w)
        Description copied from class: Panel
        Adds a child widget.

        How to Override this Method

        There are several important things that must take place in the correct order to properly add or insert a Widget to a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.

        1. Validate: Perform any sanity checks to ensure the Panel can accept a new Widget. Examples: checking for a valid index on insertion; checking that the Panel is not full if there is a max capacity.
        2. Adjust for Reinsertion: Some Panels need to handle the case where the Widget is already a child of this Panel. Example: when performing a reinsert, the index might need to be adjusted to account for the Widget's removal. See ComplexPanel.adjustIndex(Widget, int).
        3. Detach Child: Remove the Widget from its existing parent, if any. Most Panels will simply call Widget.removeFromParent() on the Widget.
        4. Logical Attach: Any state variables of the Panel should be updated to reflect the addition of the new Widget. Example: the Widget is added to the Panel's WidgetCollection at the appropriate index.
        5. Physical Attach: The Widget's Element must be physically attached to the Panel's Element, either directly or indirectly.
        6. Adopt: Call Panel.adopt(Widget) to finalize the add as the very last step.

        Specified by:
        add in interface HasWidgets
        Specified by:
        add in interface InsertPanel
        Overrides:
        add in class Panel
        Parameters:
        w - the widget to be added
        See Also:
        HasWidgets.add(Widget)
      • animate

        public void animate​(int duration)
        Description copied from interface: AnimatedLayout
        Layout children, animating over the specified period of time.
        Specified by:
        animate in interface AnimatedLayout
        Parameters:
        duration - the animation duration, in milliseconds
      • animate

        public void animate​(int duration,
                            Layout.AnimationCallback callback)
        Description copied from interface: AnimatedLayout
        Layout children, animating over the specified period of time.

        This method provides a callback that will be informed of animation updates. This can be used to create more complex animation effects.

        Specified by:
        animate in interface AnimatedLayout
        Parameters:
        duration - the animation duration, in milliseconds
        callback - the animation callback
      • getAnimationDuration

        public int getAnimationDuration()
        Get the duration of the animated transition between tabs.
        Returns:
        the duration in milliseconds
      • getVisibleWidget

        public Widget getVisibleWidget()
        Gets the currently-visible widget.
        Returns:
        the visible widget, or null if not visible
      • getVisibleWidgetIndex

        public int getVisibleWidgetIndex()
        Gets the index of the currently-visible widget.
        Returns:
        the visible widget's index
      • insert

        public void insert​(Widget widget,
                           int beforeIndex)
        Description copied from interface: InsertPanel
        Inserts a child widget before the specified index. If the widget is already a child of this panel, it will be moved to the specified index.
        Specified by:
        insert in interface InsertPanel
        Parameters:
        widget - the child widget to be inserted
        beforeIndex - the index before which it will be inserted
      • insert

        public void insert​(Widget widget,
                           Widget before)
        Insert a widget before the specified widget. If the widget is already a child of this panel, this method behaves as though remove(Widget) had already been called.
        Parameters:
        widget - the widget to be added
        before - the widget before which to insert the new child, or null to append
      • isAnimationVertical

        public boolean isAnimationVertical()
        Check whether or not transitions slide in vertically or horizontally. Defaults to horizontally.
        Returns:
        true for vertical transitions, false for horizontal
      • onResize

        public void onResize()
        Description copied from interface: RequiresResize
        This method must be called whenever the implementor's size has been modified.
        Specified by:
        onResize in interface RequiresResize
      • remove

        public boolean remove​(Widget w)
        Description copied from class: Panel
        Removes a child widget.

        How to Override this Method

        There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.

        1. Validate: Make sure this Panel is actually the parent of the child Widget; return false if it is not.
        2. Orphan: Call Panel.orphan(Widget) first while the child Widget is still attached.
        3. Physical Detach: Adjust the DOM to account for the removal of the child Widget. The Widget's Element must be physically removed from the DOM.
        4. Logical Detach: Update the Panel's state variables to reflect the removal of the child Widget. Example: the Widget is removed from the Panel's WidgetCollection.

        Specified by:
        remove in interface HasWidgets
        Overrides:
        remove in class ComplexPanel
        Parameters:
        w - the widget to be removed
        Returns:
        true if the child was present
      • setAnimationDuration

        public void setAnimationDuration​(int duration)
        Set the duration of the animated transition between tabs.
        Parameters:
        duration - the duration in milliseconds.
      • setAnimationVertical

        public void setAnimationVertical​(boolean isVertical)
        Set whether or not transitions slide in vertically or horizontally.
        Parameters:
        isVertical - true for vertical transitions, false for horizontal
      • setWidget

        public void setWidget​(IsWidget w)
        Show the specified widget. If the widget is not a child of this panel, it is added to the end of the panel. If the specified widget is null, the currently-visible widget will be hidden.
        Specified by:
        setWidget in interface AcceptsOneWidget
        Parameters:
        w - the widget to show, and add if not a child
        See Also:
        SimplePanel
      • showWidget

        public void showWidget​(int index)
        Shows the widget at the specified index. This causes the currently- visible widget to be hidden.
        Parameters:
        index - the index of the widget to be shown
      • showWidget

        public void showWidget​(Widget widget)
        Shows the widget at the specified index. This causes the currently- visible widget to be hidden.
        Parameters:
        widget - the widget to be shown
      • assertIsChild

        void assertIsChild​(Widget widget)
        Assert that the specified widget is null or a child of this widget.
        Parameters:
        widget - the widget to check