OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

oracle.adfinternal.view.js.laf.dhtml.internalWindow
Class AdfAutoDismissalManager

Warning:

org.ecmascript.object.Object
   |
   +--oracle.adf.view.js.base.AdfObject
         |
         +--oracle.adfinternal.view.js.laf.dhtml.internalWindow.AdfAutoDismissalManager

public class AdfAutoDismissalManager
extends AdfObject
AdfAutoDismissallManager keeps track of all visible popups that have some form of autodismiss behavior. When a popup is shown, by calling somePeer.showPopup(component, contentDom, hints), the Id of the component is pushed onto a stack (except for popups with a AUTO_DISMISS_NEVER hint). The component is then said to be the 'owner' or the 'spawner' of the popup. The reason why the datastructure is a stack is that you might want to have one popup spawn the next, which are then opened and closed in recursive fashion. (see: AdfAutoDismissallManager.addBehavior() and AdfAutoDismissallManager._addComponent() ) However, just before the requested popup has it's owner's ID pushed onto the stack, the AutoDismissalManager unwinds the stack to close any other open popups, i.e. they are auto-dismissed one-by-one, unless the event target was inside the popup DOM or unless some special condition is true. (see: AdfAutoDismissallManager.popUntilAncestorFound) This, w/o the special condition, is the default autodismiss behavior (i.e. AUTO_DISMISS_ALWAYS) but sometimes you want to make an exception, i.e. not dismiss, as for instance, in the case of menus. A submenu should't be dismissed if the item that spawned it is clicked. This is exactly what AUTO_DISMISS_MENU does. So to summarize the distinction: - AUTO_DISMISS_ALWAYS: dismiss unless event target was inside the popup DOM - AUTO_DISMISS_MENU: dismiss unless the event target was inside the popup DOM or the event target was inside the owner's DOM.



Field Summary

private Object
_componentStack


Fields inherited from oracle.adf.view.js.base.AdfObject

constructor, superclass


Fields inherited from org.ecmascript.object.Object

prototype


Constructor Summary

public
AdfAutoDismissalManager()
AdfAutoDismissallManager keeps track of all visible popups that have some form of autodismiss behavior.


Method Summary

