com.vaadin.client.widgets
Class Overlay

java.lang.Object
  extended by PopupPanel
      extended by com.vaadin.client.widgets.Overlay
All Implemented Interfaces:
com.google.gwt.event.logical.shared.CloseHandler<PopupPanel>, com.google.gwt.event.shared.EventHandler
Direct Known Subclasses:
VOverlay

public class Overlay
extends PopupPanel
implements com.google.gwt.event.logical.shared.CloseHandler<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-shadow and the standard box-shadow properties.

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
static class Overlay.PositionAndSize
           
protected  class Overlay.ResizeAnimation
           
 
Field Summary
static java.lang.String ADDITIONAL_CLASSNAME_ANIMATE_IN
           
static java.lang.String ADDITIONAL_CLASSNAME_ANIMATE_OUT
           
static java.lang.String CLASSNAME_CONTAINER
          Style name for the overlay container element (see getOverlayContainer()
static java.lang.String CLASSNAME_SHADOW
          Deprecated. See main JavaDoc for Overlay
protected static Overlay current
           
static int Z_INDEX
           
 
Constructor Summary
Overlay()
           
Overlay(boolean autoHide)
           
Overlay(boolean autoHide, boolean modal)
           
Overlay(boolean autoHide, boolean modal, boolean showShadow)
          Deprecated. See main JavaDoc for Overlay. Use the other constructors without the showShadow parameter.
 
Method Summary
 void center()
           
 com.google.gwt.user.client.Element getOverlayContainer()
          Gets the 'overlay container' element.
 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.
protected  boolean isShadowEnabled()
          Deprecated. See main JavaDoc for Overlay
protected  boolean isShimElementEnabled()
           
protected  boolean isSinkShadowEvents()
          Deprecated. See main JavaDoc for Overlay
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()
           
 void onClose(com.google.gwt.event.logical.shared.CloseEvent<PopupPanel> event)
           
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 setHeight(java.lang.String height)
           
 void setOwner(Widget owner)
          Set owner (Widget that made this Overlay, not the layout parent) of Overlay
 void setPopupPosition(int left, int top)
           
protected  void setShadowEnabled(boolean enabled)
          Deprecated. See main JavaDoc for Overlay
protected  void setShadowStyle(java.lang.String style)
          Deprecated. See main JavaDoc for Overlay
protected  void setSinkShadowEvents(boolean sinkShadowEvents)
          Deprecated. See main JavaDoc for Overlay
 void setVisible(boolean visible)
           
 void setWidth(java.lang.String width)
           
protected  void setZIndex(int zIndex)
          Set the z-index (visual stack position) for this overlay.
 void show()
           
 void sinkEvents(int eventBitsToAdd)
           
protected  void updateShadowSizeAndPosition()
          Deprecated. Call positionOrSizeUpdated() instead.
protected  boolean useShadowDiv()
          Deprecated. See main JavaDoc for Overlay
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.logical.shared.CloseHandler
onClose
 

Field Detail

Z_INDEX

public static int Z_INDEX

CLASSNAME_SHADOW

@Deprecated
public static final java.lang.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

CLASSNAME_CONTAINER

public static final java.lang.String CLASSNAME_CONTAINER
Style name for the overlay container element (see getOverlayContainer()

See Also:
Constant Field Values

ADDITIONAL_CLASSNAME_ANIMATE_IN

public static final java.lang.String ADDITIONAL_CLASSNAME_ANIMATE_IN
Since:
7.3
See Also:
Constant Field Values

ADDITIONAL_CLASSNAME_ANIMATE_OUT

public static final java.lang.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 the showShadow parameter.

Method Detail

onAttach

protected void onAttach()

useShadowDiv

@Deprecated
protected boolean useShadowDiv()
Deprecated. See main JavaDoc for Overlay

Return 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 Overlay

Method 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)

show

public void show()

onDetach

protected void onDetach()

setVisible

public void setVisible(boolean visible)

setWidth

public void setWidth(java.lang.String width)

setHeight

public void setHeight(java.lang.String height)

setShadowStyle

@Deprecated
protected void setShadowStyle(java.lang.String style)
Deprecated. See main JavaDoc for Overlay

Sets 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. Call positionOrSizeUpdated() 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<PopupPanel> event)

sinkEvents

public void sinkEvents(int eventBitsToAdd)

setSinkShadowEvents

@Deprecated
protected void setSinkShadowEvents(boolean sinkShadowEvents)
Deprecated. See main JavaDoc for Overlay

Enables 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 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(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()

hide

public void hide()

hide

public void hide(boolean autoClosed)

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:
com.google.gwt.user.client.ui.PopupPanel#hide(boolean)


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.