# JavaScript API Reference for Oracle ADF Faces

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Fusion Middleware Javascript API Reference for Oracle ADF Faces 12c (12.2.1.4.0) E81451-01
PREV NEXT | FRAMES NO FRAMES Warning: private items are visible |

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

# oracle.adf.view.js.base
Class AdfUIPeer

    org.ecmascript.object.Object
       |
       +--oracle.adf.view.js.base.AdfObject
             |
             +--oracle.adf.view.js.base.AdfUIPeer

Direct Known Subclasses:
  AdfRichUIPeer

    public class AdfUIPeer
    extends AdfObject

Base class for peer object mapping native implementations to the component model. THis class contains all of the generic peer apis regardless of rendering model.

## Field Summary
`private static Object` | `_DRAG_RECOGNIZER`

### Fields inherited from oracle.adf.view.js.base.AdfObject
`constructor, superclass`

### Fields inherited from org.ecmascript.object.Object
`prototype`

## Constructor Summary
`public` | `AdfUIPeer()` Base class for peer object mapping native implementations to the component model.

## Method Summary
`public Object` | `applyDragReadyState(AdfUIComponent component, AdfUIInputEvent inputEvent)` Called by the framework when the drag is ready to be initiated.
`public Object` | `applyDragSourceState(AdfUIComponent component, AdfDomUIInputEvent inputEvent)` Called by the framework when a drag has been initiated on the component for this peer.
`public Object` | `clearDragReadyState(AdfUIComponent component, Object dragReadyObj)` Called by the framework to clear the drag ready state.
`public Object` | `clearDragSourceState(AdfUIComponent component, Object dragSourceObj)` Called by the framework to clear the drag source state
`protected Object` | `ComponentPropertyChanged(Object propertyChangeEvent)` Called whenever a property changes on the component this peer is attached to.
`public Object` | `componentRemoved(AdfUIComponent component)` Clean up the peer because it's component is being removed.
`public String` | `convertLocatorToClientId(Object component, Object stampKey)` Function to replace client id fragments when converting an absolute locator to clientId.
`public static Object` | `createPeerClass(Function theSuperclass, String peerName, Object classInitializationState)` Factory method for creating a subclass of the specified peer class
`protected Object` | `DispatchComponentEvent(Object componentEvent)` Dispatch a component event to the peer
`protected Object` | `DispatchUncanceledComponentEvent(Object componentEvent)` Called when an event has bubbled all the way to the top without being canceled, but before the AdfComponent's HandleEvent is called.
`public Object` | `focus(Object component)` Ask the peer to move focus to this component
`public String` | `getAbsoluteId(AdfUIComponent component, String clientId)` Implemented by peer to return the absolute scoped id for this component without the leading ":".
`public String` | `getAbsoluteLocator(AdfUIComponent component, String clientId)` Implemented by peer to return the absolute locator, an implementation agnostic String identifier for a given clientId, that is a 'rendered instance-specific' version of the absolute scoped id.
`public AdfUIComponent` | `getComponent()` Returns the AdfUIComponent that this is the peer for.
`public AdfUIComponent` | `getComponentParent(AdfUIComponent component)` Returns the parent component of the specified component.
`public Object` | `getComponentProperty(AdfUIComponent component, String propertyName)` Returns the value of the property for the component, or `undefined` if the peer does not know how to derive the property
`public AdfDragRecognizer` | `getDefaultDragRecognizer(AdfUIComponent component)` Returns the default AdfDragReconizer to use if the AdfDragSource does not provide its own drag recognition scheme.
`public Array<AdfUIComponent>` | `getDescendantComponents(AdfUIComponent component, Array<AdfUIComponent> children)` Get components descended from this peer's component.
`public Object` | `getDragOverFeedback(AdfUIComponent component, AdfUIInputEvent inputEvent)` Returns the appropriate default drag over feedback for this peer
`public Object` | `getDragTransferable(AdfUIComponent component, AdfUIInputEvent inputEvent)` Returns the appropriate default transferable for this drag location, or `null` if this peer has no default Transferable.
`public String` | `getInlineStyleProperty(Object component, String propName)` returns the style values corresponding to the CSS propertyName.
`public Object` | `getPagePosition(AdfUIComponent component)` Returns the coordinates of the component's upper left corner in Page coordinates.
`public Object` | `getParentPeer()`
`public Object` | `getReadyState(Object component)` Returns whether the content of the component is available are:
`protected Object` | `Init(AdfUIComponent component)` Initializes the peer
`protected static Object` | `InitClass()`
`public Object` | `initialize(AdfUIComponent component)` Initializes a peer instance about to be returned by AdfLookAndFeel.getPeer().
`public Object` | `initiateDrag(Object dndContext, Object triggerEvent)` Inform the peer that a drag has been initiated
`public Object` | `isVisible()`
`public Object` | `messageNotify(Object component, Number maxtype, Array messages)` Called to notify the peer that its messages have changed.
`public Object` | `messageShow(Object component, Number maxtype, Array messages)` Called to notify the peer that its messages should be shown.
`public Object` | `needsResizeNotify(Object component)` Tests whether the peer requires resize notification.
`public Boolean` | `processPushData(AdfUIComponent component, Object payload, Boolean isLate)` Called by the Active Data Service to deliver push data to the peer.
`public Object` | `resizeNotify(Object component, Object oldWidth, Object oldHeight, Object newWidth, Object newHeight)` Called to notify the peer of resize activity.
`public Object` | `setInlineStyleProperty(Object component, String propName, String propValue)` Sets the value for a given css style property.
`public Number` | `visitChildren(AdfUIComponent component, Function callback, Object context, Boolean ignoreHidden)` Visits all of the children components of the component.