public Object
addBehavior(Object component, Object hints)
Registers a component with the autoDismissalManager, to give it specific dismissal behavior.
private Object
_addComponent(Object component, Object type, Object hints)
Adds the component to the stack and removes (invokes dismissal) of non-ancestors.
public Object
cancelBlurTimeout()
Cancels the _dismissBlurringElement timeout.
private Boolean
_cancelDismissal(HTMLElement target, Object stackedObj)
Inspects the event target and the registered component information to determine if dismissal should be invoked.
public Object
changeBehavior(Object component, Object hints)
Changes the dismissal behavior of a component.
public Object
closeAll()
Closes all popups that were managed.
public Object
dismiss(HTMLElement target)
Iterate over the components under dismissal management.
private static Object
_dismissBlurringElement(Object state)
Timed callback invoked from the _handleBlur handler.
private Object
_dismissOnMouseOver(Object target)
Invoked by the _handleMouseOverTimeout when catching a mouse over event.
public Object
dispose()
Disposes the AdfDhtmlAutoDismissalManager instance.
public Number
getBehaviorCount()
private AdfUIComponent
_getContainingComponent(Object domElement)
For a domElement, return the containing component, if present
private Object
_handleBlur(Object evt)
Handler is registered for Firefox.
private Object
_handleFocusIn(Object evt)
Handles the focus in event (IE) specific if the target dom node is a IFRAME.
private Object
_handleKeyUp(Object evt)
Invokes dismiss if the event has a source and target dom element and the TAB key was pressed.
private Object
_handleMouseDown(Object evt)
Invokes dismiss if the event has a target and source element.
private Object
_handleMouseOver(Object evt)
Invokes the _handleMouseOverTimeout event to handle the event in 300 ms.
private static Object
_handleMouseOverTimeout(Object state)
Called by _handleMouseOver in a 300 ms timed event.
public Object
hasComponent(Object component)
public Object
hasComponents()
private Object
_hideComponentPopups(Object component)
Hides the target component with a cancel status.
private Object
_hideDismissalBehavior(Number index)
A popup dismissal behavior for most types of popups.
private Object
_inactivateDismissalBehavior(Number index)
A popup dismissal behavior for dialogs and panelWindows only.
protected Object
Init()
Initializes the AdfDhtmlAutoDismissalManager instance.
private Boolean
_isComponentAncestor(Object ancestorClientId, Object component)
Returns true if the provided ancestorClientId is for an ancestor of the provided component
private Boolean
_isTargetInOwner(HTMLElement target, Object popupOwner)
private Object
_isTargetInPopup(HTMLElement target, Object popupList)
Returns true if the target is in the list of popups
private Boolean
_popupUnderneathGlassPane(Object popupList)
private Object
_registerEventHandlers()
Registers the keyup, mousedown, focusin, blur and mouseover listeners attached to the document or the window.
public Object
removeBehavior(Object component)
Unregisters a component from the autoDismissalManager and dismisses it.
private Object
_undismissDueToActiveIframe(HTMLElement activeElement)
Invoked by the _dismissBlurringElement when catching a dismiss from a user moving focus into an iframe (e.g.
private Object
_unregisterEventHandlers()
Unregisters the keyup, mousedown, focusin, blur and mouseover listeners attached to the document or the window.


Methods inherited from oracle.adf.view.js.base.AdfObject

adopt, clone, createCallback, createInitializedObject, createSubclass, ensureClassInitialization, equals, getClass, GetLazyArrayProperty, GetLazyMapProperty, getTypeName, toDebugString, toString


Field Detail


_componentStack

private Object _componentStack

Constructor Detail


AdfAutoDismissalManager

public AdfAutoDismissalManager()

AdfAutoDismissallManager keeps track of all visible popups that have some form of autodismiss behavior. When a popup is shown, by calling somePeer.showPopup(component, contentDom, hints), the Id of the component is pushed onto a stack (except for popups with a AUTO_DISMISS_NEVER hint). The component is then said to be the 'owner' or the 'spawner' of the popup. The reason why the datastructure is a stack is that you might want to have one popup spawn the next, which are then opened and closed in recursive fashion. (see: AdfAutoDismissallManager.addBehavior() and AdfAutoDismissallManager._addComponent() ) However, just before the requested popup has it's owner's ID pushed onto the stack, the AutoDismissalManager unwinds the stack to close any other open popups, i.e. they are auto-dismissed one-by-one, unless the event target was inside the popup DOM or unless some special condition is true. (see: AdfAutoDismissallManager.popUntilAncestorFound) This, w/o the special condition, is the default autodismiss behavior (i.e. AUTO_DISMISS_ALWAYS) but sometimes you want to make an exception, i.e. not dismiss, as for instance, in the case of menus. A submenu should't be dismissed if the item that spawned it is clicked. This is exactly what AUTO_DISMISS_MENU does. So to summarize the distinction: - AUTO_DISMISS_ALWAYS: dismiss unless event target was inside the popup DOM - AUTO_DISMISS_MENU: dismiss unless the event target was inside the popup DOM or the event target was inside the owner's DOM.

Method Detail


addBehavior

public Object addBehavior(Object component,
                          Object hints)

Registers a component with the autoDismissalManager, to give it specific dismissal behavior. There are 4 types of behaviors handled: 1) AdfDhtmlPopupWindow.HINT_AUTODISMISS_MENU 2) AdfDhtmlPopupWindow.HINT_AUTODISMISS_ALWAYS 3) AdfDhtmlPopupWindow.HINT_AUTODISMISS_MOUSEOUT 4) AdfDhtmlPopupWindow.HINT_AUTODISMISS_INACTIVATE

Parameters:
component  -  The owner-component that invoked the popup
hints  -  The auto dismissal hints for setting its behavior
Return:
Object

_addComponent

