OracleJavaScript API Reference for Oracle ADF Faces

 

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

oracle.adfinternal.view.js.laf.dhtml.rich
Class AdfDomUtils

Warning:

org.ecmascript.object.Object
   |
   +--oracle.adfinternal.view.js.laf.dhtml.rich.AdfDomUtils

public class AdfDomUtils
extends Object
Called from our test code,s o this needs exporting



Field Summary

public static Object
FILTER_ACCEPT
public static Object
FILTER_REJECT
public static Object
FILTER_SKIP
private static Object
_HELP_WINDOW_NAME_COOKIE
private static Object
_LEGAL_ATTRIBUTES
private static Object
_LEGAL_ELEMENTS
private static Object
_REQUIRED_ICON_PLACEHOLDER_STYLE_CLASS
public static Object
TRAVERSE_DIRECTION_DOWN
public static Object
TRAVERSE_DIRECTION_PARALLEL
public static Object
TRAVERSE_DIRECTION_UP


Fields inherited from org.ecmascript.object.Object

constructor, prototype


Constructor Summary

public
AdfDomUtils()
Called from our test code,s o this needs exporting


Method Summary

public static Boolean
addCSSClassName(HTMLElement domElement, String className)
Adds a CSS className to the dom node if it doesn't already exist in the classNames list and returns true if the class name was added.
public static Object
addInlineStyle(Object element, Object newStyle, Object takesPrecedence)
public static Boolean
addOrRemoveCSSClassName(Boolean add, HTMLElement domElement, String className)
Convenient function to add or removes a CSS className from the dom node.
public static Object
canScroll(Object domNode, Object viewPortWidth, Object viewPortHeight)
private static Object
_cleanElementHtml(Object node)
public static Object
cleanHtml(Object domDocument, Object value)
public static Object
componentShowRequiredChanged(Object component, Object domElement, Object newValue, Object oldValue)
static Object
__componentTextChanged(Object component, Object domElement, Object newValue, Object oldValue)
Package-private function for handling text property changes.
public static Boolean
containsCSSClassName(HTMLElement domElement, String className)
public static HTMLElement
depthFirstFilter(HTMLElement element, HTMLElement rootElement, int direction, Function filterFunc, Object context)
Returns the first accepted element in depth-firt order defined by a filter function.
public static Object
fillEmptyCell(Object cell)
public static Object
findAccessKeyDom(Object domElement, Object accessKeyValue)
Find the accessKey SPAN within the given DOM element
public static Object
getAutoScrollDeltas(Object target, Object clientX, Object clientY)
Determines the number of pixels to autoscroll a target, given the current mouse location
public static HTMLElement
getChildElementByAttributeValue(Object domElement, Object attrName, Object attrValue, Object tagName)
Returns a dom element which is of type specified by tagName and has an attribute whose value is equal to attrValue.
public static HTMLElement
getChildElementByPosition(Object parentElement, Object type, Object position)
Get the element at the given position with same node type under parent element.
public static HTMLElement
getChildElementByValueMap(Object domElement, Object keyValueArray, Object tagName)
Returns a dom element which is of type specified by tagName and has an attribute whose key-value is provided by valueMap.
public static Object
getChildElements(Object parentElement)
Returns the child elements underneath the specified parent (only those with nodeType == 1).
public static HTMLElement[]
getChildElementsByAttributeValue(Object domElement, Object attrName, Object attrValue, Object tagName)
Returns the set of dom elements which are of the type specified by tagName and have an attribute whose value is equal to attrValue.
public static HTMLElement
getCommonAncestor(HTMLElement nodeA, HTMLElement nodeB)
Gets the common ancestor node the number of nodes between the two given DOM nodes.
private static Number
_getCSSClassNameIndex(String currentClassName, String className)
Returns the index at which className appears within currentClassName with either a space or the beginning or end of currentClassName on either side.
public static HTMLElement
getDescendentElement(HTMLElement parentElement, String elementName, Number index)
Returns the descendent element underneath the specified parent element which matches the specified elementName, and is in the specified index.
public static Element
getElement(Node node)
Returns the first element for a node.
public static Object
getElementAtPoint(Object element, Object pageX, Object pageY, Object closestMatch)
Return the element at a point in document coordinates, relative to a root.
public static Number
getElementDepth(HTMLElement element)
Gets the number of nodes deep that the element is in the DOM tree.
public static HTMLElement
getElementPosition(Object currentElement)
Get the position of current element with same node type under parent element.
public static Object
getElementsByClassName(Object domNode, Object className)
public static Object
getFirstChildElement(Object parentElement)
Returns the first child element underneath the specified parent
public static Object
getFirstChildNodeByType(Object parentElement, Object type)
Returns the first child node for a given type
public static HTMLElement
getFirstDescendentElement(HTMLElement parentElement, String elementName)
Returns the first descendent element underneath the specified parent element which matches the specified elementName.
public static HTMLElement
getFirstElementByTagName(Object domElement, Object tagName)
Returns the first element of a dom element with the given tagName.
public static HTMLElement
getFirstElementMatch(HTMLElement element, Boolean isExclusive, Function matchFunc, Object context)
Returns the first element inside of the specified element which matches some criteria defined by a match function.
public static HTMLElement
getFirstFilteredElement(HTMLElement element, Boolean isExclusive, Function filterFunc, Object context)
Returns the first accepted element inside of the specified element which is defined by a filter function.
public static Object
getFormElement(Object node)
Returns the form element for a given dom node.
public static Object
getFormElementValue(HTMLElement formElement, String formElementName)
Get the value for a form element
private static Object
_getHelpWindowName()
Method that will get the help window name.
public static Object
getInputFileForm(Object actionForm)
Returns the form element, when input files with content are inside the form, or null.
public static Object
getLastChildElement(Object parentElement)
Returns the last child element underneath the specified parent
public static HTMLElement
getLastElementMatch(HTMLElement element, Boolean isExclusive, Function matchFunc, Object context)
Returns the last element inside of the specified element which matches some criteria defined by a match function.
public static HTMLElement
getLastFilteredElement(HTMLElement element, Boolean isExclusive, Function filterFunc, Object context)
Returns the last accepted element inside of the specified element which is defined by a filter function.
public static HTMLElement
getNextElement(Object currentElement)
Find next sibling element.
public static HTMLElement
getNextElementMatch(HTMLElement element, HTMLElement contextElement, Boolean isExclusive, Function matchFunc, Object context)
Returns the next element after the specified element which matches some criteria defined by a match function.
public static HTMLElement
getNextFilteredElement(HTMLElement element, HTMLElement contextElement, Boolean isExclusive, Function filterFunc, Object context)
Returns the next accepted element after the specified element defined by a filter function.
public static Number
getNodeDistance(HTMLElement nodeA, HTMLElement nodeB)
Counts the number of nodes between the two given DOM nodes.
public static Object
getNodeInfo(Object domNode)
public static Number
getNonWhitespaceChildCount(HTMLElement parentElement)
Returns the number of displayed child elements and non-whitespace (e.g.
public static number
getOffsetSizeFromCssLength(HTMLElement container, string cssLength)
Gets the number of pixels that the specified CSS length equates to when applied as a width on a child of the specified container element.
public static HTMLElement
getOnlyChildElement(HTMLElement parentElement)
Returns the only child element underneath the specified parent, or null if the parent has zero or more than one child element.
public static Object
getParentWithAttr(Object rootElement, Object startElement, Object attr)
Walk up the parent hierarchy to the root element to find an element with the given attribute.
public static HTMLElement
getPreviousElement(Object currentElement)
Find previous sibling element.
public static HTMLElement
getPreviousElementMatch(HTMLElement element, HTMLElement contextElement, Function matchFunc, Object context)
Returns the previous element before the specified element which matches some criteria defined by a match function.
public static HTMLElement
getPreviousFilteredElement(HTMLElement element, HTMLElement contextElement, Function filterFunc, Object context)
Returns the previous accepted element before the specified element which is defined by a filter function.
public static Object
getRelativePosition(Object elem)
Get the position of element from the closest non-static positioned ancestor element
public static Object
getTabIndex(Object element)
Get the tabIndex for an element.
public static Object
handleTextChangeWithAccessKey(Object component, Object domElement, Object newValue)
Set the text of a domElement taking into account the component accessKey property.
public static Object
isAncestor(Object ancestorNode, Object node)
Checks to see if the "ancestorNode" is a ancestor of "node".
public static Object
isAncestorOrSelf(Object ancestorNode, Object node)
Checks to see if the "ancestorNode" is a ancestor of "node" or if they are the same.
public static Object
isInVisibleSubtree(Object node)
Tests whether DOM node is in a visible subtree.
public static Object
isMultiPartForm(Object formElement)
Checks whether the form is a multi-part form
public static Object
isNodeInDocumentHierarchy(Object domDocument, Object node)
Returns true if the node is in the domDocument's hierarchy
public static Object
isVisible(Object domElement)
Tests whether DOM node is visible.
public static Object
launchHelpWindow(Object url)
Method to launch the help window.
private static boolean
_matchRequiredIconSpan(HTMLElement element)
private static Object
_removeAccessKeyElement(Object domElement, Object accessKeyElement)
public static Object
removeAllNodes(HTMLElement element)
Removes all child nodes from the given element.
public static Boolean
removeCSSClassName(HTMLElement domElement, String className)
Removes a CSS className to the dom node if it existd in the classNames list and returns true if the class name was removed.
private static Object
_removeSiblings(Object domElement)
public static HTMLElement
reverseDepthFirstFilter(HTMLElement element, HTMLElement rootElement, int direction, Function filterFunc, Object context)
Returns the first accepted element in this subtree defined by a filter function.
public static Object
scrollChildIntoViewY(HTMLElement childElement)
Vertically scrolls a child element of a scrolling parent into view.
public static Object
scrollDownBy(Object domElement, Object deltaY)
public static Object
scrollRightBy(Object domElement, Object deltaX)
public static Object
setAccessibleState(Object component, Object state)
Sets the content of the component's "state" as rendered by RichRenderUtils.renderRoleState().
private static Object
_setHelpWindowName(Object windowName)
Method that will set the help window name.
public static Object
setScrollLeft(Object domElement, Object newScrollLeft)
Set the scrollLeft of the element, making sure that we don't scroll beyond the element's bounds
public static Object
setScrollTop(Object domElement, Object newScrollTop)
Set the scrollTop of the element, making sure that we don't scroll beyond the element's bounds
private static Object
_setTextAndAccessKeySpan(Object component, Object domElement, Object accessKeyValue, Object accessKeySpan, Object newValue)
Called when there is an accessKey property value, but no SPAN to show it in the UI.
private static Object
_setTextContent(Object domElement, Object value)
public static Object
setVisible(Object domElement, Object visible)
Hides/shows the domElement based on the boolean visible value.
public static Object
stripScripts(Object domElement)
Once the scripts are loaded they are no longer needed in the dom.
public static Object
suppressActionLinkBrowserContextMenu(AdfUIInputEvent componentContextMenuEvent)
Suppresses the browser's native context menu from being shown when the target of a HandleComponentContextMenu event is an action link (no href to load in a new tab/window).
public static Object
swapIcon(HTMLElement originalIcon, String iconKey)
This method looks in the lookAndFeel for the iconKey to get the new icon, and then it swaps out the original icon's dom and swaps in the new icon's dom.


Field Detail


FILTER_ACCEPT

public static Object FILTER_ACCEPT

FILTER_REJECT

public static Object FILTER_REJECT

FILTER_SKIP

public static Object FILTER_SKIP

_HELP_WINDOW_NAME_COOKIE

private static Object _HELP_WINDOW_NAME_COOKIE

_LEGAL_ATTRIBUTES

private static Object _LEGAL_ATTRIBUTES

_LEGAL_ELEMENTS

private static Object _LEGAL_ELEMENTS

_REQUIRED_ICON_PLACEHOLDER_STYLE_CLASS

private static Object _REQUIRED_ICON_PLACEHOLDER_STYLE_CLASS

TRAVERSE_DIRECTION_DOWN

public static Object TRAVERSE_DIRECTION_DOWN

TRAVERSE_DIRECTION_PARALLEL

public static Object TRAVERSE_DIRECTION_PARALLEL

TRAVERSE_DIRECTION_UP

public static Object TRAVERSE_DIRECTION_UP

Constructor Detail


AdfDomUtils

public AdfDomUtils()

Called from our test code,s o this needs exporting

Method Detail


addCSSClassName

public static Boolean addCSSClassName(HTMLElement domElement,
                                      String className)

Adds a CSS className to the dom node if it doesn't already exist in the classNames list and returns true if the class name was added.

Parameters:
domElement  -  DOM Element to add style class name to
className  -  Name of style class to add
Default value = null
Return:
Boolean - null true if the style class was added

addInlineStyle

public static Object addInlineStyle(Object element,
                                    Object newStyle,
                                    Object takesPrecedence)

Parameters:
element    
newStyle    
takesPrecedence    
Return:
Object

addOrRemoveCSSClassName

public static Boolean addOrRemoveCSSClassName(Boolean add,
                                              HTMLElement domElement,
                                              String className)

Convenient function to add or removes a CSS className from the dom node.

Parameters:
add  -  boolean value if we should do an add of a CSS className
domElement  -  DOM Element to remove style class name from
className  -  the CSS className which should be added or removed
Return:
Boolean - null true if the element's style class list changed

canScroll

public static Object canScroll(Object domNode,
                               Object viewPortWidth,
                               Object viewPortHeight)

Parameters:
domNode    
viewPortWidth    
viewPortHeight    
Return:
Object

_cleanElementHtml

private static Object _cleanElementHtml(Object node)

Parameters:
node    
Return:
Object

cleanHtml

public static Object cleanHtml(Object domDocument,
                               Object value)

Parameters:
domDocument    
value    
Return:
Object

componentShowRequiredChanged

public static Object componentShowRequiredChanged(Object component,
                                                  Object domElement,
                                                  Object newValue,
                                                  Object oldValue)

Parameters:
component    
domElement    
newValue    
oldValue    
Return:
Object

__componentTextChanged

static Object __componentTextChanged(Object component,
                                      Object domElement,
                                      Object newValue,
                                      Object oldValue)

Package-private function for handling text property changes. This is implementation is shared by various peers, such as AdfDhtmlCommandLinkPeer AdfDhtmlGoLinkPeer.

Parameters:
component    
domElement    
newValue    
oldValue    
Return:
Object

containsCSSClassName

public static Boolean containsCSSClassName(HTMLElement domElement,
                                           String className)

Parameters:
domElement  -  DOM Element to check for the style className
className  -  the CSS className to check for
Return:
Boolean - null true if the className is in the element's list of classes

depthFirstFilter

public static HTMLElement depthFirstFilter(HTMLElement element,
                                           HTMLElement rootElement,
                                           int direction,
                                           Function filterFunc,
                                           Object context)

Returns the first accepted element in depth-firt order defined by a filter function.

Parameters:
element  -  element to begin filtering from
rootElement  -  The filtering is constrained to the subtree within this element.
direction  -  the direction of the search. Ideally, we would like to have an associated array to mark whether an element is visited or not, and what's the filter value for that element when it was first visited, thus we can decide whether to return the element as accepted, or to search my sibling or parent. But DOM element is not suitable as an key, and not every element would had id, so we use the direction value to hint us whether an element has been visited before. It is possible that the filter function is invoked twice (an associated array could avoid that) on one elment, but since we have context cache, so it's a quick lookup for the second time we visit the element.
filterFunc  -  A function which is used to filter a particular element. The function takes two arguments - the element to test and an optional context - and returns one of the following filter values: AdfDomUtils.FILTER_SKIP : no, I am not accepted, but one of my children could be accepted AdfDomUtils.FILTER_REJECT : no, I am not accepted, and none of my children could possibly be accepted AdfDomUtils.FILTER_ACCEPT : yes, I am accepted
context  -  optional context for the filter function
Return:
HTMLElement - The accepted element if one is found, null otherwise.

fillEmptyCell

public static Object fillEmptyCell(Object cell)

Parameters:
cell    
Return:
Object

findAccessKeyDom

public static Object findAccessKeyDom(Object domElement,
                                      Object accessKeyValue)

Find the accessKey SPAN within the given DOM element

Parameters:
domElement    
accessKeyValue    
Return:
Object

getAutoScrollDeltas

public static Object getAutoScrollDeltas(Object target,
                                         Object clientX,
                                         Object clientY)

Determines the number of pixels to autoscroll a target, given the current mouse location

Parameters:
target    
clientX    
clientY    
Return:
Object

getChildElementByAttributeValue

public static HTMLElement getChildElementByAttributeValue(Object domElement,
                                                          Object attrName,
                                                          Object attrValue,
                                                          Object tagName)

Returns a dom element which is of type specified by tagName and has an attribute whose value is equal to attrValue. If it doesn't find any element with that attribute it returns null.

Parameters:
domElement  -  the dom element which contains child element to locate
attrName  -  the name of the attribute on the element
attrValue  -  the value of the attribute on the element
tagName  -  name of the tag, if undefined then tagName=
Return:
HTMLElement - The element with matching attribute value, or null if none exist

getChildElementByPosition

public static HTMLElement getChildElementByPosition(Object parentElement,
                                                    Object type,
                                                    Object position)

Get the element at the given position with same node type under parent element.

Parameters:
parentElement  -  the parent node
type    
position  -  the node position uder its parent element
Return:
HTMLElement - the position if currentElement is not null

getChildElementByValueMap

public static HTMLElement getChildElementByValueMap(Object domElement,
                                                    Object keyValueArray,
                                                    Object tagName)

Returns a dom element which is of type specified by tagName and has an attribute whose key-value is provided by valueMap. If it does not get any element with that attribute it returns null.

Parameters:
domElement  -  the dom element which contains child element to locate
keyValueArray  -  key-value array for the attribute
tagName  -  name of the tag, if undefined then tagName=
Return:
HTMLElement - The element with matching attribute value, or null if none exist

getChildElements

public static Object getChildElements(Object parentElement)

Returns the child elements underneath the specified parent (only those with nodeType == 1).

Parameters:
parentElement    
Return:
Object

getChildElementsByAttributeValue

public static HTMLElement[] getChildElementsByAttributeValue(Object domElement,
                                                             Object attrName,
                                                             Object attrValue,
                                                             Object tagName)

Returns the set of dom elements which are of the type specified by tagName and have an attribute whose value is equal to attrValue. If it doesn't find any element with that attriburte it returns null.

Parameters:
domElement  -  the dom element which contains child elements to locate
attrName  -  the name of the attribute on the element
attrValue  -  the value of the attribute on the element
tagName  -  name of the tag, if undefined then tagName=
Return:
HTMLElement[] - Elements with matching attribute value, or null if none exist

getCommonAncestor

public static HTMLElement getCommonAncestor(HTMLElement nodeA,
                                            HTMLElement nodeB)

Gets the common ancestor node the number of nodes between the two given DOM nodes.

Parameters:
nodeA  -  One of the DOM nodes to count nodes between
nodeB  -  One of the DOM nodes to count nodes between
Return:
HTMLElement - null or the common ancestor of the two nodes.

_getCSSClassNameIndex

private static Number _getCSSClassNameIndex(String currentClassName,
                                            String className)

Returns the index at which className appears within currentClassName with either a space or the beginning or end of currentClassName on either side. This function optimizes the runtime speed by not creating objects in most cases and assuming 1) It is OK to only check for spaces as whitespace characters 2) It is rare for the searched className to be a substring of another className, therefore if we get a hit on indexOf, we have almost certainly found our className 3) It is even rarer for the searched className to be a substring of more than one className, therefore, repeating the search from the end of the string should almost always either return our className or the original search hit from indexOf

