OracleJavaScript API Reference for Oracle ADF Faces

 

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

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

Warning:

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

public class AdfDhtmlPositionManager
extends AdfObject
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.



Field Summary

public static Object
BOTTOM
public static Object
CENTER
private Object
_elements
private Object
_isRTL
public static Object
LEFT
public static Object
MIDDLE
public static Object
MIN_WIDTH
public static Object
RIGHT
public static Object
TOP


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

constructor, superclass


Fields inherited from org.ecmascript.object.Object

prototype


Constructor Summary

public
AdfDhtmlPositionManager()
Copyright (c) 2008, 2010, Oracle and/or its affiliates.


Method Summary

private Number
_addElement(AdfAbstractFloatingElement floatingElement, Array<Object> verticalBehaviors, Array<Object> horizontalBehaviors, Boolean ignoreShadow)
Wrappers an element and its behaviors and registers it with the internal collection of managed AdfAbstractFloatingElements.
public Number
addFloatingElement(AdfAbstractFloatingElement floatingElement, String alignmentHint)
Public method to add a floating element thats position will be managed by the position manager.
private Number
_addFloatingElement(AdfAbstractFloatingElement floatingElement, String alignmentHint)
Private method to actually add a floating element.
public Object
addFloatingElementByPosition(AdfAbstractFloatingElement floatingElement, Object pos)
Public method to add a floating element by (x,y) position, like a mouse.
public Object
calculatePlacementPosition(Number elementHeight, Number elementWidth, String alignmentHint, Object alignElement, Object alignPosition)
Given height, width, an alignment hint, and either an align element or align position, calculates the position where a hypothetical popup should be placed.
private Object
_convertHorizontal(Object horizontalHint)
public Object
dispose()
Disposes the AdfDhtmlPositionManager instance.
public AdfDhtmlPopupWindow
findFloatingElement(Object childDomElement)
Uses the childDomElement to locate the floating element.
private Object
_getAlignBox(Object alignElement, Object alignPosition, Boolean ignoreShadow)
Returns a map summarizing the coordinates of the target alignment element or the alignment position.
private Array
_getBehavior(Array preference)
Passed in position (TOP, BOTTOM, LEFT, RIGHT) and returns an array of objects that define the behavior specified by the preference.
private Object
_getBox(AdfAbstractFloatingElement floatingElement, Boolean ignoreShadow)
Returns a map summarizing the coordinates of the target floatingElement.
public Object
getComputedBehavior(Number index)
Returns the calculated vertical and horizontal behaviors from the registered floating element.
public Number
getElementCount()
private Array
_getHintBehavior(String alignmentHint)
Private method to get hint behavior based on an alignment hint.
private Object
_getNewPosition(Object horizontalBehavior, Object verticalBehavior, Object box, Object alignBox)
Changes the floating elements position by calling setPosition on the AdfAbstractFloatingElement.
protected Object
Init()
Registers callbacks on the domWindow for for the following events:
protected static Object
InitClass()
Sets the positional constants (TOP, MIDDLE, BOTTOM, LEFT, CENTER, RIGHT) used to calculate the alignment behaviors.
private Number
_inversePosition(Number position)
Passed a constant postion that corresponds to TOP, BOTTOM, LEFT, RIGHT.
private Boolean
_isFloatingElementGreaterThanWindow(AdfDhtmlPopupWindow floatingElement)
private Boolean
_isOutsideScrollView(HTMLElement element)
Checks to see if the alignment element is visible within the view port.
public Boolean
managesElement(Object element)
Floating elements are registered with the page services zOrderManager.
private Object
_positionElement(AdfAbstractFloatingElement floatingElement, Object computedBehavior, Boolean alignElementIsManaged, Object box, Object alignBox)
Changes the floating elements position by calling setPosition on the AdfAbstractFloatingElement.
private String
_positionToString(Number position)
Returns a string description of the position.
private Boolean
_preferBottomBottomCondition(Object box, Object alignBox)
Behavior condition associated with align mnemonics:
private Boolean
_preferBottomTopCondition(Object box, Object alignBox, Boolean inverse)
Behavior condition associated with align mnemonics:
private Boolean
_preferLeftLeftCondition(Object box, Object alignBox, Boolean inverse)
Behavior condition associated with align mnemonics:
private Boolean
_preferLeftRightCondition(Object box, Object alignBox)
Behavior condition associated with align mnemonics:
private Boolean
_preferRightLeftCondition(Object box, Object alignBox, Boolean inverse)
Behavior condition associated with align mnemonics:
private Boolean
_preferRightRightCondition(Object box, Object alignBox)
Behavior condition associated with align mnemonics:
private Boolean
_preferTopBottomCondition(Object box, Object alignBox)
Behavior condition associated with align mnemonics:
private Boolean
_preferTopTopCondition(Object box, Object alignBox, Boolean inverse)
Behavior condition associated with align mnemonics:
private Object
_registerEventHanders()
Conditionally registers resize and scroll event handlers.
public Object
removeElement(Number index)
Removes a registered floating element by index.
private Object
_repostionOnScroll(Object evt)
Event callback assigned to the following events:
private Object
_repostionOnScrollTimeout()
Callback that is invoked on 200ms timeout.
public Boolean
resizeFloatingElement(HTMLElement childDomElement)
Used to resize the width of a floating element that has received a partial page update.
private Object
_selectBehavior(Array behaviors, Object box, Object alignBox)
Returns the behavior matching an alignment behavior condition.
private Object
_unregisterEventHanders()
Conditionally unregisters resize and scroll event handlers.
public Object
validatePosition(Number index)
Forces revalidation of a floating elements position.


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

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


