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.CloseHandler<com.google.gwt.user.client.ui.PopupPanel>,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.EventHandler,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 implements com.google.gwt.event.logical.shared.CloseHandler<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).Shadow
The separate shadow element underneath the main overlay element is deprecated, and should not be used for new overlay components. CSS box-shadow should be used instead of a separate shadow element. Remember to include any vendor-prefixed versions to support all browsers that you need to. To cover all possible browsers that Vaadin 7 supports, add
-webkit-box-shadowand the standardbox-shadowproperties.For IE8, which doesn't support CSS box-shadow, you can use the proprietary DropShadow filter. It doesn't provide the exact same features as box-shadow, but it is suitable for graceful degradation. Other options are to use a border or a pseudo-element underneath the overlay which mimics a shadow, or any combination of these.
Read more about the DropShadow filter from Microsoft Developer Network
- Since:
- 7.6.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOverlay.PositionAndSizeprotected classOverlay.ResizeAnimation-
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
-
-
Field Summary
Fields Modifier and Type Field Description static StringADDITIONAL_CLASSNAME_ANIMATE_INstatic StringADDITIONAL_CLASSNAME_ANIMATE_OUTstatic StringCLASSNAME_CONTAINERStyle name for the overlay container element (seegetOverlayContainer()static StringCLASSNAME_SHADOWDeprecated.See main JavaDoc for Overlayprotected static Overlaycurrentstatic intZ_INDEX
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcenter()com.google.gwt.user.client.ElementgetOverlayContainer()Gets the 'overlay container' element.com.google.gwt.user.client.ui.WidgetgetOwner()Get owner (Widget that made this Overlay, not the layout parent) of Overlayvoidhide()voidhide(boolean autoClosed)voidhide(boolean autoClosed, boolean animateIn, boolean animateOut)Hides the popup and detaches it from the page.booleanisFitInWindow()Checks whether the overlay should be moved or shrunk to fit inside the window.protected booleanisShadowEnabled()Deprecated.See main JavaDoc for Overlayprotected booleanisShimElementEnabled()protected booleanisSinkShadowEvents()Deprecated.See main JavaDoc for Overlayprotected booleanneedsShimElement()Returns true if we should add a shim iframe below the overlay to deal with zindex issues with PDFs and applets.protected voidonAttach()voidonClose(com.google.gwt.event.logical.shared.CloseEvent<com.google.gwt.user.client.ui.PopupPanel> event)protected voidonDetach()voidpositionOrSizeUpdated()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).voidsetFitInWindow(boolean fitInWindow)Sets whether the overlay should be moved or shrunk to fit inside the window.voidsetHeight(String height)voidsetOwner(com.google.gwt.user.client.ui.Widget owner)Set owner (Widget that made this Overlay, not the layout parent) of OverlayvoidsetPopupPosition(int left, int top)protected voidsetShadowEnabled(boolean enabled)Deprecated.See main JavaDoc for Overlayprotected voidsetShadowStyle(String style)Deprecated.See main JavaDoc for Overlayprotected voidsetSinkShadowEvents(boolean sinkShadowEvents)Deprecated.See main JavaDoc for OverlayvoidsetVisible(boolean visible)voidsetWidth(String width)protected voidsetZIndex(int zIndex)Set the z-index (visual stack position) for this overlay.voidshow()voidsinkEvents(int eventBitsToAdd)protected voidupdateShadowSizeAndPosition()Deprecated.CallpositionOrSizeUpdated()instead.protected booleanuseShadowDiv()Deprecated.See main JavaDoc for Overlay-
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, 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
Z_INDEX
public static int Z_INDEX
-
CLASSNAME_SHADOW
@Deprecated public static final String CLASSNAME_SHADOW
Deprecated.See main JavaDoc for OverlayShadow 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
-
CLASSNAME_CONTAINER
public static final String CLASSNAME_CONTAINER
Style name for the overlay container element (seegetOverlayContainer()- 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
-
-
Constructor Detail
-
Overlay
public Overlay()
-
Overlay
public Overlay(boolean autoHide)
-
Overlay
public Overlay(boolean autoHide, boolean modal)
-
Overlay
@Deprecated public Overlay(boolean autoHide, boolean modal, boolean showShadow)
Deprecated.See main JavaDoc for Overlay. Use the other constructors without theshowShadowparameter.
-
-
Method Detail
-
onAttach
protected void onAttach()
- Overrides:
onAttachin classcom.google.gwt.user.client.ui.Widget
-
useShadowDiv
@Deprecated protected boolean useShadowDiv()
Deprecated.See main JavaDoc for OverlayReturn true if a separate shadow div should be used. Since Vaadin 7.3, shadows are implemented with CSS box-shadow. Thus, a shadow div is only used for IE8 by default.- Returns:
- true to use a shadow div
- Since:
- 7.3
-
setShadowEnabled
@Deprecated protected void setShadowEnabled(boolean enabled)
Deprecated.See main JavaDoc for OverlayMethod to control whether DOM elements for shadow are added. With this method subclasses can control displaying of shadow also after the constructor.- Parameters:
enabled- true if shadow should be displayed
-
isShadowEnabled
@Deprecated protected boolean isShadowEnabled()
Deprecated.See main JavaDoc for Overlay
-
isShimElementEnabled
protected boolean isShimElementEnabled()
-
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:
setPopupPositionin classcom.google.gwt.user.client.ui.PopupPanel
-
show
public void show()
- Overrides:
showin classcom.google.gwt.user.client.ui.PopupPanel
-
onDetach
protected void onDetach()
- Overrides:
onDetachin classcom.google.gwt.user.client.ui.Widget
-
setVisible
public void setVisible(boolean visible)
- Specified by:
setVisiblein interfacecom.google.gwt.user.client.ui.HasVisibility- Overrides:
setVisiblein classcom.google.gwt.user.client.ui.PopupPanel
-
setWidth
public void setWidth(String width)
- Overrides:
setWidthin classcom.google.gwt.user.client.ui.PopupPanel
-
setHeight
public void setHeight(String height)
- Overrides:
setHeightin classcom.google.gwt.user.client.ui.PopupPanel
-
setShadowStyle
@Deprecated protected void setShadowStyle(String style)
Deprecated.See main JavaDoc for OverlaySets the shadow style for this overlay. Will override any previous style for the shadow. The default style name is defined by CLASSNAME_SHADOW. The given style will be prefixed with CLASSNAME_SHADOW.- Parameters:
style- The new style name for the shadow element. Will be prefixed by CLASSNAME_SHADOW, e.g. style=='foobar' -> actual style name=='v-shadow-foobar'.
-
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).
-
updateShadowSizeAndPosition
@Deprecated protected void updateShadowSizeAndPosition()
Deprecated.CallpositionOrSizeUpdated()instead.
-
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 overriden to disable shim iframes if they are not needed.- Returns:
- true if a shim iframe should be added, false otherwise
-
onClose
public void onClose(com.google.gwt.event.logical.shared.CloseEvent<com.google.gwt.user.client.ui.PopupPanel> event)
- Specified by:
onClosein interfacecom.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.ui.PopupPanel>
-
sinkEvents
public void sinkEvents(int eventBitsToAdd)
- Overrides:
sinkEventsin classcom.google.gwt.user.client.ui.Widget
-
setSinkShadowEvents
@Deprecated protected void setSinkShadowEvents(boolean sinkShadowEvents)
Deprecated.See main JavaDoc for OverlayEnables or disables sinking the events of the shadow to the same onBrowserEvent as events to the actual overlay goes. Please note, that if you enable this, you can't assume that e.g. event.getEventTarget returns an element inside the DOM structure of the overlay- Parameters:
sinkShadowEvents-
-
isSinkShadowEvents
@Deprecated protected boolean isSinkShadowEvents()
Deprecated.See main JavaDoc for Overlay
-
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:
centerin classcom.google.gwt.user.client.ui.PopupPanel
-
hide
public void hide()
- Overrides:
hidein classcom.google.gwt.user.client.ui.PopupPanel
-
hide
public void hide(boolean autoClosed)
- Overrides:
hidein classcom.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 toCloseHandler.onClose(CloseEvent)when the popup is closedanimateIn- enable/disable animate-in animationanimateOut- 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 defaultPopupPanelbehavior 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. usingoverflow:auto, is taken care of by the overlay user.- Parameters:
fitInWindow-trueto ensure that no part of the popup is outside the visible view,falseto use the defaultPopupPanelbehavior- Since:
- 7.6.6
-
isFitInWindow
public boolean isFitInWindow()
Checks whether the overlay should be moved or shrunk to fit inside the window.- Returns:
trueif the popup will be moved and/or shrunk to fit inside the window,falseotherwise- Since:
- 7.6.6
- See Also:
setFitInWindow(boolean)
-
-