com.vaadin.client.widgets.

Class Overlay

  • java.lang.Object
    • com.google.gwt.user.client.ui.UIObject
      • com.google.gwt.user.client.ui.Widget
        • com.google.gwt.user.client.ui.Panel
          • com.google.gwt.user.client.ui.SimplePanel
            • com.google.gwt.user.client.ui.PopupPanel
              • com.vaadin.client.widgets.Overlay
  • All Implemented Interfaces:

    com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasCloseHandlers<com.google.gwt.user.client.ui.PopupPanel>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.EventPreview, com.google.gwt.user.client.ui.AcceptsOneWidget, com.google.gwt.user.client.ui.HasAnimation, com.google.gwt.user.client.ui.HasOneWidget, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, com.google.gwt.user.client.ui.SourcesPopupEvents, Iterable<com.google.gwt.user.client.ui.Widget>

    Direct Known Subclasses:

    VOverlay

    public class Overlay
    extends com.google.gwt.user.client.ui.PopupPanel

    Overlay widget extending the PopupPanel. Overlay is used to float elements on top of other elements temporarily.

    Note: This class should always be constructed with GWT.create(Class).

    Since:

    7.6.1

    • Nested Class Summary

      Nested Classes
      Modifier and Type Class Description
      static class  Overlay.PositionAndSize

      Data object for storing position and size information.

      protected class  Overlay.ResizeAnimation

      An Animation class for overlay resizing needs.

      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.PopupPanel

        com.google.gwt.user.client.ui.PopupPanel.AnimationType, com.google.gwt.user.client.ui.PopupPanel.PositionCallback
      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

        com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
      • Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets

        com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
    • Constructor Summary

      Constructors
      Constructor Description
      Overlay()

      Constructs a floating popup overlay element.

      Overlay​(boolean autoHide)

      Constructs a floating popup overlay element.

      Overlay​(boolean autoHide, boolean modal)

      Constructs a floating popup overlay element.

    • Method Summary

      All Methods
      Modifier and Type Method Description
      void center()  
      com.google.gwt.user.client.Element getOverlayContainer()

      Gets the 'overlay container' element.

      com.google.gwt.user.client.ui.Widget getOwner()

      Get owner (Widget that made this Overlay, not the layout parent) of Overlay.

      void hide()  
      void hide​(boolean autoClosed)  
      void hide​(boolean autoClosed, boolean animateIn, boolean animateOut)

      Hides the popup and detaches it from the page.

      boolean isFitInWindow()

      Checks whether the overlay should be moved or shrunk to fit inside the window.

      protected boolean isShimElementEnabled()

      Is there a shim iframe behind the overlay, allowing PDFs and applets to be covered by overlays.

      protected boolean needsShimElement()

      Returns true if we should add a shim iframe below the overlay to deal with zindex issues with PDFs and applets.

      protected void onAttach()  
      protected void onDetach()  
      void positionOrSizeUpdated()

      Extending classes should always call this method after they change the size of overlay without using normal 'setWidth(String)' and 'setHeight(String)' methods (if not calling super.setWidth/Height).

      void setFitInWindow​(boolean fitInWindow)

      Sets whether the overlay should be moved or shrunk to fit inside the window.

      void setHeight​(String height)  
      void setOwner​(com.google.gwt.user.client.ui.Widget owner)

      Set owner (Widget that made this Overlay, not the layout parent) of Overlay.

      void setPopupPosition​(int left, int top)  
      void setVisible​(boolean visible)  
      void setWidth​(String width)  
      protected void setZIndex​(int zIndex)

      Set the z-index (visual stack position) for this overlay.

      void show()  
      protected void updateShadowSizeAndPosition()

      Deprecated.

      • Methods inherited from class com.google.gwt.user.client.ui.PopupPanel

        addAutoHidePartner, addCloseHandler, addPopupListener, getAnimationType, getContainerElement, getGlassElement, getGlassStyleName, getOffsetHeight, getOffsetWidth, getPopupLeft, getPopupTop, getStyleElement, getTitle, isAnimationEnabled, isAutoHideEnabled, isAutoHideOnHistoryEventsEnabled, isGlassEnabled, isModal, isPreviewingAllNativeEvents, isShowing, isVisible, onEventPreview, onKeyDownPreview, onKeyPressPreview, onKeyUpPreview, onPreviewNativeEvent, onUnload, removeAutoHidePartner, removePopupListener, setAnimationEnabled, setAnimationType, setAutoHideEnabled, setAutoHideOnHistoryEventsEnabled, setGlassEnabled, setGlassStyleName, setModal, setPopupPositionAndShow, setPreviewingAllNativeEvents, setTitle, setWidget, showRelativeTo
      • Methods inherited from class com.google.gwt.user.client.ui.SimplePanel

        add, getWidget, iterator, remove, setWidget
      • Methods inherited from class com.google.gwt.user.client.ui.Panel

        add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
      • Methods inherited from class com.google.gwt.user.client.ui.Widget

        addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onLoad, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
      • Methods inherited from class com.google.gwt.user.client.ui.UIObject

        addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, toString
      • Methods inherited from interface com.google.gwt.event.shared.HasHandlers

        fireEvent
    • Field Detail

      • Z_INDEX

        public static int Z_INDEX

        The z-index value from where all overlays live. This can be overridden in any extending class.

      • CLASSNAME_SHADOW

        @Deprecated
        public static final String CLASSNAME_SHADOW
        Deprecated.
        See main JavaDoc for Overlay

        Shadow element style. If an extending class wishes to use a different style of shadow, it can use setShadowStyle(String) to give the shadow element a new style name.

        See Also:

        Constant Field Values

      • ADDITIONAL_CLASSNAME_ANIMATE_IN

        public static final String ADDITIONAL_CLASSNAME_ANIMATE_IN

        Since:

        7.3

        See Also:

        Constant Field Values

      • ADDITIONAL_CLASSNAME_ANIMATE_OUT

        public static final String ADDITIONAL_CLASSNAME_ANIMATE_OUT

        Since:

        7.3

        See Also:

        Constant Field Values

      • current

        protected static Overlay current

        A "thread local" of sorts, set temporarily so that OverlayImpl knows which Overlay is using it, so that it can be attached to the correct overlay container. TODO this is a strange pattern that we should get rid of when possible.

    • Constructor Detail

      • Overlay

        public Overlay()

        Constructs a floating popup overlay element.

        See Also:

        Overlay

      • Overlay

        public Overlay​(boolean autoHide)

        Constructs a floating popup overlay element.

        Parameters:

        autoHide - true if the overlay should be automatically hidden when the user clicks outside of it or the history token changes.

        See Also:

        Overlay

      • Overlay

        public Overlay​(boolean autoHide,
                       boolean modal)

        Constructs a floating popup overlay element.

        Parameters:

        autoHide - true if the overlay should be automatically hidden when the user clicks outside of it or the history token changes.

        modal - true if keyboard or mouse events that do not target the Overlay or its children should be ignored

        See Also:

        Overlay

    • Method Detail

      • onAttach

        protected void onAttach()

        Overrides:

        onAttach in class com.google.gwt.user.client.ui.Widget

      • isShimElementEnabled

        protected boolean isShimElementEnabled()

        Is there a shim iframe behind the overlay, allowing PDFs and applets to be covered by overlays.

        Returns:

        true if a shim element exists, false otherwise

      • setZIndex

        protected void setZIndex​(int zIndex)

        Set the z-index (visual stack position) for this overlay.

        Parameters:

        zIndex - The new z-index

      • setPopupPosition

        public void setPopupPosition​(int left,
                                     int top)

        Overrides:

        setPopupPosition in class com.google.gwt.user.client.ui.PopupPanel

      • show

        public void show()

        Overrides:

        show in class com.google.gwt.user.client.ui.PopupPanel

      • onDetach

        protected void onDetach()

        Overrides:

        onDetach in class com.google.gwt.user.client.ui.Widget

      • setVisible

        public void setVisible​(boolean visible)

        Specified by:

        setVisible in interface com.google.gwt.user.client.ui.HasVisibility

        Overrides:

        setVisible in class com.google.gwt.user.client.ui.PopupPanel

      • setWidth

        public void setWidth​(String width)

        Overrides:

        setWidth in class com.google.gwt.user.client.ui.PopupPanel

      • setHeight

        public void setHeight​(String height)

        Overrides:

        setHeight in class com.google.gwt.user.client.ui.PopupPanel

      • positionOrSizeUpdated

        public void positionOrSizeUpdated()

        Extending classes should always call this method after they change the size of overlay without using normal 'setWidth(String)' and 'setHeight(String)' methods (if not calling super.setWidth/Height).

      • needsShimElement

        protected boolean needsShimElement()

        Returns true if we should add a shim iframe below the overlay to deal with zindex issues with PDFs and applets. Can be overridden to disable shim iframes if they are not needed.

        Returns:

        true if a shim iframe should be added, false otherwise

      • getOwner

        public com.google.gwt.user.client.ui.Widget getOwner()

        Get owner (Widget that made this Overlay, not the layout parent) of Overlay.

        Returns:

        Owner (creator) or null if not defined

      • setOwner

        public void setOwner​(com.google.gwt.user.client.ui.Widget owner)

        Set owner (Widget that made this Overlay, not the layout parent) of Overlay.

        Parameters:

        owner - Owner (creator) of Overlay

      • getOverlayContainer

        public com.google.gwt.user.client.Element getOverlayContainer()

        Gets the 'overlay container' element.

        Returns:

        the overlay container element

      • center

        public void center()

        Overrides:

        center in class com.google.gwt.user.client.ui.PopupPanel

      • hide

        public void hide()

        Overrides:

        hide in class com.google.gwt.user.client.ui.PopupPanel

      • hide

        public void hide​(boolean autoClosed)

        Overrides:

        hide in class com.google.gwt.user.client.ui.PopupPanel

      • hide

        public void hide​(boolean autoClosed,
                         boolean animateIn,
                         boolean animateOut)

        Hides the popup and detaches it from the page. This has no effect if it is not currently showing. Animation-in, animation-out can be enable/disabled for different use cases.

        Parameters:

        autoClosed - the value that will be passed to CloseHandler.onClose(CloseEvent) when the popup is closed

        animateIn - enable/disable animate-in animation

        animateOut - enable/disable animate-out animation

        Since:

        7.3.7

        See Also:

        PopupPanel.hide(boolean)

      • setFitInWindow

        public void setFitInWindow​(boolean fitInWindow)

        Sets whether the overlay should be moved or shrunk to fit inside the window.

        When this is false, the default PopupPanel behavior is used, which tries to position the popup primarly below and to the right of a reference UIObject and, if there is not enough space, above or to the left.

        When this is true, the popup will be moved up/left in case it does not fit on either side. If the popup is larger than the window, it will be shrunk to fit and assume that scrolling e.g. using overflow:auto, is taken care of by the overlay user.

        Parameters:

        fitInWindow - true to ensure that no part of the popup is outside the visible view, false to use the default PopupPanel behavior

        Since:

        7.6.6

      • isFitInWindow

        public boolean isFitInWindow()

        Checks whether the overlay should be moved or shrunk to fit inside the window.

        Returns:

        true if the popup will be moved and/or shrunk to fit inside the window, false otherwise

        Since:

        7.6.6

        See Also:

        setFitInWindow(boolean)