Field Detail


BOTTOM

public static Object BOTTOM

CENTER

public static Object CENTER

_elements

private Object _elements

_isRTL

private Object _isRTL

LEFT

public static Object LEFT

MIDDLE

public static Object MIDDLE

MIN_WIDTH

public static Object MIN_WIDTH

RIGHT

public static Object RIGHT

TOP

public static Object TOP

Constructor Detail


AdfDhtmlPositionManager

public AdfDhtmlPositionManager()

Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.

Method Detail


_addElement

private Number _addElement(AdfAbstractFloatingElement floatingElement,
                           Array<Object> verticalBehaviors,
                           Array<Object> horizontalBehaviors,
                           Boolean ignoreShadow)

Wrappers an element and its behaviors and registers it with the internal collection of managed AdfAbstractFloatingElements.

Parameters:
floatingElement  -  popup element
verticalBehaviors  -  an array of two map wrapper objects
horizontalBehaviors  -  an array of two map wrapper objects
ignoreShadow  -  if true, the shadow tolerance is factored into the coordinates
Return:
Number - index of the registered element

addFloatingElement

public Number addFloatingElement(AdfAbstractFloatingElement floatingElement,
                                 String alignmentHint)

Public method to add a floating element thats position will be managed by the position manager. The popup's position will be kept relative to a dom element or a x, y position.

Parameters:
floatingElement  -  popup element
alignmentHint  -  determines the alignment relative to another element or x,y position
Return:
Number - index of the registered floatingElement

_addFloatingElement

private Number _addFloatingElement(AdfAbstractFloatingElement floatingElement,
                                   String alignmentHint)

Private method to actually add a floating element. The alignment behaviors (vertical, horizontal) are determined from the alignmentHint.

Parameters:
floatingElement  -  popup element
alignmentHint  -  determines the alignment relative to another element or x,y position
Return:
Number - index of the registered floatingElement

addFloatingElementByPosition

public Object addFloatingElementByPosition(AdfAbstractFloatingElement floatingElement,
                                           Object pos)

Public method to add a floating element by (x,y) position, like a mouse. The assumed alignmentHint to the alignment coordinates is "after_start".

Parameters:
floatingElement  -  popup element
pos  -  (x,y) alignment coordinates
Return:
Object

calculatePlacementPosition

public Object calculatePlacementPosition(Number elementHeight,
                                         Number elementWidth,
                                         String alignmentHint,
                                         Object alignElement,
                                         Object alignPosition)