Parameters:
currentClassName  -  Space-separated class name string to search
className  -  String to search for within currentClassName
Return:
Number - index of className in currentClassName, or -1 if it doesn't exist

getDescendentElement

public static HTMLElement getDescendentElement(HTMLElement parentElement,
                                               String elementName,
                                               Number index)

Returns the descendent element underneath the specified parent element which matches the specified elementName, and is in the specified index.

Parameters:
parentElement  -  The parent DOM element under which to search for the descendent.
elementName  -  The name of the descendent element to find (eg. "SPAN").
index  -  The numeric position of the descendent element, starting with "0". For clarification, 0 is the first position, 1 is the second position, etc.
Return:
HTMLElement - The descendent element if one is found, otherwise null.

getElement

public static Element getElement(Node node)

Returns the first element for a node. If the node is an element, that element is returned; otherwise, the closest parent element will be returned.

Parameters:
node  -  the node to get the element for
Return:
Element - the closest element

getElementAtPoint

public static Object getElementAtPoint(Object element,
                                       Object pageX,
                                       Object pageY,
                                       Object closestMatch)

Return the element at a point in document coordinates, relative to a root.

Parameters:
element    
pageX    
pageY    
closestMatch    
Return:
Object

getElementDepth

public static Number getElementDepth(HTMLElement element)