### Methods inherited from oracle.adf.view.js.base.AdfObject
`adopt, clone, createCallback, createInitializedObject, createSubclass, ensureClassInitialization, equals, exportPrototypeSymbol, getClass, GetLazyArrayProperty, GetLazyMapProperty, getTypeName, toDebugString, toString`

## Field Detail

### _DRAG_RECOGNIZER

`private static Object _DRAG_RECOGNIZER`

## Constructor Detail

### AdfUIPeer

`public AdfUIPeer()`
  Base class for peer object mapping native implementations to the component model. THis class contains all of the generic peer apis regardless of rendering model.

## Method Detail

### applyDragReadyState

`public Object applyDragReadyState(AdfUIComponent component,
AdfUIInputEvent inputEvent)`
  Called by the framework when the drag is ready to be initiated. This method should display a change in the UI to indicate to the user that it is now possible to initiate a drag operation on the target of the event. This method is used in instances where a gesture must be executed before an item may be dragged.
  Parameters:

    `component` | - | the component for this peer
    `inputEvent` | - | the event that triggered the drag

  Return:
    `Object` - An object that will be passed back to the drag source in order to clear the drag ready state
  See also:
    `AdfDragSource.applyDragReadyState(AdfUIInputEvent)`

### applyDragSourceState

`public Object applyDragSourceState(AdfUIComponent component,
AdfDomUIInputEvent inputEvent)`
  Called by the framework when a drag has been initiated on the component for this peer. This method should display a change in the UI to indicate to the user what node is being dragged.
  Parameters:

    `component` | - | the component for this peer
    `inputEvent` | - | the event that triggered the drag

  Return:
    `Object` - An object that will be passed back to the clear method
  See also:
    `AdfDragSource.applyDragSourceState(AdfDomUIInputEvent)`

### clearDragReadyState

`public Object clearDragReadyState(AdfUIComponent component,
Object dragReadyObj)`
  Called by the framework to clear the drag ready state.
  Parameters:

    `component` | - | the component for this peer
    `dragReadyObj` | - | the object returned from the apply method

  Return:
    `Object`
  See also:
    `AdfDragSource.clearDragReadyState(Object)`
    `applyDragReadyState(AdfUIComponent, AdfUIInputEvent)`

### clearDragSourceState

`public Object clearDragSourceState(AdfUIComponent component,
Object dragSourceObj)`
  Called by the framework to clear the drag source state
  Parameters:

    `component` | - | the component for this peer
    `dragSourceObj` | - | the object returned from the apply method

  Return:
    `Object`
  See also:
    `AdfDragSource.clearDragSourceState(Object)`
    `applyDragSourceState(AdfUIComponent, AdfDomUIInputEvent)`

### ComponentPropertyChanged

`protected Object ComponentPropertyChanged(Object propertyChangeEvent)`
  Called whenever a property changes on the component this peer is attached to. Subclasses should override this method to optimize for updating properties without invalidating the entire peer.
  Parameters:

    `propertyChangeEvent` |  |

  Return:
    `Object`