Given height, width, an alignment hint, and either an align element or align position, calculates the position where a hypothetical popup should be placed. This method was originally created for use by the menu peer for calculating reattach positions for detached menus, and is flexible enough for other usages as well.

Parameters:
elementHeight  -  the height of the element
elementWidth  -  the width of the element
alignmentHint  -  determines the alignment relative to another element or x,y position
alignElement  -  the element to align by
alignPosition  -  (x,y) an x/y position to align by, can be used instead of alignElement
Return:
Object - position (x,y) alignment coordinates

_convertHorizontal

private Object _convertHorizontal(Object horizontalHint)

Parameters:
horizontalHint    
Return:
Object

dispose

public Object dispose()

Disposes the AdfDhtmlPositionManager instance.

Return:
Object

findFloatingElement

public AdfDhtmlPopupWindow findFloatingElement(Object childDomElement)

Uses the childDomElement to locate the floating element. The child dom element will be an ancestor or equal to the element managed by the AdfDhtmlPopupWindow sub class of "popup" controller.

Parameters:
childDomElement    
Return:
AdfDhtmlPopupWindow - popup controller or null if not found

_getAlignBox

private Object _getAlignBox(Object alignElement,
                            Object alignPosition,
                            Boolean ignoreShadow)

Returns a map summarizing the coordinates of the target alignment element or the alignment position.

Parameters:
alignElement  -  the element to align by
alignPosition  -  (x,y) alternately, an xy position can be provided to align by
ignoreShadow  -  if true, the shadow tolerance is factored into the coordinates
Return:
Object - position coordinates for the floatingElement (top, bottom, right, left, width, height)

_getBehavior

private Array _getBehavior(Array preference)

Passed in position (TOP, BOTTOM, LEFT, RIGHT) and returns an array of objects that define the behavior specified by the preference. Behavior callbacks are constructed by formulating the function name from the token representation of the preferences.

Parameters:
preference  -  alignment position preferences
Return:
Array - an array of behaviors grouped in pairs of two

_getBox

private Object _getBox(AdfAbstractFloatingElement floatingElement,
                       Boolean ignoreShadow)

Returns a map summarizing the coordinates of the target floatingElement.

Parameters:
floatingElement  -  popup element
ignoreShadow  -  if false, the shadow tolerance is factored into the coordinates
Return:
Object - position coordinates of the floatingElement (top, bottom, right, left, width, height)

getComputedBehavior

public Object getComputedBehavior(Number index)

Returns the calculated vertical and horizontal behaviors from the registered floating element. The behaviors are calculated by calling validatePosition. May return null.

Parameters:
index  -  of the registered element
Return:
Object - horizontal and vertical validated positions

getElementCount

public Number getElementCount()

Return:
Number - the total number of floating elements managed

_getHintBehavior

private Array _getHintBehavior(String alignmentHint)

Private method to get hint behavior based on an alignment hint. The inverse align mnemonic is assumed for each behavior. Each behavior is assiged a condition callback to validate the use of the alignment. If the validating condition fails, the inverse is used.

Parameters:
alignmentHint  -  determines the alignment relative to another element or x,y position
Return:
Array - behavior objects that contains [verticalBehavior, horizontalBehavior, and ignoreShadow] variables

_getNewPosition

private Object _getNewPosition(Object horizontalBehavior,
                               Object verticalBehavior,
                               Object box,
                               Object alignBox)

Changes the floating elements position by calling setPosition on the AdfAbstractFloatingElement.

Parameters:
horizontalBehavior    
verticalBehavior    
box  -  coordinates of the floatingElement (top, bottom, right, left, width, height)
alignBox  -  coordinates of the alignment element or align position (top, bottom, right, left, width, height)
Return:
Object - position that has an [x] and [y] value

Init

protected Object Init()

Registers callbacks on the domWindow for for the following events: mousewheel, DOMMouseScroll, scroll, and resize. The callback handers manage the position of floating elements based on the align hit relative to the align element of align position (x,y).

Return:
Object
Overrides:
AdfObject.Init()

InitClass

protected static Object InitClass()

Sets the positional constants (TOP, MIDDLE, BOTTOM, LEFT, CENTER, RIGHT) used to calculate the alignment behaviors. The minimum width is initialized to 32;