Gets the number of nodes deep that the element is in the DOM tree.

Parameters:
element  -  the element whose depth is returned
Return:
Number - the number of nodes deep in the DOM tree

getElementPosition

public static HTMLElement getElementPosition(Object currentElement)

Get the position of current element with same node type under parent element.

Parameters:
currentElement  -  the current node
Return:
HTMLElement - the position if currentElement is not null

getElementsByClassName

public static Object getElementsByClassName(Object domNode,
                                            Object className)

Parameters:
domNode    
className    
Return:
Object

getFirstChildElement

public static Object getFirstChildElement(Object parentElement)

Returns the first child element underneath the specified parent

Parameters:
parentElement    
Return:
Object

getFirstChildNodeByType

public static Object getFirstChildNodeByType(Object parentElement,
                                             Object type)

Returns the first child node for a given type

Parameters:
parentElement    
type    
Return:
Object

getFirstDescendentElement

public static HTMLElement getFirstDescendentElement(HTMLElement parentElement,
                                                    String elementName)

Returns the first descendent element underneath the specified parent element which matches the specified elementName.

Parameters:
parentElement  -  The parent DOM element under which to search for the descendent.
elementName  -  The name of the descendent element to find (eg. "SPAN").
Return:
HTMLElement - The descendent element if one is found, otherwise null.