### componentRemoved

`public Object componentRemoved(AdfUIComponent component)`
  Clean up the peer because it's component is being removed.
  Parameters:

    `component` | - | The UIComponent that is being removed

  Return:
    `Object`
  See also:
    `initialize(AdfUIComponent)`

### convertLocatorToClientId

`public String convertLocatorToClientId(Object component,
Object stampKey)`
  Function to replace client id fragments when converting an absolute locator to clientId.

  The peer is not bound when this method is called

  Peers that need to replace and skip extra fragments when converting from clientIds to absolute locators such as Tables and Regions should override this method to add the index of the fragment to be replaced and skipped.
  Parameters:

    `component` | - | The component for this peer
    `stampKey` | - | the stamp key which need to be replaced

  Return:
    `String` - the client id fragment in the below format clientId + ":" + stamped index of client Id fragment related to stampKey

### createPeerClass

`public static Object createPeerClass(Function theSuperclass,
String peerName,
Object classInitializationState)`
  Factory method for creating a subclass of the specified peer class
  Parameters:

    `theSuperclass` | - | constructor of superclass
    `peerName` | - | name of constructor to create for this peer
    `classInitializationState` | - | Class initialization parameter to pass to class initializer Default value = undefined

  Return:
    `Object`

### DispatchComponentEvent

`protected Object DispatchComponentEvent(Object componentEvent)`
  Dispatch a component event to the peer
  Parameters:

    `componentEvent` |  |

  Return:
    `Object`

### DispatchUncanceledComponentEvent

`protected Object DispatchUncanceledComponentEvent(Object componentEvent)`
  Called when an event has bubbled all the way to the top without being canceled, but before the AdfComponent's HandleEvent is called. The peer can return `true` to postpone calling HandleEvent rather than simply canceling the event. In this case, it becomes the peer's responsibility to call HandleEvent, if desired, at some future point in time.
  Parameters:

    `componentEvent` | - | componentEvent that is about to be dispatched

  Return:
    `Object` - null `true` if the event should be postponed

### focus

`public Object focus(Object component)`
  Ask the peer to move focus to this component
  Parameters:

    `component` |  |

  Return:
    `Object`

### getAbsoluteId

`public String getAbsoluteId(AdfUIComponent component,
String clientId)`
  Implemented by peer to return the absolute scoped id for this component without the leading ":". The result of this call may be passed either directly to `AdfPage.findComponentByAbsoluteId` or by prepending a ":", to `AdfUIComponent.findComponent` on any AdfUIComponent instance. to find this component instance as long as the component instance isn't stamped.
  Parameters:

    `component` | - | The component for which absolute id need to be retrieved.
    `clientId` | - | the implementation-specific client id of the component

  Return:
    `String` - The absolute scoped id for the component
  See also:
    `AdfUIComponent.getAbsoluteId()`
    `AdfUIComponent.findComponent(String, Boolean)`
    `AdfPage.findComponentByAbsoluteId(String)`

### getAbsoluteLocator

`public String getAbsoluteLocator(AdfUIComponent component,
String clientId)`
  Implemented by peer to return the absolute locator, an implementation agnostic String identifier for a given clientId, that is a 'rendered instance-specific' version of the absolute scoped id. Provided primarily for test automation users. For most components, absoluteLocator will be same as absoluteId, except in the case of stamping components like table.
  Parameters:

    `component` | - | The component for which absolute locator need to be retrieved.
    `clientId` | - | the implementation-specific client id of the component

  Return:
    `String` - The absolute locator for the component
  See also:
    `AdfUIComponent.getAbsoluteId()`
    `AdfPage.findComponentByAbsoluteLocator(String)`

### getComponent

`public AdfUIComponent getComponent()`
  Returns the AdfUIComponent that this is the peer for.
  Return:
    `AdfUIComponent` - The associated component

### getComponentParent

`public AdfUIComponent getComponentParent(AdfUIComponent component)`
  Returns the parent component of the specified component. By delegating to the peer, we allow subclasses to implement sparse component schemes.
  Parameters:

    `component` | - | Component to determine the parent component of.

  Return:
    `AdfUIComponent` - The parent component, if any.

### getComponentProperty