Return:
Object

_inversePosition

private Number _inversePosition(Number position)

Passed a constant postion that corresponds to TOP, BOTTOM, LEFT, RIGHT. The inverse position is returned.

Parameters:
position  -  alignment coordinate
Return:
Number - opposite position

_isFloatingElementGreaterThanWindow

private Boolean _isFloatingElementGreaterThanWindow(AdfDhtmlPopupWindow floatingElement)

Parameters:
floatingElement  -  managed by position
Return:
Boolean - true if the floating element is larger than the primary window in width or height

_isOutsideScrollView

private Boolean _isOutsideScrollView(HTMLElement element)

Checks to see if the alignment element is visible within the view port.

Parameters:
element  -  alignment element
Return:
Boolean - returns true if the alignment element is outside the view port

managesElement

public Boolean managesElement(Object element)

Floating elements are registered with the page services zOrderManager. This method checks to see if the target element is registered.

Parameters:
element  -  floating element
Return:
Boolean - true if the element is registered with zOrderManager.

_positionElement

private Object _positionElement(AdfAbstractFloatingElement floatingElement,
                                Object computedBehavior,
                                Boolean alignElementIsManaged,
                                Object box,
                                Object alignBox)

Changes the floating elements position by calling setPosition on the AdfAbstractFloatingElement.

Parameters:
floatingElement  -  popup element
computedBehavior  -  horizontal and vertical validated positions
alignElementIsManaged  -  true if managed by the page's zOrderManager
box  -  coordinates of the floatingElement (top, bottom, right, left, width, height)
alignBox  -  coordinates of the alignment element or align position (top, bottom, right, left, width, height)
Return:
Object

_positionToString

private String _positionToString(Number position)

Returns a string description of the position. The token is used to build behavior callbacks (vertical and horizontal).

Parameters:
position  -  alignment coordinate
Return:
String - token describing the position

_preferBottomBottomCondition

private Boolean _preferBottomBottomCondition(Object box,
                                             Object alignBox)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_END_AFTER and AdfRichPopup.ALIGN_START_AFTER. Inverse of _preferTopTopCondition.

Parameters:
box  -  positions of the floating element
alignBox  -  positions of the aligning element
Return:
Boolean - null true if rule is valid
See also:
_preferTopTopCondition(Object, Object, Boolean)

_preferBottomTopCondition

private Boolean _preferBottomTopCondition(Object box,
                                          Object alignBox,
                                          Boolean inverse)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_AFTER_START and AdfRichPopup.ALIGN_AFTER_END.

Parameters:
box  -  positions of the floating element
alignBox  -  positions of the aligning element
inverse  -  flip-flop the vertical rule
Return:
Boolean - null true if rule is valid

_preferLeftLeftCondition

private Boolean _preferLeftLeftCondition(Object box,
                                         Object alignBox,
                                         Boolean inverse)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_AFTER_START, AdfRichPopup.ALIGN_BEFORE_START and AdfRichPopup.ALIGN_OVERLAP.

Parameters:
box  -  positions of the floating element
alignBox  -  positions of the aligning element
inverse  -  flip-flop the horizontal rule
Return:
Boolean - null true if rule is valid

_preferLeftRightCondition

private Boolean _preferLeftRightCondition(Object box,
                                          Object alignBox)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_START_AFTER and AdfRichPopup.ALIGN_START_BEFORE.

Parameters:
box  -  positions of the floating element
alignBox    
Return:
Boolean - null true if rule is valid
See also:
_preferRightLeftCondition(Object, Object, Boolean)

_preferRightLeftCondition

private Boolean _preferRightLeftCondition(Object box,
                                          Object alignBox,
                                          Boolean inverse)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_END_BEFORE and AdfRichPopup.ALIGN_BEFORE_AFTER.

Parameters:
box  -  positions of the floating element
alignBox  -  positions of the aligning element
inverse  -  flip-flop the horizontal rule
Return:
Boolean - null true if rule is valid

_preferRightRightCondition