getFirstElementByTagName

public static HTMLElement getFirstElementByTagName(Object domElement,
                                                   Object tagName)

Returns the first element of a dom element with the given tagName.

Parameters:
domElement    
tagName    
Return:
HTMLElement - the DOM within the component related to scopedId

getFirstElementMatch

public static HTMLElement getFirstElementMatch(HTMLElement element,
                                               Boolean isExclusive,
                                               Function matchFunc,
                                               Object context)

Returns the first element inside of the specified element which matches some criteria defined by a match function.

Parameters:
element  -  element to begin searching from
isExclusive  -  Whether to include provided element in the search
matchFunc  -  A function which is used to test whether a particular element is a match. The function takes a single argument - the element to test - and returns a boolean indicating whether the element is a match.
context  -  optional context for the match function
Return:
HTMLElement - The first matching element if one is found, null otherwise.

getFirstFilteredElement

public static HTMLElement getFirstFilteredElement(HTMLElement element,
                                                  Boolean isExclusive,
                                                  Function filterFunc,
                                                  Object context)

Returns the first accepted element inside of the specified element which is defined by a filter function.

Parameters:
element  -  element to begin filtering from
isExclusive  -  Whether to exclude the provided element in the filtering
filterFunc  -  A function which is used to filter a particular element. The function takes two arguments - the element to test and an optional context - and returns one of the following filter values: AdfDomUtils.FILTER_SKIP : no, I am not accepted, but one of my children could be accepted AdfDomUtils.FILTER_REJECT : no, I am not accepted, and none of my children could possibly be accepted AdfDomUtils.FILTER_ACCEPT : yes, I am accepted
context  -  optional context for the filter function
Return:
HTMLElement - The first accepted element if one is found, null otherwise.