private Object _addComponent(Object component,
                             Object type,
                             Object hints)

Adds the component to the stack and removes (invokes dismissal) of non-ancestors.

Parameters:
component  -  The owner-component to add
type    
hints  -  popup hints
Return:
Object

cancelBlurTimeout

public Object cancelBlurTimeout()

Cancels the _dismissBlurringElement timeout. This is invoked by the AdfDhtmlRichTextEditorPeer.

Return:
Object

_cancelDismissal

private Boolean _cancelDismissal(HTMLElement target,
                                 Object stackedObj)

Inspects the event target and the registered component information to determine if dismissal should be invoked. The dismissal type along with other popup hints are used to case out the rules.

Parameters:
target  -  The original event target
stackedObj  -  The object on the dimissal stack.
Return:
Boolean - true if dismissal is cancled; otherwise; false will invoke dismissal behavior

changeBehavior

public Object changeBehavior(Object component,
                             Object hints)

Changes the dismissal behavior of a component. Note that you should not be using this method to set autodismiss behavior to HINT_AUTODISMISS_NEVER. If that is your desire, remove the item from the array instead.

Parameters:
component  -  The owner-component of the popup
hints  -  popup hints
Return:
Object

closeAll

public Object closeAll()

Closes all popups that were managed.

Return:
Object

dismiss

public Object dismiss(HTMLElement target)

Iterate over the components under dismissal management. Invoke _cancelDismissal for each component. If dismisal is not cancled, one of two dismissal behaviors are invoked (_hideDismissalBehavior, _inactivateDismissalBehavior). The behavior are determined when initially added based on the dismissal type.

Parameters:
target  -  The original event target
Return:
Object

_dismissBlurringElement

private static Object _dismissBlurringElement(Object state)

Timed callback invoked from the _handleBlur handler.

Parameters:
state  -  context of the timed event
Return:
Object

_dismissOnMouseOver

private Object _dismissOnMouseOver(Object target)

Invoked by the _handleMouseOverTimeout when catching a mouse over event. Invokes cancleDismissal for each component like the dismiss function but only for components registered with the AdfDhtmlPopupWindow.HINT_AUTODISMISS_MOUSEOUT dismissal type.

Parameters:
target  -  src or target dom node associated with the mouse over event
Return:
Object

dispose

public Object dispose()

Disposes the AdfDhtmlAutoDismissalManager instance.

Return:
Object

getBehaviorCount

public Number getBehaviorCount()

Return:
Number - the total number of behaviors managed

_getContainingComponent

private AdfUIComponent _getContainingComponent(Object domElement)

For a domElement, return the containing component, if present

Parameters:
domElement  -  the DOM element in question
Return:
AdfUIComponent - the containing component, if found. Returns null if component is not found.

_handleBlur

private Object _handleBlur(Object evt)

Handler is registered for Firefox. If the target node is the document, dismiss is called in 100 ms via a window timeout.

Parameters:
evt  -  blur event
Return:
Object

_handleFocusIn

private Object _handleFocusIn(Object evt)

Handles the focus in event (IE) specific if the target dom node is a IFRAME.

Parameters:
evt  -  dom focus in event
Return:
Object

_handleKeyUp

private Object _handleKeyUp(Object evt)

Invokes dismiss if the event has a source and target dom element and the TAB key was pressed.

Parameters:
evt  -  key up event
Return:
Object

_handleMouseDown

private Object _handleMouseDown(Object evt)

Invokes dismiss if the event has a target and source element.

Parameters:
evt    
Return:
Object

_handleMouseOver

private Object _handleMouseOver(Object evt)

Invokes the _handleMouseOverTimeout event to handle the event in 300 ms.

Parameters:
evt  -  mouse over event
Return:
Object

_handleMouseOverTimeout

private static Object _handleMouseOverTimeout(Object state)

Called by _handleMouseOver in a 300 ms timed event. Invokes the _dismissOnMouseOver.

Parameters:
state  -  context of the timed event
Return:
Object

hasComponent

public Object hasComponent(Object component)