private Boolean _preferRightRightCondition(Object box,
                                           Object alignBox)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_AFTER_END, AdfRichPopup.ALIGN_BEFORE_END and AdfRichPopup.ALIGN_BEFORE_AFTER.

Parameters:
box  -  positions of the floating element
alignBox  -  positions of the aligning element
Return:
Boolean - null true if rule is valid
See also:
_preferLeftLeftCondition(Object, Object, Boolean)

_preferTopBottomCondition

private Boolean _preferTopBottomCondition(Object box,
                                          Object alignBox)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_BEFORE_START, AdfRichPopup.ALIGN_BEFORE_END and AdfRichPopup.ALIGN_BEFORE_AFTER.

Parameters:
box  -  positions of the floating element
alignBox  -  positions of the aligning element
Return:
Boolean - null true if rule is valid
See also:
_preferBottomTopCondition(Object, Object, Boolean)

_preferTopTopCondition

private Boolean _preferTopTopCondition(Object box,
                                       Object alignBox,
                                       Boolean inverse)

Behavior condition associated with align mnemonics: AdfRichPopup.ALIGN_END_BEFORE, AdfRichPopup.ALIGN_START_BEFORE and AdfRichPopup.ALIGN_OVERLAP;

Parameters:
box  -  positions of the floating element
alignBox  -  positions of the aligning element
inverse  -  flip-flop the vertical rule
Return:
Boolean - null true if rule is valid

_registerEventHanders

private Object _registerEventHanders()

Conditionally registers resize and scroll event handlers.

Return:
Object

removeElement

public Object removeElement(Number index)

Removes a registered floating element by index. The index is assigned when the element is added.

Parameters:
index  -  of the registered floatElement
Return:
Object

_repostionOnScroll

private Object _repostionOnScroll(Object evt)

Event callback assigned to the following events: mousewheel, DOMMouseScroll, scroll, and resize. A timed callback is invoked after 200 ms. Because these events are so chatty, events are eaten within the 200ms timeout.

Parameters:
evt  -  dom event
Return:
Object

_repostionOnScrollTimeout

private Object _repostionOnScrollTimeout()

Callback that is invoked on 200ms timeout. It is launched from the scroll and resizing events. The position is validated by alignment element or align position. If the floating element is aligned by element, and the element is no longer visible, the popup is hidden.

Return:
Object

resizeFloatingElement

public Boolean resizeFloatingElement(HTMLElement childDomElement)

Used to resize the width of a floating element that has received a partial page update. This function is invoked for the AdfPage.doResizeNotifyDom(). If the childDomElement is found within the content managed by a floating element, auto sizing of the popup's width is adjusted. The super class AdfDhtmlPopupWindow defines autoSize method that adjusts the popup's width and will respect the maximum width that can be optionally provided as a popup hint (AdfDhtmlPopupWindow.HINT_MAX_WIDTH). Types of popup controllers eligible for resizing: 1) AdfDhtmlSimpleFloat 3) AdfDhtmlPopupMenu 2) AdfDhtmlPopupSelector 4) AdfDhtmlNoteWindowPopupSelector

Parameters:
childDomElement  -  child dom element, PPR'ed element, used to locate a floating element
Return:
Boolean - true if the childElement could be used to locate the owning floating element; otherwise, a false return value indicates the childElement could not be found in an open floating element.

_selectBehavior

private Object _selectBehavior(Array behaviors,
                               Object box,
                               Object alignBox)

Returns the behavior matching an alignment behavior condition.

Parameters:
behaviors  -  floating elements alignment preferences
box  -  coordinates of the floatingElement (top, bottom, right, left, width, height)
alignBox  -  coordinates of the alignment element or align position (top, bottom, right, left, width, height)
Return:
Object - behavior that matches the alignment condiations

_unregisterEventHanders

private Object _unregisterEventHanders()

Conditionally unregisters resize and scroll event handlers.

Return:
Object

validatePosition

public Object validatePosition(Number index)

Forces revalidation of a floating elements position. The floating element is identified using its registered index assigned when added with the position management service.

Parameters:
index  -  of a registered floating element
Return:
Object

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

 

Generated on 2012.03.28 02:21 UTC
Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.