getFormElement

public static Object getFormElement(Object node)

Returns the form element for a given dom node. This implementation walks up the DOM tree until it finds the form element. null is returned if the form element cannot be found.

Parameters:
node    
Return:
Object

getFormElementValue

public static Object getFormElementValue(HTMLElement formElement,
                                         String formElementName)

Get the value for a form element

Parameters:
formElement  -  the FORM element
formElementName  -  The name of the form element to get the value of.
Return:
Object

_getHelpWindowName

private static Object _getHelpWindowName()

Method that will get the help window name.

Return:
Object

getInputFileForm

public static Object getInputFileForm(Object actionForm)

Returns the form element, when input files with content are inside the form, or null.

Parameters:
actionForm    
Return:
Object

getLastChildElement

public static Object getLastChildElement(Object parentElement)

Returns the last child element underneath the specified parent

Parameters:
parentElement    
Return:
Object

getLastElementMatch

public static HTMLElement getLastElementMatch(HTMLElement element,
                                              Boolean isExclusive,
                                              Function matchFunc,
                                              Object context)

Returns the last element inside of the specified element which matches some criteria defined by a match function.

Parameters:
element  -  element to begin searching from
isExclusive  -  Whether to include provided element in the search
matchFunc  -  A function which is used to test whether a particular element is a match. The function takes a single argument - the element to test - and returns a boolean indicating whether the element is a match.
context  -  optional context for the match function
Return:
HTMLElement - The last matching element if one is found, null otherwise.

getLastFilteredElement