Parameters:
component  -  The owner-component to check
Return:
Object - true if the specific component is managed.

hasComponents

public Object hasComponents()

Return:
Object - true if any components are currently being managed.

_hideComponentPopups

private Object _hideComponentPopups(Object component)

Hides the target component with a cancel status. The AdfRichMenu is handled differently than a standard AdfRichPopup.

Parameters:
component    
Return:
Object

_hideDismissalBehavior

private Object _hideDismissalBehavior(Number index)

A popup dismissal behavior for most types of popups. This dismissal behavior is activated using the AdfDhtmlPopupWindow.HINT_AUTODISMISS_MENU, AdfDhtmlPopupWindow.HINT_AUTODISMISS_ALWAYS, and AdfDhtmlPopupWindow.HINT_AUTODISMISS_MOUSEOUT dismissal type. This dismissal behavior hides the popup and deregisters from the dismissal service. If the managed components are empty after deregistration, the event listeners on the document and body are unregistered.

Parameters:
index  -  into the private _componentStack
Return:
Object

_inactivateDismissalBehavior

private Object _inactivateDismissalBehavior(Number index)

A popup dismissal behavior for dialogs and panelWindows only. This dismissal behavior is activated using the AdfDhtmlPopupWindow.HINT_AUTODISMISS_INACTIVATE dismissal type. If the dismissing dialog is the active dialog, change its state to inactive. The dalog/panelWindow activity is managed by the AdfDhtmlDialogManager service.

Parameters:
index  -  into the private _componentStack
Return:
Object

Init

protected Object Init()

Initializes the AdfDhtmlAutoDismissalManager instance.

Return:
Object
Overrides:
AdfObject.Init()

_isComponentAncestor

private Boolean _isComponentAncestor(Object ancestorClientId,
                                     Object component)

Returns true if the provided ancestorClientId is for an ancestor of the provided component

Parameters:
ancestorClientId  -  the client id of the ancestor component
component  -  the component in question
Return:
Boolean - true if the provided ancestorClientId is for an ancestor of the provided component

_isTargetInOwner

private Boolean _isTargetInOwner(HTMLElement target,
                                 Object popupOwner)

Parameters:
target  -  The original event target
popupOwner  -  the component that spawned/owns the popup
Return:
Boolean - True if target is a DOM descendant of popupOwner

_isTargetInPopup

private Object _isTargetInPopup(HTMLElement target,
                                Object popupList)

Returns true if the target is in the list of popups

Parameters:
target  -  The original event target
popupList  -  the list of popups as per the somePeer.getAllPopups() method
Return:
Object - true if target is a DOM or component descendant of at least one of the popups in the popupList.

_popupUnderneathGlassPane

private Boolean _popupUnderneathGlassPane(Object popupList)

Parameters:
popupList  -  the list of popups as per the somePeer.getAllPopups() method
Return:
Boolean - True if at least one of the popups is underneath a modal glasspane

_registerEventHandlers

private Object _registerEventHandlers()

Registers the keyup, mousedown, focusin, blur and mouseover listeners attached to the document or the window.

Return:
Object

removeBehavior

public Object removeBehavior(Object component)

Unregisters a component from the autoDismissalManager and dismisses it.

Parameters:
component  -  The owner-component that invoked the popup
Return:
Object

_undismissDueToActiveIframe

private Object _undismissDueToActiveIframe(HTMLElement activeElement)

Invoked by the _dismissBlurringElement when catching a dismiss from a user moving focus into an iframe (e.g. richTextEditor or inlineFrame). Since blur events don't tell you where the focus was moved to and since we cannot have access to the iframe contents, we can only look at the document's activeElement (if supported, not supported in Firefox 2).

Parameters:
activeElement  -  The iframe that just became active
Return:
Object

_unregisterEventHandlers

private Object _unregisterEventHandlers()

Unregisters the keyup, mousedown, focusin, blur and mouseover listeners attached to the document or the window.

Return:
Object

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Generated on 2010.03.26 00:15 UTC
Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.