`public Object getComponentProperty(AdfUIComponent component,
String propertyName)`
  Returns the value of the property for the component, or `undefined` if the peer does not know how to derive the property
  Parameters:

    `component` | - | Component to retrieve the property for
    `propertyName` | - | Name of component property to retrieve the value of

  Return:
    `Object` - Value of the property

### getDefaultDragRecognizer

`public AdfDragRecognizer getDefaultDragRecognizer(AdfUIComponent component)`

  Returns the default AdfDragReconizer to use if the AdfDragSource does not provide its own drag recognition scheme.

  The default implementation will start a drag anywhere in the component. Override with a different AdfDragRecognizer strategy if the peer wants to restrict the portion of the component that can initiate drags.

  Parameters:

    `component` | - | the component for this peer

  Return:
    `AdfDragRecognizer` - The default drag recognizer to use

### getDescendantComponents

`public Array<AdfUIComponent> getDescendantComponents(AdfUIComponent component,
Array<AdfUIComponent> children)`
  Get components descended from this peer's component. This method should only be called if this component returns a value from AdfRichUIPeer.getDomElementForComponent(rootComponent); This base implementation can be overwritten in child peers to handle special cases (popups and overflow).

  There is no guarantee about the order of the children returned. If visiting the children in a known order is required please use AdfUIComponent.visitChildren.

  All descendent children are returned, visible or not. If ignoring hidden children is required please use AdfUIComponent.visitChildren.

  This method is faster than AdfUIComponent.visitChildren, if the limitations above are acceptable it is preferable to use this method.

  Returns an array of descendant (child) components for this component.
  Parameters:

    `component` | - | this component
    `children` | - | array to store child components in. Descendent components will be added to the end of the array. This param is optional, if not passed in an array will be created.

  Return:
    `Array<AdfUIComponent>` - array of child components, may be empty

### getDragOverFeedback

`public Object getDragOverFeedback(AdfUIComponent component,
AdfUIInputEvent inputEvent)`
  Returns the appropriate default drag over feedback for this peer
  Parameters:

    `component` | - | the component for this peer
    `inputEvent` | - | the inputEvent that triggered the drag

  Return:
    `Object` - Appropriate feedback object. For HTML, this is an HTML Node

### getDragTransferable

`public Object getDragTransferable(AdfUIComponent component,
AdfUIInputEvent inputEvent)`
  Returns the appropriate default transferable for this drag location, or `null` if this peer has no default Transferable.
  Parameters:

    `component` | - | the component for this peer
    `inputEvent` | - | the inputEvent that triggered the drag

  Return:
    `Object` - null (AdfTransferable} Default transferable object, or `null` if no default transferable

### getInlineStyleProperty

`public String getInlineStyleProperty(Object component,
String propName)`
  returns the style values corresponding to the CSS propertyName.

  The supplied parameter (propName) value should conform to CSS format and should be in lower case. for example, the method call to get the background color would be `getInlineStyleProperty('background-color')`. Note that 'backgroundColor' (DOM property) should not be passed as property name.

  Parameters:

    `component` |  |
    `propName` | - | The name of the css property to set

  Return:
    `String` - Returns the value corresponding to the CSS property

### getPagePosition

`public Object getPagePosition(AdfUIComponent component)`
  Returns the coordinates of the component's upper left corner in Page coordinates.
  Parameters:

    `component` | - | the component for this peer

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

### getParentPeer

`public Object getParentPeer()`
  Return:
    `Object`

### getReadyState

`public Object getReadyState(Object component)`
  Returns whether the content of the component is available are:
  - `AdfUIComponent.STATE_LOADING` The UIComponent is still loading state or content
  - `AdfUIComponent.STATE_COMPLETE` The UIComponent is fully loaded
  Parameters:

    `component` |  |

  Return:
    `Object`

### Init

`protected Object Init(AdfUIComponent component)`
  Initializes the peer
  Parameters:

    `component` | - | Component to associate with this peer

  Return:
    `Object`
  Overrides:
    `AdfObject.Init()`

### InitClass

`protected static Object InitClass()`
  Return:
    `Object`

### initialize

`public Object initialize(AdfUIComponent component)`
  Initializes a peer instance about to be returned by AdfLookAndFeel.getPeer(). Non-framework code should never need to call this method
  Parameters:

    `component` | - | to associate with this peer instance

  Return:
    `Object`
  See also:
    `componentRemoved(AdfUIComponent)`