public static HTMLElement getLastFilteredElement(HTMLElement element,
                                                 Boolean isExclusive,
                                                 Function filterFunc,
                                                 Object context)

Returns the last accepted element inside of the specified element which is defined by a filter function.

Parameters:
element  -  element to begin filtering from
isExclusive  -  Whether to exclude provided element in the search
filterFunc  -  A function which is used to filter a particular element. The function takes two arguments - the element to test and an optional context - and returns one of the following filter values: AdfDomUtils.FILTER_SKIP : no, I am not accepted, but one of my children could be accepted AdfDomUtils.FILTER_REJECT : no, I am not accepted, and none of my children could possibly be accepted AdfDomUtils.FILTER_ACCEPT : yes, I am accepted
context  -  optional context for the filter function
Return:
HTMLElement - The last accepted element if one is found, null otherwise.

getNextElement

public static HTMLElement getNextElement(Object currentElement)

Find next sibling element.

Parameters:
currentElement  -  the current node
Return:
HTMLElement - the nex sibiling element if found or null if not

getNextElementMatch

public static HTMLElement getNextElementMatch(HTMLElement element,
                                              HTMLElement contextElement,
                                              Boolean isExclusive,
                                              Function matchFunc,
                                              Object context)

Returns the next element after the specified element which matches some criteria defined by a match function.

Parameters:
element  -  element to begin searching from
contextElement  -  The search is constrained to the subtree within the this element. If no context element is specified, the root document element is treated as the context element.
isExclusive  -  Whether to include the children of the provided element in the search.
Default value = false
matchFunc  -  A function which is used to test whether a particular element is a match. The function takes a single argument - the element to test - and returns a boolean indicating whether the element is a match.
context  -  optional context for the match function
Return:
HTMLElement - The next matching element if one is found, null otherwise.

getNextFilteredElement

public static HTMLElement getNextFilteredElement(HTMLElement element,
                                                 HTMLElement contextElement,
                                                 Boolean isExclusive,
                                                 Function filterFunc,
                                                 Object context)

Returns the next accepted element after the specified element defined by a filter function.

Parameters:
element  -  element to begin filtering from
contextElement  -  The filtering is constrained to the subtree within this element. If no context element is specified, the root document element is treated as the context element.
isExclusive  -  Whether to exclude the children of the provided element in the filtering.
Default value = false
filterFunc  -  A function which is used to filter a particular element. The function takes two arguments - the element to test and an optional context - and returns one of the following filter values: AdfDomUtils.FILTER_SKIP : no, I am not accepted, but one of my children could be accepted AdfDomUtils.FILTER_REJECT : no, I am not accepted, and none of my children could possibly be accepted AdfDomUtils.FILTER_ACCEPT : yes, I am accepted
context  -  optional context for the filter function
Return:
HTMLElement - The next accepted element if one is found, null otherwise.

getNodeDistance

public static Number getNodeDistance(HTMLElement nodeA,
                                     HTMLElement nodeB)

Counts the number of nodes between the two given DOM nodes.

Parameters:
nodeA  -  One of the DOM nodes to count nodes between
nodeB  -  One of the DOM nodes to count nodes between
Return:
Number - zero if equal, the number of nodes between them, or Number.POSITIVE_INFINITY if the nodes are not connected.

getNodeInfo

public static Object getNodeInfo(Object domNode)

Parameters:
domNode    
Return:
Object

getNonWhitespaceChildCount

public static Number getNonWhitespaceChildCount(HTMLElement parentElement)

Returns the number of displayed child elements and non-whitespace (e.g. pretty printed) text nodes underneath the specified parent. Comments are not counted either.

Parameters:
parentElement  -  the node whose children we want to count
Return:
Number - the number of child elements and non-whitespace text nodes

getOffsetSizeFromCssLength

public static number getOffsetSizeFromCssLength(HTMLElement container,
                                                string cssLength)

Gets the number of pixels that the specified CSS length equates to when applied as a width on a child of the specified container element. It is important to note that offset sizes are not fractions of pixels so if you are trying to use this result in other computations, you may encounter rounding issues.

Parameters:
container  -  the container used to evaluate the offset
cssLength  -  the length to convert (it is invalid to specify a percentage value or "auto")
Return:
number - the number of pixels that the length converts to; if an invalid cssLength was provided, the result may be unreliable

getOnlyChildElement

public static HTMLElement getOnlyChildElement(HTMLElement parentElement)

Returns the only child element underneath the specified parent, or null if the parent has zero or more than one child element.

Parameters:
parentElement  -  the node whose children we want to retrieve the sole child from
Return:
HTMLElement - the only child element or null if 0 or more than 1 displayed child is found

getParentWithAttr

public static Object getParentWithAttr(Object rootElement,
                                       Object startElement,
                                       Object attr)

Walk up the parent hierarchy to the root element to find an element with the given attribute. If no matching element is found, null is returned.

Parameters:
rootElement  -  {HTMLElement} the root element where the walk up parent hierarchy stops
startElement  -  {HTMLElement} the element where we start the walk up the parent hierarchy
attr  -  {string} the attribute to check for
Return:
Object - the element with matching element found, or null if not found

getPreviousElement

public static HTMLElement getPreviousElement(Object currentElement)

