goog.ui.Popup
Classgoog.ui.Popup
> goog.ui.PopupBase
> goog.events.EventTarget
> goog.Disposable
goog.ui.Popup(opt_element, opt_position)
The Popup class provides functionality for displaying an absolutely positioned element at a particular location in the window. It's designed to be used as the foundation for building controls like a menu or tooltip. The Popup class includes functionality for displaying a Popup near adjacent to an anchor element. This works cross browser and thus does not use IE's createPopup feature which supports extending outside the edge of the brower window.
opt_element
{Element
=}
opt_position
{goog.positioning.AbstractPosition
=}
goog.ui.Popup.AbsolutePosition
ClassDeprecated. Use {@link goog.positioning.AbsolutePosition} instead, this alias will be removed at the end of Q1 2009.
Encapsulates a popup position where the popup absolutely positioned by setting the left/top style elements directly to the specified values. The position is generally relative to the element's offsetParent. Normally, this is the document body, but can be another element if the popup element is scoped by an element with relative position. … more
goog.ui.Popup.AnchoredPosition
ClassDeprecated. Use {@link goog.positioning.AnchoredPosition} instead, this alias will be removed at the end of Q1 2009.
Encapsulates a popup position where the popup is anchored at a corner of an element. When using AnchoredPosition, it is recommended that the popup element specified in the Popup constructor or Popup.setElement be absolutely positioned. … more
goog.ui.Popup.AnchoredViewPortPosition
ClassDeprecated. Use {@link goog.positioning.AnchoredViewportPosition} instead, this alias will be removed at the end of Q1 2009.
Encapsulates a popup position where the popup is anchored at a corner of an element. The corners are swapped if dictated by the viewport. For instance if a popup is anchored with its top left corner to the bottom left corner of the anchor the popup is either displayed below the anchor (as specified) or above it if there's not enough room to display it below. When using AnchoredPosition, it is recommended that the popup element specified in the Popup constructor or Popup.setElement be absolutely positioned. … more
goog.ui.Popup.ClientPosition
ClassDeprecated. Use {@link goog.positioning.ClientPosition} instead, this alias will be removed at the end of Q1 2009.
Encapsulates a popup position where the popup is positioned relative to the window (client) coordinates. This calculates the correct position to use even if the element is relatively positioned to some other element. This is for trying to position an element at the spot of the mouse cursor in a MOUSEMOVE event. Just use the event.clientX and event.clientY as the parameters. … more
.Corner
[deprecated]Deprecated. Use {@link goog.positioning.Corner} instead, this alias will be removed at the end of Q1 2009.
Enum for representing an element corner for positioning the popup.
.Overflow
[deprecated]Deprecated. Use {@link goog.positioning.Overflow} instead, this alias will be removed at the end of Q1 2009.
Enum for representing position handling in cases where the element would be positioned outside the viewport.
goog.ui.Popup.ViewPortClientPosition
ClassDeprecated. Use {@link goog.positioning.ViewPortClientPosition} instead, this alias will be removed at the end of Q1 2009.
Encapsulates a popup position where the popup is positioned relative to the window (client) coordinates, and made to stay within the viewport. … more
goog.ui.Popup.ViewPortPosition
ClassDeprecated. Use {@link goog.positioning.ViewPortPosition} instead, this alias will be removed at the end of Q1 2009.
Encapsulates a popup position where the popup is positioned according to coordinates relative to the element's view port (page). This calculates the correct position to use even if the element is relatively positioned to some other element. … more
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Inherited from goog.ui.PopupBase
.
Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass };
.getAutoHide()
Inherited from goog.ui.PopupBase
.
Returns whether the Popup dismisses itself when the user clicks outside of it.
boolean
}
.getAutoHideRegion()
Inherited from goog.ui.PopupBase
.
Returns the region inside which the Popup dismisses itself when the user clicks, or null if it's the entire document.
Element
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getElement()
Inherited from goog.ui.PopupBase
.
Returns the dom element that should be used for the popup.
Element
}
.getEnableCrossIframeDismissal()
Inherited from goog.ui.PopupBase
.
boolean
}
.getHideOnEscape()
Inherited from goog.ui.PopupBase
.
boolean
}
.getLastHideTime()
Inherited from goog.ui.PopupBase
.
Returns the time when the popup was last hidden.
number
}
.getLastShowTime()
Inherited from goog.ui.PopupBase
.
Returns the time when the popup was last shown.
number
}
.getMargin()
Returns the margin to place around the popup.
goog.math.Box
?}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getPinnedCorner()
Returns the corner of the popup to used in the positioning algorithm.
goog.positioning.Corner
}
.getPosition()
goog.positioning.AbstractPosition
}
.getType()
Inherited from goog.ui.PopupBase
.
goog.ui.PopupBase.Type
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isOrWasRecentlyVisible()
Inherited from goog.ui.PopupBase
.
Returns whether the popup is currently visible or was visible within about 150 ms ago. This is used by clients to handle a very specific, but common, popup scenario. The button that launches the popup should close the popup on mouse down if the popup is alrady open. The problem is that the popup closes itself during the capture phase of the mouse down and thus the button thinks it's hidden and this should show it again. This method provides a good heuristic for clients. Typically in their event handler they will have code that is: if (menu.isOrWasRecentlyVisible()) { menu.setVisible(false); } else { ... // code to position menu and initialize other state menu.setVisible(true); }
boolean
}
.isVisible()
Inherited from goog.ui.PopupBase
.
Returns whether the popup is currently visible.
boolean
}
.onBeforeHide_(opt_target)
[protected]Inherited from goog.ui.PopupBase
.
Called before the popup is hidden. Derived classes can override to hook this event but should make sure to call the parent class method.
opt_target
{Object
=}
boolean
}
.onBeforeShow()
[protected]Inherited from goog.ui.PopupBase
.
Called before the popup is shown. Derived classes can override to hook this event but should make sure to call the parent class method.
boolean
}
.onHide_(opt_target)
[protected]Inherited from goog.ui.PopupBase
.
Called after the popup is hidden. Derived classes can override to hook this event but should make sure to call the parent class method.
opt_target
{Object
=}
.onShow_()
[protected]Inherited from goog.ui.PopupBase
.
Called after the popup is shown. Derived classes can override to hook this event but should make sure to call the parent class method.
.position_
[protected] {goog.positioning.AbstractPosition
|undefined
}Positioning helper object.
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.reposition()
Repositions the popup according to the current state.
.setAutoHide(autoHide)
Inherited from goog.ui.PopupBase
.
Sets whether the Popup dismisses itself when the user clicks outside of it.
autoHide
{boolean
}
.setAutoHideRegion(element)
Inherited from goog.ui.PopupBase
.
Sets the region inside which the Popup dismisses itself when the user clicks.
element
{Element
}
.setElement(elt)
Inherited from goog.ui.PopupBase
.
Specifies the dom element that should be used for the popup.
elt
{Element
}
.setEnableCrossIframeDismissal(enable)
Inherited from goog.ui.PopupBase
.
Sets whether clicks in other iframes should dismiss this popup. In some cases it should be disabled, because it can cause spurious
enable
{boolean
}
.setHideOnEscape(hideOnEscape)
Inherited from goog.ui.PopupBase
.
Sets whether the Popup dismisses itself on the escape key.
hideOnEscape
{boolean
}
.setMargin(arg1, opt_arg2, opt_arg3, opt_arg4)
Sets the margin to place around the popup.
arg1
{goog.math.Box
|number
|null
}
opt_arg2
{number
=}
opt_arg3
{number
=}
opt_arg4
{number
=}
.setParentEventTarget(parent)
Inherited from goog.events.EventTarget
.
Sets the parent of this event target to use for bubbling.
parent
{goog.events.EventTarget
?}
.setPinnedCorner(corner)
Sets the corner of the popup to used in the positioning algorithm.
corner
{goog.positioning.Corner
}
.setPosition(position)
Sets the position helper object associated with the popup.
position
{goog.positioning.AbstractPosition
}
.setShouldHideAsync(b)
Inherited from goog.ui.PopupBase
.
Sets whether the popup should hide itself asynchronously using a timeout instead of synchronously.
b
{boolean
}
.setTransition(opt_showTransition, opt_hideTransition)
Inherited from goog.ui.PopupBase
.
Sets transition animation on showing and hiding the popup.
opt_showTransition
{goog.fx.Transition
=}
opt_hideTransition
{goog.fx.Transition
=}
.setType(type)
Inherited from goog.ui.PopupBase
.
Specifies the type of popup to use.
type
{goog.ui.PopupBase.Type
}
.setVisible(visible)
Inherited from goog.ui.PopupBase
.
Sets whether the popup should be visible. After this method returns, isVisible() will always return the new state, even if there is a transition.
visible
{boolean
}
.shouldHideAsync()
Inherited from goog.ui.PopupBase
.
Returns whether the popup should hide itself asynchronously using a timeout instead of synchronously.
boolean
}