### initiateDrag

`public Object initiateDrag(Object dndContext,
Object triggerEvent)`
  Inform the peer that a drag has been initiated
  Parameters:

    `dndContext` |  |
    `triggerEvent` |  |

  Return:
    `Object`

### isVisible

`public Object isVisible()`
  Return:
    `Object`

### messageNotify

`public Object messageNotify(Object component,
Number maxtype,
Array messages)`
  Called to notify the peer that its messages have changed. The messages provided will be an array of FacesMessage or AdfFacesMessage objects. If this array is `null` then all the messages have been cleared from this component.
  Parameters:

    `component` | - | the component that these messages are for
    `maxtype` | - | the maximum message type. Starts with INFO and works it's way up. The message type constants are defined in AdfFacesMessage object and may be retrieved from any javascript faces message by running AdfFacesMessage.getTypeFromMessage();
    `messages` | - | the messages for this component

  Return:
    `Object`

### messageShow

`public Object messageShow(Object component,
Number maxtype,
Array messages)`
  Called to notify the peer that its messages should be shown. The messages provided will be an array of FacesMessage or AdfFacesMessage objects. If this array is `null` then all the messages have been cleared from this component.
  Parameters:

    `component` | - | the component that these messages are for
    `maxtype` | - | the maximum message type. Starts with INFO and works it's way up. The message type constants are defined in AdfFacesMessage object and may be retrieved from any javascript faces message by running AdfFacesMessage.getTypeFromMessage();
    `messages` | - | the messages for this component

  Return:
    `Object`

### needsResizeNotify

`public Object needsResizeNotify(Object component)`
  Tests whether the peer requires resize notification. Peers which perform geometry management should override this to return true. When true, resizeNotify() will be called when browser window is resized.
  Parameters:

    `component` |  |

  Return:
    `Object`

### processPushData

`public Boolean processPushData(AdfUIComponent component,
Object payload,
Boolean isLate)`
  Called by the Active Data Service to deliver push data to the peer.
  Parameters:

    `component` | - | Component to associate with this peer
    `payload` | - | Peer-specific payload for the component
    `isLate` | - | True if the data is later than it is supposed to be

  Return:
    `Boolean` - Returns `true` if the component should continue to receive active data events.

### resizeNotify

`public Object resizeNotify(Object component,
Object oldWidth,
Object oldHeight,
Object newWidth,
Object newHeight)`
  Called to notify the peer of resize activity. Only called if peer overrides needsResizeNotify() to return true.
  Parameters:

    `component` |  |
    `oldWidth` |  |
    `oldHeight` |  |
    `newWidth` |  |
    `newHeight` |  |

  Return:
    `Object`

### setInlineStyleProperty

`public Object setInlineStyleProperty(Object component,
String propName,
String propValue)`
  Sets the value for a given css style property.

  The supplied parameter (propName) value should conform to CSS format and should be in lower case. for example, the method call to set the background color to blue would be `setInlineStyleProperty('background-color','blue')`. Note that 'backgroundColor' (DOM property) should not be passed as property name.

  The property value set via `setInlineStyleProperty` will not be synchronized with the server-side property.

  Parameters:

    `component` |  |
    `propName` | - | The name of the css property to set
    `propValue` | - | The value for this css property

  Return:
    `Object`

### visitChildren

`public Number visitChildren(AdfUIComponent component,
Function callback,
Object context,
Boolean ignoreHidden)`
  Visits all of the children components of the component. A callback function will be invoked with one argument - a component - and must return one of three values. If it returns the number zero (or false), iteration will continue. If it returns the number one (or true), iteration will not continue into the children. If it returns the number two, iteration will entirely halt. Iteration proceeds depth first, but calling the parents before the children
  Parameters:

    `component` | - | the component for this peer
    `callback` | - | a function that will be called on each child
    `context` | - | an object that will be set as "this" when the callback is invoked; can be null if no context is required.
    `ignoreHidden` | - | if true, hidden DOM nodes will be skipped

  Return:
    `Number` - null

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

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Fusion Middleware Javascript API Reference for Oracle ADF Faces 12c (12.2.1.4.0) E81451-01
PREV NEXT | FRAMES NO FRAMES Warning: private items are visible |

Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.