Find previous sibling element.

Parameters:
currentElement  -  the current node
Return:
HTMLElement - the previous sibling element if found or null if not

getPreviousElementMatch

public static HTMLElement getPreviousElementMatch(HTMLElement element,
                                                  HTMLElement contextElement,
                                                  Function matchFunc,
                                                  Object context)

Returns the previous element before the specified element which matches some criteria defined by a match function.

Parameters:
element  -  element to begin searching from
contextElement  -  The search is constrained to the subtree within the this element. If no context element is specified, the root document element is treated as the context element.
matchFunc  -  A function which is used to test whether a particular element is a match. The function takes a single argument - the element to test - and returns a boolean indicating whether the element is a match.
context  -  optional context for the match function
Return:
HTMLElement - The previous matching element if one is found, null otherwise.

getPreviousFilteredElement

public static HTMLElement getPreviousFilteredElement(HTMLElement element,
                                                     HTMLElement contextElement,
                                                     Function filterFunc,
                                                     Object context)

Returns the previous accepted element before the specified element which is defined by a filter function.

Parameters:
element  -  element to begin filtering from
contextElement  -  The filtering is constrained to the subtree within this element. If no context element is specified, the root document element is treated as the context element.
filterFunc  -  A function which is used to filter a particular element. The function takes two arguments - the element to test and an optional context - and returns one of the following filter values: AdfDomUtils.FILTER_SKIP : no, I am not accepted, but one of my children could be accepted AdfDomUtils.FILTER_REJECT : no, I am not accepted, and none of my children could possibly be accepted AdfDomUtils.FILTER_ACCEPT : yes, I am accepted
context  -  optional context for the filter function
Return:
HTMLElement - The previous accepted element if one is found, null otherwise.

getRelativePosition

public static Object getRelativePosition(Object elem)

Get the position of element from the closest non-static positioned ancestor element

Parameters:
elem    
Return:
Object - an object with two properties (x for the left coordinate and y for the top coordinate)

getTabIndex

public static Object getTabIndex(Object element)

Get the tabIndex for an element. Returns undefined if the tab index has not been specified.

Parameters:
element  -  the element to get the property for
Return:
Object - the tab index, if specified otherwise undefined

handleTextChangeWithAccessKey

public static Object handleTextChangeWithAccessKey(Object component,
                                                   Object domElement,
                                                   Object newValue)

Set the text of a domElement taking into account the component accessKey property.

Parameters:
component  -  The component that the text changed for
domElement  -  The element that renders the text value for this component (not necessarily the root element for the component)
newValue  -  The new text value for the component
Return:
Object - true if the value was able to be set

isAncestor

public static Object isAncestor(Object ancestorNode,
                                Object node)

Checks to see if the "ancestorNode" is a ancestor of "node".

Parameters:
ancestorNode    
node    
Return:
Object

isAncestorOrSelf

public static Object isAncestorOrSelf(Object ancestorNode,
                                      Object node)

Checks to see if the "ancestorNode" is a ancestor of "node" or if they are the same. Called from our test code

Parameters:
ancestorNode    
node    
Return:
Object

isInVisibleSubtree

public static Object isInVisibleSubtree(Object node)

Tests whether DOM node is in a visible subtree. Returns false if a null DOM node is specified.

Parameters:
node    
Return:
Object

isMultiPartForm

public static Object isMultiPartForm(Object formElement)

Checks whether the form is a multi-part form

Parameters:
formElement    
Return:
Object

isNodeInDocumentHierarchy

public static Object isNodeInDocumentHierarchy(Object domDocument,
                                               Object node)

Returns true if the node is in the domDocument's hierarchy

Parameters:
domDocument    
node    
Return:
Object

isVisible

public static Object isVisible(Object domElement)

Tests whether DOM node is visible. Returns false if a null DOM node is specified.

Parameters:
domElement    
Return:
Object

launchHelpWindow

public static Object launchHelpWindow(Object url)

Method to launch the help window. RichRenderUtils.renderHelpIcon will generate onclick JavaScript that will call this method when the help icon is pressed.

Parameters:
url  -  The url that should be displayed in the help window.
Return:
Object

_matchRequiredIconSpan

private static boolean _matchRequiredIconSpan(HTMLElement element)

Parameters:
element  -  searched on
Return:
boolean - null true if the element is a span that's assigned the "p_rqi" style class

_removeAccessKeyElement

private static Object _removeAccessKeyElement(Object domElement,
                                              Object accessKeyElement)

Parameters:
domElement    
accessKeyElement    
Return:
Object

removeAllNodes

public static Object removeAllNodes(HTMLElement element)

Removes all child nodes from the given element.

Parameters:
element  -  the DOM element whose children will be removed
Return:
Object

removeCSSClassName

public static Boolean removeCSSClassName(HTMLElement domElement,
                                         String className)

Removes a CSS className to the dom node if it existd in the classNames list and returns true if the class name was removed.

Parameters:
domElement  -  DOM Element to remove style class name from
className  -  Name of style class to remove
Default value = null
Return:
Boolean - null true if the style class was removed

_removeSiblings

private static Object _removeSiblings(Object domElement)

Parameters:
domElement    
Return:
Object

reverseDepthFirstFilter

public static HTMLElement reverseDepthFirstFilter(HTMLElement element,
                                                  HTMLElement rootElement,
                                                  int direction,
                                                  Function filterFunc,
                                                  Object context)

Returns the first accepted element in this subtree defined by a filter function. The order to search the subtree is reverse of depth-first search.

Parameters:
element  -  element to begin filtering from
rootElement  -  The filtering is constrained to the subtree within this element.
direction  -  the direction of the search. Ideally, we would like to have an associated array to mark whether an element is visited or not, and what's the filter value for that element when it was first visited, thus we can decide whether to return the element as accepted, or to search my sibling or parent. But DOM element is not suitable as key, and not every element would had id, so we use the direction value to hint us whether an element has been visited before. It is possible that the filter function is invoked twice (an associated array could avoid that), but since we have context cache, so it's a quick lookup for the second time we visit the element.
filterFunc  -  A function which is used to filter a particular element. The function takes two arguments - the element to test and an optional context - and returns one of the following filter values: AdfDomUtils.FILTER_SKIP : no, I am not accepted, but one of my children could be accepted AdfDomUtils.FILTER_REJECT : no, I am not accepted, and none of my children could possibly be accepted AdfDomUtils.FILTER_ACCEPT : yes, I am accepted
context  -  optional context for the filter function
Return:
HTMLElement - The accepted element if one is found, null otherwise.

scrollChildIntoViewY

public static Object scrollChildIntoViewY(HTMLElement childElement)

Vertically scrolls a child element of a scrolling parent into view. Note that if the scrolling parent is scrolled off screen, this function doesn't scroll it back on.

Parameters:
childElement  -  The child element to bring into view
Return:
Object

scrollDownBy

public static Object scrollDownBy(Object domElement,
                                  Object deltaY)

Parameters:
domElement    
deltaY    
Return:
Object

scrollRightBy

public static Object scrollRightBy(Object domElement,
                                   Object deltaX)

Parameters:
domElement    
deltaX    
Return:
Object

setAccessibleState

public static Object setAccessibleState(Object component,
                                        Object state)

Sets the content of the component's "state" as rendered by RichRenderUtils.renderRoleState(). It is important to note that this API completly replaces the content of the state. So if there are multiple states (like submenu and selected) then the state parameter must contain all of these states. Otherwise some of your state information may be lost. The element that is used for this replacement is assumed to be a "state" subId of the current component. Like the renderRoleState() function, this function will add whitespace around the state information.

Parameters:
component    
state    
Return:
Object

_setHelpWindowName

private static Object _setHelpWindowName(Object windowName)

Method that will set the help window name. This is implemented as a cookie, with no expiry so that it becomes a session cookie (ie it will be deleted when the session disappears.

Parameters:
windowName    
Return:
Object

setScrollLeft

public static Object setScrollLeft(Object domElement,
                                   Object newScrollLeft)

Set the scrollLeft of the element, making sure that we don't scroll beyond the element's bounds

Parameters:
domElement    
newScrollLeft    
Return:
Object

setScrollTop

public static Object setScrollTop(Object domElement,
                                  Object newScrollTop)

Set the scrollTop of the element, making sure that we don't scroll beyond the element's bounds

Parameters:
domElement    
newScrollTop    
Return:
Object

_setTextAndAccessKeySpan

private static Object _setTextAndAccessKeySpan(Object component,
                                               Object domElement,
                                               Object accessKeyValue,
                                               Object accessKeySpan,
                                               Object newValue)

Called when there is an accessKey property value, but no SPAN to show it in the UI. This function handles either (1) adding the SPAN or (2) just seting the text if the accessKey SPAN style information is not available

Parameters:
component    
domElement    
accessKeyValue    
accessKeySpan    
newValue    
Return:
Object

_setTextContent

private static Object _setTextContent(Object domElement,
                                      Object value)

Parameters:
domElement    
value    
Return:
Object

setVisible

public static Object setVisible(Object domElement,
                                Object visible)

Hides/shows the domElement based on the boolean visible value. The domElement must be non-null.

Parameters:
domElement    
visible    
Return:
Object

stripScripts

public static Object stripScripts(Object domElement)

Once the scripts are loaded they are no longer needed in the dom.

Parameters:
domElement    
Return:
Object

suppressActionLinkBrowserContextMenu

public static Object suppressActionLinkBrowserContextMenu(AdfUIInputEvent componentContextMenuEvent)

Suppresses the browser's native context menu from being shown when the target of a HandleComponentContextMenu event is an action link (no href to load in a new tab/window).

Parameters:
componentContextMenuEvent  -  The component context menu event
Return:
Object

swapIcon

public static Object swapIcon(HTMLElement originalIcon,
                              String iconKey)

This method looks in the lookAndFeel for the iconKey to get the new icon, and then it swaps out the original icon's dom and swaps in the new icon's dom. Call this method from component's mouseover or mouseout event. It does not work well with mousedown events -- it causes the mouseclick event to get lost.

Parameters:
originalIcon  -  the original icon dom element that you want swapped out. The originalIcon must have a parent node in order to be replaced.
iconKey  -  Key used to identify this icon
Return:
Object

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

 

Generated on 2014.03.27 12:59 UTC
Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.