AdfUIPeer.createPeerClass(AdfUIPeer, "AdfRichUIPeer");
AdfRichUIPeer.createPeerClass = function(theSuperclass, peerName, stateless, peerInitialization) {
  AdfAssert.assertFunction(theSuperclass);
  AdfAssert.assertString(peerName);
  AdfAssert.assertBooleanOrNull(stateless);
  AdfAssert.assertObjectOrNull(peerInitialization);
  var theClass = AdfUIPeer.createPeerClass(theSuperclass, peerName, peerInitialization);
  var isSuperClassStateless = theSuperclass.STATELESS;
  if (!isSuperClassStateless) {
    isSuperClassStateless = true;
  }
  if (stateless == null) {
    stateless = isSuperClassStateless;
  } else {
    AdfAssert.assert(!stateless || isSuperClassStateless, "Can't create a stateless subclass of a stateful superclass");
  }
  theClass.InitClass = AdfRichUIPeer.DefaultInitClass;
  theClass.STATELESS = stateless !== false;
  return theClass;
};
var innerClassAdaptorName = "";
AdfRichUIPeer.createInnerPeerClassWithSubId = function(theSuperclass, peerName, subId) {
  innerClassAdaptorName = peerName + "Shim";
  var adapterClass = AdfRichUIPeer.createPeerClass(theSuperclass, innerClassAdaptorName, false);
  var innerClass = AdfRichUIPeer.createPeerClass(adapterClass, peerName, false);
  var initFunc = function anonymous(c, o) {
    AdfRichUIPeer._innerInit.call(this, window[innerClassAdaptorName], c, o);
  };
  adapterClass.prototype._subId = subId;
  adapterClass.prototype.Init = initFunc;
  adapterClass.prototype.initialize = AdfRichUIPeer._innerSubIdInitialize;
  return innerClass;
};
AdfRichUIPeer._innerSubIdInitialize = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  var outerId = component.getClientId();
  var innerId = AdfRichUIPeer.CreateSubId(outerId, this._subId);
  var domNode = AdfAgent.AGENT.getElementById(innerId);
  AdfAssert.assertDomNode(domNode);
  AdfAssert.assert(!this.constructor.STATELESS);
  this.InitDomElement(component, domNode);
  this.BindToComponent(component, domNode);
};
AdfRichUIPeer._innerInit = function(clazz, component, outerThis) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assertPrototype(outerThis, AdfRichUIPeer);
  this.outerThis = outerThis;
  clazz.superclass.Init.call(this, component);
};
AdfRichUIPeer.isComponentContainedByElement = function(component, element) {
  if (component && element) {
    var compNode = AdfRichUIPeer.getDomNodeForComponent(component);
    return AdfDomUtils.isAncestorOrSelf(element, compNode);
  }
  return false;
};
AdfRichUIPeer.prototype.getDomDocument = function() {
  return AdfPage.PAGE.getDomDocument();
};
AdfRichUIPeer.prototype.getComponentParent = function(component) {
  this.bind(component);
  var parent = AdfRichUIPeer.getFirstAncestorComponent(this.getDomNode().parentNode);
  if (parent) {
    var ourClientId = component.getClientId();
    var nmSeparator = ourClientId.lastIndexOf(":");
    if (nmSeparator != -1) {
      var namingContainerId = ourClientId.substring(0, nmSeparator);
      if (!AdfAgent.AGENT.getElementById(namingContainerId)) {
        var namingContainer = AdfPage.PAGE.findComponent(namingContainerId);
        if (namingContainer) {
          var ncParent = namingContainer.getParent();
          while (ncParent) {
            if (ncParent === parent) {
              parent = namingContainer;
              break;
            }
            ncParent = ncParent.getParent();
          }
        }
      }
    }
  }
  return parent;
};
AdfRichUIPeer.prototype._truncateClientId = function(component, descendantComponent, childClientId, skipArray) {
  this.TruncateClientId(component, descendantComponent, childClientId, skipArray);
  var parentComponent = this.getComponentParent(component);
  if (parentComponent != null) {
    parentComponent.getPeer()._truncateClientId(parentComponent, descendantComponent, childClientId, skipArray);
  }
};
AdfRichUIPeer.prototype.TruncateClientId = function(component, descendantComponent, childClientId, skipArray) {
};
AdfRichUIPeer.TruncateClientIdOnceImpl = function(component, descendantComponent, childClientId, skipArray) {
  var clientId = component.getClientId();
  var clientIdDepth = AdfStrings.count(clientId, ":");
  skipArray.push(clientIdDepth + 1);
};
AdfRichUIPeer.prototype.getAbsoluteId = function(component, clientId) {
  var skipArray = [];
  this._truncateClientId(component, component, clientId, skipArray);
  var removeCount = skipArray.length;
  if (removeCount > 0) {
    var clientIdFragments = clientId.split(":");
    var clientIdFragmentCount = clientIdFragments.length;
    if (clientIdFragmentCount == 1) {
      return clientId;
    }
    var absoluteIdFragments = new Array(clientIdFragmentCount - removeCount);
    var absoluteIdIndex = 0;
    var skipArrayIndex = removeCount - 1;
    var currSkipIndex = skipArray[skipArrayIndex];
    for (var clientIdIndex = 0;clientIdIndex < clientIdFragmentCount;clientIdIndex++) {
      if (clientIdIndex != currSkipIndex) {
        absoluteIdFragments[absoluteIdIndex++] = clientIdFragments[clientIdIndex];
      } else {
        currSkipIndex = skipArrayIndex > 0 ? skipArray[--skipArrayIndex] : -1;
      }
    }
    return absoluteIdFragments.join(":");
  } else {
    return clientId;
  }
};
AdfRichUIPeer.prototype.getAbsoluteLocator = function(component, clientId) {
  var absoluteLocator;
  var replaceArray = [];
  this._fixClientId(component, component, clientId, replaceArray);
  var replaceCount = replaceArray.length;
  if (replaceCount > 0) {
    var clientIdFragments = clientId.split(":");
    var clientIdFragmentCount = clientIdFragments.length;
    if (replaceCount > clientIdFragmentCount) {
      return clientId;
    }
    var absoluteLocatorFragments = new Array(clientIdFragmentCount - replaceCount);
    var absoluteIdIndex = 0;
    var replaceArrayIndex = replaceCount - 1;
    var currReplaceIndex = replaceArray[replaceArrayIndex][0];
    for (var clientIdIndex = 0;clientIdIndex < clientIdFragmentCount;clientIdIndex++) {
      if (clientIdIndex == currReplaceIndex) {
        var itemValue = replaceArray[replaceArrayIndex][1];
        if (itemValue != null) {
          var parentIndex = absoluteIdIndex > 0 ? absoluteIdIndex - 1 : 0;
          absoluteLocatorFragments[parentIndex] = absoluteLocatorFragments[parentIndex] + "[" + replaceArray[replaceArrayIndex][1] + "]";
        }
        currReplaceIndex = replaceArrayIndex > 0 ? replaceArray[--replaceArrayIndex][0] : -1;
      } else {
        absoluteLocatorFragments[absoluteIdIndex++] = clientIdFragments[clientIdIndex];
      }
    }
    absoluteLocator = absoluteLocatorFragments.join(":");
  } else {
    absoluteLocator = clientId;
  }
  if (window.AdfDhtmlIteratorPeer) {
    absoluteLocator = AdfDhtmlIteratorPeer.fixupIteratorAbsoluteLocator(absoluteLocator, component);
  }
  return absoluteLocator;
};
AdfRichUIPeer.prototype.convertLocatorToClientId = function(component, stampKey) {
  AdfAssert.assert(false, "Incorrect use of [] locator notation for component :" + component);
};
AdfRichUIPeer.getLocatorByDomElement = function(domElement, component) {
  AdfAssert.assertDomElement(domElement);
  var thePage = AdfPage.PAGE;
  var calledWithComponent = component != null;
  var idStartIndex;
  var id;
  var clientId;
  if (!calledWithComponent) {
    for (var element = domElement;element && (!component || component.getProperty("nested"));element = element.parentNode) {
      clientId = element.id;
      if (component && component.getProperty("nested")) {
        component = component.getParent();
      } else {
        if (clientId) {
          idStartIndex = clientId.lastIndexOf(":");
          id = clientId.substr(idStartIndex + 1);
          if (id.indexOf(AdfRichUIPeer._FILTER_PREFIX) == 0) {
            idStartIndex++;
            clientId = clientId.substr(0, idStartIndex) + clientId.substr(idStartIndex + AdfRichUIPeer._FILTER_PREFIX.length);
          }
          component = thePage.findComponent(clientId);
        }
      }
    }
  }
  if (component) {
    var peer = component.getPeer();
    if (peer) {
      peer.bind(component);
      var bestMatchSubId = peer.GetBestMatchSubId(domElement);
      var absoluteLocator = component.getAbsoluteLocator();
      if (bestMatchSubId) {
        return absoluteLocator + "#" + bestMatchSubId;
      } else {
        var absoluteLocatorForParentComponent;
        clientId = domElement.id;
        idStartIndex = clientId.lastIndexOf(":");
        if (idStartIndex > 0) {
          clientId = clientId.substr(0, idStartIndex);
          component = thePage.findComponent(clientId);
          if (component && !calledWithComponent) {
            absoluteLocatorForParentComponent = AdfRichUIPeer.getLocatorByDomElement(domElement, component);
          }
          if (absoluteLocatorForParentComponent != null && absoluteLocatorForParentComponent.indexOf("#") > 0) {
            return absoluteLocatorForParentComponent;
          }
        }
        return absoluteLocator;
      }
    }
  }
  return null;
};
AdfRichUIPeer.prototype.GetBestMatchSubId = function(domElement) {
  if (this.GetSubIdDomElement == AdfRichUIPeer.prototype.GetSubIdDomElement) {
    return null;
  } else {
    AdfAssert.failedInAbstractFunction();
  }
};
AdfRichUIPeer.prototype._fixClientId = function(component, childComponent, descComponentClientId, replaceArray) {
  this.ConvertClientIdToLocator(component, childComponent, descComponentClientId, replaceArray);
  var parentComponent = this.getComponentParent(component);
  if (parentComponent != null) {
    parentComponent.getPeer()._fixClientId(parentComponent, component, descComponentClientId, replaceArray);
  }
};
AdfRichUIPeer.prototype.ConvertClientIdToLocator = function(component, childComponent, descComponentClientId, replaceArray) {
};
AdfRichUIPeer.prototype.getDescendantComponents = function(component, children) {
  var node;
  if (component instanceof AdfRichPopup) {
    node = AdfDhtmlPopupPeer.getContentDom(component);
  } else {
    node = AdfRichUIPeer.getDomElementForComponent(component);
  }
  AdfAssert.assertDomElement(node);
  return AdfAgent.AGENT.getDescendantComponentsForNode(node, children);
};
AdfRichUIPeer.prototype.getComponentProperty = function(component, propertyName) {
  var getterFunc = this.constructor["_componentPropertyGetters"][propertyName];
  if (getterFunc) {
    this.bind(component);
    return getterFunc.call(this, component, this.getDomElement());
  }
};
AdfRichUIPeer.prototype.getReadyState = function(component) {
  this.bind(component);
  return this.GetReadyState();
};
AdfRichUIPeer.prototype.GetReadyState = function() {
  if (this.getComponent()._xhrInProgress) {
    return AdfUIComponent.STATE_LOADING;
  }
  return AdfUIComponent.STATE_COMPLETE;
};
AdfRichUIPeer.prototype.getInlineEditor = function(component, event) {
  this.bind(component);
  return this.GetInlineEditor(event);
};
AdfRichUIPeer.prototype.GetInlineEditor = function(event) {
  return null;
};
AdfRichUIPeer.prototype.getDragTransferable = function(component, inputEvent) {
  this.bind(component);
  return this.GetDragTransferable(inputEvent);
};
AdfRichUIPeer.prototype.GetDragTransferable = function(inputEvent) {
  return null;
};
AdfRichUIPeer.prototype.getDragOverFeedback = function(component, inputEvent) {
  this.bind(component);
  return this.GetDragOverFeedback(inputEvent);
};
AdfRichUIPeer.prototype.GetDragOverFeedback = function(inputEvent) {
  return AdfRichUIPeer.CreateDraggableNode(this.getDomElement());
};
AdfRichUIPeer.prototype.applyDragReadyState = function(component, inputEvent) {
  this.bind(component);
  return this.ApplyDragReadyState(inputEvent);
};
AdfRichUIPeer.prototype.clearDragReadyState = function(component, dragReadyObj) {
  this.bind(component);
  this.ClearDragReadyState(dragReadyObj);
};
AdfRichUIPeer.prototype.applyDragSourceState = function(component, inputEvent) {
  this.bind(component);
  return this.ApplyDragSourceState(inputEvent);
};
AdfRichUIPeer.prototype.clearDragSourceState = function(component, dragSourceObj) {
  this.bind(component);
  this.ClearDragSourceState(dragSourceObj);
};
AdfRichUIPeer.prototype.ApplyDragReadyState = function(inputEvent) {
  var elem = this.getDomContentElement();
  AdfDomUtils.addCSSClassName(elem, AdfRichUIPeer.DRAG_READY_STYLECLASS);
  return elem;
};
AdfRichUIPeer.prototype.ClearDragReadyState = function(dragReadyObj) {
  AdfAssert.assertDomElement(dragReadyObj);
  AdfDomUtils.removeCSSClassName(dragReadyObj, AdfRichUIPeer.DRAG_READY_STYLECLASS);
};
AdfRichUIPeer.prototype.ApplyDragSourceState = function(inputEvent) {
  var elem = this.getDomContentElement();
  AdfDomUtils.addCSSClassName(elem, AdfRichUIPeer.DRAG_SOURCE_STYLECLASS);
  return elem;
};
AdfRichUIPeer.prototype.ClearDragSourceState = function(dragSourceObj) {
  AdfAssert.assertDomElement(dragSourceObj);
  AdfDomUtils.removeCSSClassName(dragSourceObj, AdfRichUIPeer.DRAG_SOURCE_STYLECLASS);
};
AdfRichUIPeer.CreateDraggableNode = function(domNode) {
  return AdfAgent.AGENT.createDraggableNode(domNode);
};
AdfRichUIPeer.prototype.replaceDomElement = function(component, newElement, oldElement) {
  this.bind(component);
  this.ReplaceDomElement(newElement, oldElement);
};
AdfRichUIPeer.prototype.ReplaceDomElement = function(newElement, oldElement) {
  AdfPage.PAGE.__replaceDomElement(newElement, oldElement);
};
AdfRichUIPeer.prototype.domReplaceNotify = function(component, domNode) {
  this.bind(component);
  return this.DomReplaceNotify(domNode);
};
AdfRichUIPeer.prototype.DomReplaceNotify = function(domNode) {
  return domNode;
};
AdfRichUIPeer.createSubId = function(clientId, name) {
  var subIdArray = AdfRichUIPeer._CREATE_SUB_ID_ARRAY;
  subIdArray[0] = clientId;
  subIdArray[2] = name;
  return subIdArray.join("");
};
AdfRichUIPeer.CreateSubId = AdfRichUIPeer.createSubId;
AdfRichUIPeer._sliceArgumentsArray = function(theArguments, startIndex) {
  var argCount = theArguments.length;
  var arrayLength = argCount - startIndex;
  if (arrayLength > 0) {
    var outArray = new Array(arrayLength);
    var inIndex = startIndex;
    for (var outIndex = 0;outIndex < arrayLength;inIndex++, outIndex++) {
      outArray[outIndex] = theArguments[inIndex];
    }
    return outArray;
  } else {
    return null;
  }
};
AdfRichUIPeer.addSuppressedPPRAttributes = function(theClass, propertyNames) {
  AdfRichUIPeer._addSuppressedPPRAttributes(theClass, AdfRichUIPeer._sliceArgumentsArray(arguments, 1));
};
AdfRichUIPeer._addSuppressedPPRAttributes = function(theClass, propertyNames) {
  AdfAssert.assertFunction(theClass);
  var pprSuppressedProperties = theClass._pprSuppressedProperties;
  if (pprSuppressedProperties == null) {
    pprSuppressedProperties = new Object;
    theClass._pprSuppressedProperties = pprSuppressedProperties;
    if (theClass != AdfRichUIPeer) {
      var superClassProperties = theClass.superclass.constructor._pprSuppressedProperties;
      for (var currProperty in superClassProperties) {
        pprSuppressedProperties[currProperty] = true;
      }
    }
  }
  if (propertyNames) {
    var propertyCount = propertyNames.length;
    for (var i = 0;i < propertyCount;i++) {
      var currArg = propertyNames[i];
      AdfAssert.assertString(currArg);
      pprSuppressedProperties[currArg] = true;
    }
  }
};
AdfRichUIPeer.addComponentPropertyGetters = function(theClass, propertyNames) {
  AdfRichUIPeer._addComponentPropertyGetters(theClass, AdfRichUIPeer._sliceArgumentsArray(arguments, 1));
};
AdfRichUIPeer._addComponentPropertyGetters = function(theClass, propertyNames) {
  AdfRichUIPeer._initializeCallbacks(theClass, "_componentPropertyGetters", AdfRichUIPeer._GET_COMPONENT_FORMAT, null, propertyNames);
};
AdfRichUIPeer.addDomEventHandlers = function(theClass, domEventTypes) {
  AdfRichUIPeer._addDomEventHandlers(theClass, AdfRichUIPeer._sliceArgumentsArray(arguments, 1));
};
AdfRichUIPeer._addDomEventHandlers = function(theClass, domEventTypes) {
  AdfRichUIPeer._initializeCallbacks(theClass, "_domEventHandlers", AdfRichUIPeer._HANDLE_DOM_EVENT_FORMAT, AdfDhtmlLookAndFeel.EVENT_TYPE_TO_CAMEL_CASE_MAP, domEventTypes);
};
AdfRichUIPeer.addComponentEventHandlers = function(theClass, componentEventTypes) {
  AdfRichUIPeer._addComponentEventHandlers(theClass, AdfRichUIPeer._sliceArgumentsArray(arguments, 1));
};
AdfRichUIPeer._addComponentEventHandlers = function(theClass, componentEventTypes) {
  AdfRichUIPeer._initializeCallbacks(theClass, "_componentEventHandlers", AdfRichUIPeer._HANDLE_COMPONENT_EVENT_FORMAT, null, componentEventTypes);
};
AdfRichUIPeer.addComponentPropertyChanges = function(theClass, propertyNames) {
  AdfRichUIPeer._addComponentPropertyChanges(theClass, AdfRichUIPeer._sliceArgumentsArray(arguments, 1));
};
AdfRichUIPeer._addComponentPropertyChanges = function(theClass, propertyNames) {
  AdfRichUIPeer._initializeCallbacks(theClass, "_componentPropertyChanges", AdfRichUIPeer._PROPERTY_CHANGED_FORMAT, null, propertyNames);
};
AdfRichUIPeer._initializeCallbacks = function(theClass, callbackMapPropertyName, callbackFormat, transformationMap, callbackBases) {
  AdfAssert.assertFunction(theClass);
  AdfAssert.assertString(callbackMapPropertyName);
  AdfAssert.assertArray(callbackFormat);
  AdfAssert.assertObjectOrNull(transformationMap);
  AdfAssert.assertArrayOrNull(callbackBases);
  var ourPrototype = theClass.prototype;
  var transformedName;
  var callbackMap = theClass[callbackMapPropertyName];
  if (callbackMap == null) {
    callbackMap = new Object;
    theClass[callbackMapPropertyName] = callbackMap;
    if (theClass != AdfRichUIPeer) {
      var superClassCallbacks = theClass.superclass.constructor[callbackMapPropertyName];
      for (var baseCallbackName in superClassCallbacks) {
        transformedName = transformationMap != null ? transformationMap[baseCallbackName] : baseCallbackName;
        callbackFormat[1] = AdfStrings.initUpperCase(transformedName);
        callbackMap[baseCallbackName] = ourPrototype[callbackFormat.join("")];
      }
    }
  }
  if (callbackBases != null) {
    var callbackCount = callbackBases.length;
    for (var callbackIndex = 0;callbackIndex < callbackCount;callbackIndex++) {
      var baseCallbackName = callbackBases[callbackIndex];
      transformedName = transformationMap != null ? transformationMap[baseCallbackName] : baseCallbackName;
      callbackFormat[1] = AdfStrings.initUpperCase(transformedName);
      var callbackName = callbackFormat.join("");
      var callback = ourPrototype[callbackName];
      if (AdfAssert.DEBUG) {
        AdfAssert.assert(callback, "No callback for:" + callbackName + " on " + AdfObject.getTypeName(theClass));
      }
      callbackMap[baseCallbackName] = callback;
    }
  }
};
AdfRichUIPeer.prototype.ComponentPropertyChanged = function(propertyChangeEvent) {
  var propertyName = propertyChangeEvent.getPropertyName();
  var component = propertyChangeEvent.getSource();
  var ourClass = this.constructor;
  var changeFunc = ourClass["_componentPropertyChanges"][propertyName];
  var handledChange = false;
  if (changeFunc) {
    this.bind(component);
    handledChange = changeFunc.call(this, component, this.getDomElement(), propertyChangeEvent.getNewValue(), propertyChangeEvent.getOldValue());
    if (handledChange === undefined) {
      handledChange = true;
    }
  }
  if (handledChange) {
    AdfPage.PAGE.__queueDescendantResizeNotifySource(component);
  } else {
    if (!(propertyName in ourClass._pprSuppressedProperties)) {
      var propertyKey = component.getPropertyKeys()[propertyName];
      if (propertyKey != null && !propertyKey[AdfUIComponent.PROPERTY_DISCONNECTED]) {
        AdfPage.PAGE.addPartialTargets(component);
      }
    }
  }
};
AdfRichUIPeer.prototype.ComponentVisibleChanged = function(component, domElement, newValue, oldValue) {
  AdfAssert.assertBoolean(newValue);
  var parentHandledChange = false;
  var parentComponent = component.getParent();
  if (parentComponent) {
    var parentPeer = parentComponent.getPeer();
    if (parentPeer && parentPeer.needsChildVisibilityChanges()) {
      parentPeer.bind(parentComponent);
      parentHandledChange = parentPeer.ChildVisibilityChanged(component, domElement, newValue);
    }
  }
  if (!parentHandledChange) {
    AdfDomUtils.setVisible(domElement, newValue);
    if (newValue) {
      AdfPage.PAGE.doResizeNotifyDom(domElement, false);
    }
  }
};
AdfRichUIPeer.prototype.GetComponentVisible = function(component, domElement) {
  return AdfDomUtils.isVisible(domElement);
};
AdfRichUIPeer.prototype.GetComponentId = function(component, domElement) {
  var clientId = component.getClientId();
  var idStartIndex = clientId.lastIndexOf(":");
  return clientId.substr(idStartIndex + 1);
};
AdfRichUIPeer.prototype.ComponentInlineStyleChanged = function(component, domElement, newValue, oldValue) {
  AdfAssert.assertStringOrNull(newValue);
  if (newValue == null) {
    newValue = "";
  }
  var currStyle = domElement.style.cssText;
  if (currStyle != null) {
    if (oldValue == null) {
      if (currStyle[currStyle.length - 1] != ";") {
        currStyle = currStyle + ";";
      }
      newValue = currStyle + newValue;
    } else {
      oldValue = oldValue.replace(/\s*:\s*/g, ":");
      currStyle = currStyle.replace(/\s*:\s*/g, ":");
      if (oldValue.length < currStyle.length) {
        var index = currStyle.indexOf(oldValue);
        if (index == 0) {
          oldValue = currStyle.substring(oldValue.length);
          if (oldValue[oldValue.length - 1] != ";") {
            oldValue = oldValue + ";";
          }
          newValue = oldValue + newValue;
        } else {
          if (index > 0) {
            newValue = currStyle.substring(0, index) + newValue;
          }
        }
      }
    }
  }
  domElement.style.cssText = newValue;
};
AdfRichUIPeer.prototype.ComponentStyleClassChanged = function(component, domElement, newValue, oldValue) {
  AdfAssert.assertStringOrNull(newValue);
  if (oldValue != null) {
    AdfDomUtils.removeCSSClassName(domElement, oldValue);
  }
  AdfDomUtils.addCSSClassName(domElement, newValue);
};
AdfRichUIPeer.prototype.getInlineStyleProperty = function(component, propName) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  var domElement = AdfRichUIPeer.getDomElementForComponent(component);
  var style = domElement.style;
  var domPropertyName = AdfAgent.AGENT.getDomForCSSPropertyName(propName);
  return style[domPropertyName];
};
AdfRichUIPeer.prototype.setInlineStyleProperty = function(component, propName, propValue) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  var domElement = AdfRichUIPeer.getDomElementForComponent(component);
  var style = domElement.style;
  var domPropertyName = AdfAgent.AGENT.getDomForCSSPropertyName(propName);
  style[domPropertyName] = propValue;
};
AdfRichUIPeer.prototype.setBusy = function(component, isBusy) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assertBoolean(isBusy);
  var domElement = AdfRichUIPeer.getDomContentElementForComponent(component);
  if (domElement == null) {
    return;
  }
  if (AdfDomUtils.addOrRemoveCSSClassName(isBusy, domElement, AdfRichUIPeer.BUSY_STYLECLASS)) {
    this.bind(component);
    this.SetBusy(isBusy);
  }
};
AdfRichUIPeer.prototype.SetBusy = function(isBusy) {
  AdfAssert.assertBoolean(isBusy);
};
AdfRichUIPeer.prototype.isBusy = function() {
  return false;
};
AdfRichUIPeer.registerKeyStroke = function(component, keystroke, keyPressedCallback) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assertPrototype(keystroke, AdfKeyStroke);
  AdfAssert.assertFunction(keyPressedCallback);
  AdfPage.PAGE.registerKeyStroke(keystroke, AdfRichUIPeer._keystrokeCallback, {clientId:component.getClientId(), callback:keyPressedCallback});
};
AdfRichUIPeer.unregisterKeyStroke = function(component, keystroke) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assertPrototype(keystroke, AdfKeyStroke);
  AdfPage.PAGE.unregisterKeyStroke(keystroke, component.getClientId());
};
AdfRichUIPeer._keystrokeCallback = function(keystroke) {
  AdfAssert.assertPrototype(keystroke, AdfKeyStroke);
  var peerComponent = AdfPage.PAGE.findComponent(this.clientId);
  if (peerComponent == null) {
    return false;
  }
  var peer = peerComponent.getPeer();
  peer.bind(peerComponent);
  return this.callback.call(peer, keystroke);
};
AdfRichUIPeer.getDomElementForComponent = function(component) {
  AdfAssert.assertObject(component);
  return AdfAgent.AGENT.getElementById(component.getClientId());
};
AdfRichUIPeer.getDomNodeForComponent = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  var domNode = AdfAgent.AGENT.getElementById(component.getClientId());
  if (!domNode) {
    var peer = component.getPeer();
    if (peer) {
      domNode = peer.getDomNode();
    }
    if (!domNode) {
      domNode = AdfRichUIPeer.GetDomNodeForCommentComponent(component);
    }
  }
  AdfAssert.assert(domNode != null, "DOM node for the Id " + component.getClientId() + " is not found. This indicates a serious problem during rendering. " + "Inspect your DOM tree and try to determine why the client component is present, while its DOM node is not");
  return domNode;
};
AdfRichUIPeer.GetDomNodeForCommentComponent = function(component) {
  var parentId = component.getProperty("_parentId");
  var commentString = "compS|" + component.getClientId();
  var startElement = AdfAgent.AGENT.getElementById(parentId);
  if (startElement) {
    var firstChild = startElement.firstChild;
    if (firstChild) {
      return AdfRichUIPeer._getCommentNodeForComponent(firstChild, commentString);
    }
  }
  var theBody = AdfPage.PAGE.getDomDocument().body;
  var commentNode = AdfRichUIPeer._findCommentNodeWithContent(theBody, commentString);
  if (commentNode != null) {
    return commentNode;
  }
  return null;
};
AdfRichUIPeer._findCommentNodeWithContent = function(ancestorNode, commentString) {
  AdfAssert.assertDomNode(ancestorNode);
  var nodeType = ancestorNode.nodeType;
  if (nodeType == 8) {
    if (commentString == ancestorNode.nodeValue) {
      return ancestorNode;
    }
  } else {
    if (nodeType == 1) {
      var children = ancestorNode.childNodes;
      var childCount = children.length;
      var i = 0;
      for (i = 0;i < childCount;i++) {
        var child = children[i];
        var foundCommentNode = AdfRichUIPeer._findCommentNodeWithContent(child, commentString);
        if (foundCommentNode != null) {
          return foundCommentNode;
        }
      }
    }
  }
  return null;
};
AdfRichUIPeer.getDomContentElementForComponent = function(component) {
  var domNode = AdfRichUIPeer.getDomNodeForComponent(component);
  if (domNode == null) {
    return null;
  }
  return this.GetDomContentElementForNode(domNode);
};
AdfRichUIPeer.GetDomContentElementForNode = function(domNode) {
  AdfAssert.assertDomNode(domNode);
  if (domNode.nodeType == 8 || domNode.tagName == "NOSCRIPT") {
    domNode = domNode.nextSibling;
    while (domNode && domNode.nodeType != 1) {
      domNode = domNode.nextSibling;
    }
  }
  AdfAssert.assertDomElement(domNode);
  return domNode;
};
AdfRichUIPeer._getCommentNodeForComponent = function(firstSibling, commentString) {
  var currChild = firstSibling;
  while (currChild) {
    var nodeType = currChild.nodeType;
    if (nodeType == 8) {
      if (commentString == currChild.nodeValue) {
        return currChild;
      }
    } else {
      if (nodeType == 1) {
        var id = currChild.id;
        if (!(id && AdfPage.PAGE.findComponent(id))) {
          var firstChild = currChild.firstChild;
          if (firstChild) {
            var domNode = AdfRichUIPeer._getCommentNodeForComponent(firstChild, commentString);
            if (domNode) {
              return domNode;
            }
          }
        }
      }
    }
    currChild = currChild.nextSibling;
  }
  return null;
};
AdfRichUIPeer.prototype.getDomElement = function() {
  return this._domNode;
};
AdfRichUIPeer.prototype.getDomNode = function() {
  return this._domNode;
};
AdfRichUIPeer.getDomContentElement = function() {
};
AdfRichUIPeer.prototype.getDomContentElement = function() {
  return this._domNode;
};
AdfRichUIPeer.prototype.getDomRootNodes = function(component, domNode) {
  this.bind(component);
  return this.GetDomRootNodes(domNode);
};
AdfRichUIPeer.prototype.GetDomRootNodes = function(domNode) {
  var nodes = [];
  if (domNode != null) {
    nodes.push(domNode);
    if (domNode.nodeType === 1 && domNode.tagName === "NOSCRIPT" && domNode.id) {
      var clientId = domNode.id;
      var endId = clientId + "::end";
      for (var n = domNode.nextSibling;n != null;n = n.nextSibling) {
        nodes.push(n);
        if (n.nodeType == 1 && n.id == endId) {
          break;
        }
      }
    } else {
      if (domNode.nodeType == 8) {
        nodes.push(domNode);
      }
    }
  }
  return nodes;
};
AdfRichUIPeer.prototype.initialize = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfPage.PAGE.mapComponent(component.getClientId(), component);
  var domNode = AdfRichUIPeer.getDomNodeForComponent(component);
  if (domNode) {
    AdfAssert.assertDomNode(domNode);
    this.InitDomElement(component, domNode);
    this._handleClickEvent(component._componentType, domNode);
    if (!this.constructor.STATELESS) {
      this.BindToComponent(component, domNode);
    }
  }
  this._fetchSVGIcon(component);
};
AdfRichUIPeer.prototype._handleClickEvent = function(componentType, domNode) {
  if (!(AdfRichUIPeer._COMPONENTS_WITH_ONLICK_EVENTS.indexOf(componentType) > -1)) {
    return;
  }
  var element;
  if (domNode.hasAttribute("data-action")) {
    element = domNode;
    this._addClickListener(element);
  } else {
    element = domNode.querySelector("[data-action]");
    if (element) {
      this._addClickListener(element);
    }
    this._handleMultipleClickEvent(domNode);
  }
};
AdfRichUIPeer.prototype._handleMultipleClickEvent = function(domNode) {
  var elements = domNode.querySelectorAll("[onclick]");
  if (elements && elements.length > 0) {
    for (var i = 0;i < elements.length;i++) {
      if (elements[i].hasAttribute("onclick")) {
        if (elements[i].getAttribute("onclick").indexOf("submit") > -1) {
          continue;
        }
        elements[i].removeAttribute("onclick");
        elements[i].addEventListener("click", function(event) {
          event.preventDefault();
          this.focus();
        });
      }
    }
  }
};
AdfRichUIPeer.prototype._addClickListener = function(element) {
  element.addEventListener("click", function(event) {
    var listner = element.dataset.action;
    if (listner.indexOf("focus") > -1) {
      this.focus();
    }
    if (listner.indexOf("void(0)") > -1) {
      void 0;
    }
    if (listner.indexOf("true") > -1) {
      return true;
    }
    if (listner.indexOf("false") > -1) {
      event.preventDefault();
    }
  });
};
AdfRichUIPeer.prototype.componentRemoved = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assertDomNode(AdfRichUIPeer.getDomNodeForComponent(component));
  this.cancelAllPopups(component, true);
  this.ComponentRemoved(component);
  if (this._component === component) {
    this.UnbindFromComponent();
  }
  AdfPage.PAGE.unmapComponent(component.getClientId());
};
AdfRichUIPeer.InitClass = function(initializationState) {
  this._PROPERTY_CHANGED_FORMAT = new Array("Component", null, "Changed");
  this._GET_COMPONENT_FORMAT = new Array("GetComponent", null);
  this._HANDLE_DOM_EVENT_FORMAT = new Array("HandleDom", null);
  this._HANDLE_COMPONENT_EVENT_FORMAT = new Array("HandleComponent", null);
  this._CREATE_SUB_ID_ARRAY = new Array(null, "::", null);
  this.addComponentPropertyChanges(this, AdfUIComponent.VISIBLE, AdfUIComponent.INLINE_STYLE, AdfUIComponent.STYLE_CLASS);
  this.addComponentPropertyGetters(this, AdfUIComponent.VISIBLE, AdfUIComponent.ID);
};
AdfRichUIPeer.DefaultInitClass = function(peerInitialization) {
  var propertyChanges = null;
  var propertyGetters = null;
  var eventHandlers = null;
  var domEventHandlers = null;
  var suppressedPPRAttribtutes = null;
  if (peerInitialization) {
    propertyChanges = peerInitialization.propertyChanges;
    propertyGetters = peerInitialization.propertyGetters;
    eventHandlers = peerInitialization.eventHandlers;
    domEventHandlers = peerInitialization.domEventHandlers;
    suppressedPPRAttribtutes = peerInitialization.suppressedPPRAttribtutes;
  }
  AdfRichUIPeer._addComponentPropertyChanges(this, propertyChanges);
  AdfRichUIPeer._addComponentPropertyGetters(this, propertyGetters);
  AdfRichUIPeer._addComponentEventHandlers(this, eventHandlers);
  AdfRichUIPeer._addDomEventHandlers(this, domEventHandlers);
  AdfRichUIPeer._addSuppressedPPRAttributes(this, suppressedPPRAttribtutes);
  var f = this.InitSubclass;
  if (f == null) {
    f = this["InitSubclass"];
  }
  if (f != null) {
    f.call(this, peerInitialization);
  }
};
AdfRichUIPeer.prototype.InitDomElement = function(component, domElement) {
};
AdfRichUIPeer.prototype.ComponentRemoved = function(component) {
};
AdfRichUIPeer.prototype.BindToComponent = function(component, domNode) {
  this._component = component;
  this._domNode = domNode;
};
AdfRichUIPeer.prototype.UnbindFromComponent = function() {
  this._component = null;
  this._domNode = null;
};
AdfRichUIPeer.prototype.bind = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assert(!component.isDead(), "Attempt to bind a dead component");
  if (component !== this._component) {
    if (this.constructor.STATELESS) {
      var domElement = AdfRichUIPeer.getDomElementForComponent(component);
      AdfAssert.assertDomElementOrNull(domElement);
      if (!domElement) {
        AdfAssert.assert(this instanceof AdfDhtmlImplicitPeer);
      }
      this.UnbindFromComponent();
      this.BindToComponent(component, domElement);
    }
  }
};
AdfRichUIPeer.prototype.focus = function(component) {
  this.bind(component);
  this.Focus();
};
AdfRichUIPeer.prototype.Focus = function() {
  var dom = this.getDomContentElement();
  AdfFocusUtils.focusFirstTabStop(dom);
};
AdfRichUIPeer.prototype.processPushData = function(component, payload, changeCount) {
  this.bind(component);
  return this.ProcessPushData(payload, changeCount);
};
AdfRichUIPeer.prototype.ProcessPushData = function(payload, changeCount) {
  var component = this.getComponent();
  var alreadyTwinkled = false;
  for (key in payload) {
    var newValue = payload[key];
    AdfLogger.LOGGER.fine("On ", component, " set ", key, " to ", newValue);
    var oldValue = component.setProperty(key, newValue, false, AdfUIComponent.PROPAGATE_LOCALLY);
    if (!alreadyTwinkled && newValue !== oldValue) {
      alreadyTwinkled = true;
      var domElement = this.getDomElement();
      var twinkleAttrName = AdfRichUIPeer._TWINKLE_TIMER_ID_ATTR;
      var timerId = domElement.getAttribute(twinkleAttrName);
      var thePage = AdfPage.PAGE;
      if (timerId) {
        thePage.rescheduleTimer(timerId, 1E3);
      } else {
        AdfDomUtils.addCSSClassName(domElement, AdfRichUIPeer._TWINKLE_ON_STYLECLASS);
        timerId = thePage.scheduleTimer(null, AdfRichUIPeer._removeTwinkleCallback, domElement.id, 1E3);
        domElement.setAttribute(twinkleAttrName, timerId);
      }
    }
  }
  return true;
};
AdfRichUIPeer.prototype.registerADSAccessibility = function(component) {
  this.bind(component);
  this.RegisterADSAccessibility();
};
AdfRichUIPeer.prototype.RegisterADSAccessibility = function() {
  var component = this.getComponent();
  var element = AdfRichUIPeer.getDomElementForComponent(component);
  var agent = AdfAgent.AGENT;
  if (element && agent.getAttribute(element, "aria-live") == null) {
    agent.setAttribute(element, "aria-live", "polite");
  }
};
AdfRichUIPeer.prototype.getComponent = function() {
  return this._component;
};
AdfRichUIPeer.GetComponent = function(element) {
  AdfAssert.assertDomElement(element);
  var clientId = element.id;
  return clientId ? AdfPage.PAGE.findComponent(clientId) : null;
};
AdfRichUIPeer.getFirstAncestorComponent = function(node) {
  AdfAssert.assertDomNode(node);
  var thePage = AdfPage.PAGE;
  var component;
  while (node) {
    var nodeType = node.nodeType;
    if (nodeType == 1) {
      var componentId = node.id;
      if (componentId) {
        component = thePage.findComponent(componentId);
        if (component) {
          return component;
        }
      }
      var previousNode = node.previousSibling;
      if (previousNode && previousNode.nodeType == 8) {
        component = thePage._getComponentFromComment(previousNode);
        if (component) {
          return component;
        }
      }
      component = AdfRichUIPeer._getPreviousNoScriptComponent(previousNode);
      if (component != null) {
        return component;
      }
    }
    node = node.parentNode;
  }
  return null;
};
AdfRichUIPeer._NOSCRIPT_END_REGEX = /::end$/;
AdfRichUIPeer._getPreviousNoScriptComponent = function(previousNode) {
  var toIgnore = {};
  var page = AdfPage.PAGE;
  for (var sibling = previousNode;sibling != null;sibling = sibling.previousSibling) {
    if (sibling.nodeType == 1 && sibling.tagName == "NOSCRIPT" && sibling.id != null) {
      var id = sibling.id;
      if (AdfRichUIPeer._NOSCRIPT_END_REGEX.test(id)) {
        toIgnore[id] = true;
        continue;
      }
      if (toIgnore[id + "::end"] !== true) {
        component = page.findComponent(id);
        if (component) {
          return component;
        }
      }
    }
  }
  return null;
};
AdfRichUIPeer.prototype.visitChildren = function(component, callback, context, ignoreHidden) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assertFunction(callback);
  AdfAssert.assertObjectOrNull(context);
  var dom = AdfRichUIPeer.getDomElementForComponent(component);
  var returnValue = this._visitChildren(component, dom, callback, context, ignoreHidden);
  if (returnValue != 2) {
    var popups = this.getAllPopups(component);
    if (popups != null) {
      for (var prop in popups) {
        if (popups[prop].getElement) {
          dom = popups[prop].getElement();
          if (dom) {
            returnValue = this._visitChildren(component, dom, callback, context, ignoreHidden);
            if (returnValue == 2) {
              break;
            }
          }
        }
      }
    }
  }
  return returnValue;
};
AdfRichUIPeer.prototype.getPagePosition = function(component) {
  this.bind(component);
  return AdfAgent.AGENT.getElementPosition(this._domNode);
};
AdfRichUIPeer.prototype._visitChildren = function(component, domElement, callback, context, ignoreHidden) {
  var currChild;
  var agent = AdfAgent.AGENT;
  var endElement;
  if (domElement.tagName === "NOSCRIPT") {
    endElement = agent.getElementById(component.getClientId() + "::end");
    currChild = domElement.nextSibling;
  } else {
    currChild = domElement.firstChild;
  }
  var isVisibleFunc = AdfDomUtils.isVisible;
  var isHtmlFunc = agent.isElementHTML;
  var page = AdfPage.PAGE;
  while (currChild && currChild != endElement) {
    if (currChild.nodeType == 1) {
      if (isHtmlFunc(currChild) && (!ignoreHidden || isVisibleFunc(currChild))) {
        var returnValue = 0;
        var childComponent = null;
        var componentId = currChild.id;
        if (componentId) {
          childComponent = page.findComponent(componentId);
        }
        if (childComponent && childComponent != component) {
          returnValue = callback.call(context, childComponent);
          if (!returnValue) {
            returnValue = childComponent.visitChildren(callback, context, ignoreHidden);
          }
        } else {
          returnValue = this._visitChildren(component, currChild, callback, context, ignoreHidden);
        }
        if (returnValue == 2) {
          return 2;
        }
        if (currChild.tagName == "NOSCRIPT") {
          var childEndElement = agent.getElementById(currChild.id + "::end");
          AdfAssert.assertDomElement(childEndElement);
          currChild = childEndElement;
        }
      } else {
        returnValue = this._visitChildren(component, currChild, callback, context, ignoreHidden);
      }
    }
    currChild = currChild.nextSibling;
  }
  return 0;
};
AdfRichUIPeer.prototype._getComponentForVisitingElement = function(element, ignoreHidden) {
  var childComponent = null;
  if (AdfAgent.AGENT.isElementHTML(element) && (!ignoreHidden || AdfDomUtils.isVisible(element))) {
    var componentId = element.id;
    if (componentId) {
      childComponent = AdfPage.PAGE.findComponent(componentId);
    }
  }
  return childComponent;
};
AdfRichUIPeer.prototype._visitChild = function(childComponent, callback, context, ignoreHidden) {
  var returnValue = callback.call(context, childComponent);
  if (!returnValue) {
    returnValue = childComponent.visitChildren(callback, context, ignoreHidden);
  }
  return returnValue;
};
AdfRichUIPeer.prototype.createComponentEvent = function(component, domEvent, prevComponent) {
  this.bind(component);
  return this.CreateComponentEvent(domEvent, prevComponent);
};
AdfRichUIPeer.prototype.CreateComponentEvent = function(domEvent, prevComponent) {
  return AdfAgent.AGENT.getComponentEvent(this.getComponent(), domEvent, prevComponent);
};
AdfRichUIPeer.prototype._dispatchDomEvent = function(agent, component, domEvent) {
  AdfAssert.assertObject(domEvent);
  var eventHandlerFunc = this.constructor["_domEventHandlers"][domEvent.type];
  if (eventHandlerFunc) {
    this.bind(component);
    eventHandlerFunc.call(this, component, domEvent);
  }
};
AdfRichUIPeer.prototype.DispatchComponentEvent = function(componentEvent) {
  var componentEventHandlers = this.constructor["_componentEventHandlers"];
  if (componentEventHandlers) {
    var eventHandlerFunc = componentEventHandlers[componentEvent.getType()];
    if (eventHandlerFunc) {
      var component = componentEvent.getCurrentTarget();
      this.bind(component, AdfRichUIPeer.getDomElementForComponent(component));
      eventHandlerFunc.call(this, componentEvent);
    }
  }
};
AdfRichUIPeer.prototype.DispatchUncanceledComponentEvent = function(componentEvent) {
  return false;
};
AdfRichUIPeer.addEventHandlerToDomInstance = function(theClass, domElement, domEventType) {
  AdfAssert.assertFunction(theClass);
  AdfAssert.assertDomElement(domElement);
  AdfAssert.assertString(domEventType);
  var nativeAttribute = AdfDhtmlLookAndFeel.EVENT_TYPE_TO_ATTRIBUTE_MAP[domEventType];
  AdfAssert.assertString(nativeAttribute);
  AdfRichUIPeer.addDomEventHandlers(theClass, domEventType);
  domElement[nativeAttribute] = AdfRichUIPeer._defaultInstanceEventHandler;
};
AdfRichUIPeer._defaultInstanceEventHandler = function(theEvent) {
  if (theEvent == null) {
    theEvent = AdfPage.PAGE.getDomWindow().event;
  }
  var component = AdfRichUIPeer.getFirstAncestorComponent(this);
  if (component) {
    component.getPeer()._dispatchDomEvent(AdfAgent.AGENT, component, theEvent);
  }
};
AdfRichUIPeer.prototype.isActive = function() {
  return this.getComponent().getClientId() == AdfPage.PAGE.getActiveComponentId();
};
AdfRichUIPeer.prototype.getAccessibleName = function(component) {
  this.bind(component);
  return this.GetAccessibleName();
};
AdfRichUIPeer.prototype.GetAccessibleName = function() {
};
AdfRichUIPeer.prototype.isInActiveHeirarchy = function() {
  var activeId = AdfPage.PAGE.getActiveComponentId();
  if (activeId != null) {
    var activeComponent = AdfPage.PAGE.findComponent(activeId);
    var component = this.getComponent();
    do {
      if (component == activeComponent) {
        return true;
      }
      activeComponent = activeComponent.getParent();
    } while (activeComponent != null);
  }
  return false;
};
AdfRichUIPeer.prototype.needsFocusTargetStyleClass = function() {
  return false;
};
AdfRichUIPeer.prototype.needsChildVisibilityChanges = function(component) {
  return false;
};
AdfRichUIPeer.prototype.ChildVisibilityChanged = function(childComponent, childDomElement, childVisible) {
  return false;
};
AdfRichUIPeer.prototype.resizeNotify = function(component, oldWidth, oldHeight, newWidth, newHeight) {
  this.bind(component);
  this.ResizeNotify(oldWidth, oldHeight, newWidth, newHeight);
};
AdfRichUIPeer.prototype.ResizeNotify = function(oldWidth, oldHeight, newWidth, newHeight) {
};
AdfRichUIPeer.prototype.descendantMessageChanged = function(component) {
  this.bind(component);
  this.DescendantMessageChanged();
};
AdfRichUIPeer.prototype.messageNotify = function(component, maxType, messages) {
  AdfAssert.assertNumberOrNull(maxType);
  AdfAssert.assertArrayOrNull(messages);
  this.bind(component);
  this.MessageNotify(maxType, messages);
};
AdfRichUIPeer.prototype.messageShow = function(component, maxType, messages) {
  AdfAssert.assertNumberOrNull(maxType);
  AdfAssert.assertArrayOrNull(messages);
  this.bind(component);
  this.MessageShow(maxType, messages);
};
AdfRichUIPeer.prototype.DescendantMessageChanged = function() {
};
AdfRichUIPeer.prototype.MessageNotify = function(maxType, messages) {
  this.UpdateMessageType(this.getDomElement(), maxType);
};
AdfRichUIPeer.prototype.UpdateMessageType = function(element, maxType) {
  var oldType = AdfAgent.AGENT.getExpandoProperty(element, AdfRichUIPeer.__TYPE_ATTR);
  if (oldType != maxType) {
    AdfMessageUtils.switchCSSClassName(element, oldType, maxType);
    AdfAgent.AGENT.setExpandoProperty(element, AdfRichUIPeer.__TYPE_ATTR, maxType);
  }
};
AdfRichUIPeer.prototype.MessageShow = function(maxType, messages) {
};
AdfRichUIPeer.prototype.showContextMenu = function(domEvent, menuId, parentComponent, alignElement, alignHint, launchSourceId) {
  if (menuId) {
    var popup;
    if (parentComponent) {
      popup = parentComponent.findComponent(menuId);
    } else {
      popup = AdfPage.PAGE.findComponent(menuId);
    }
    if (popup) {
      AdfAssert.assert(popup instanceof AdfRichPopup, "Invalid popup component for context menu.");
      AdfAgent.AGENT.preventDefault(domEvent);
      var hints = {};
      hints[AdfDhtmlPopupHints.TYPE] = AdfDhtmlPopupHints.TYPE_MENU;
      hints[AdfDhtmlPopupHints.AUTODISMISS] = AdfDhtmlPopupHints.AUTODISMISS_MENU;
      hints[AdfDhtmlPopupHints.FOCUS] = true;
      if (launchSourceId) {
        hints[AdfRichPopup.HINT_LAUNCH_ID] = launchSourceId;
      }
      if (alignElement != null) {
        hints[AdfDhtmlPopupHints.ALIGN_ELEMENT] = alignElement;
        hints[AdfRichPopup.HINT_ALIGN] = alignHint ? alignHint : AdfRichPopup.ALIGN_AFTER_START;
      } else {
        var pos = AdfAgent.AGENT.getMousePosition(domEvent);
        hints[AdfDhtmlPopupHints.MOUSEPOSITION] = pos;
      }
      popup.show(hints);
    } else {
      if (parentComponent) {
        AdfLogger.LOGGER.severe("Could not find popup for context menu ", menuId, " from component ", parentComponent);
      } else {
        AdfLogger.LOGGER.severe("Could not find popup for context menu ", menuId);
      }
    }
  }
};
AdfRichUIPeer.prototype.showPopup = function(component, contentDom, hints, popupId) {
  var popupList = component[AdfRichUIPeer._POPUP_LIST];
  if (popupList == null) {
    component[AdfRichUIPeer._POPUP_LIST] = popupList = {};
  }
  var peerHints = {};
  peerHints[AdfDhtmlPopupHints.AUTODISMISS] = AdfDhtmlPopupHints.AUTODISMISS_ALWAYS;
  peerHints[AdfDhtmlPopupHints.TYPE] = AdfDhtmlPopupHints.TYPE_INLINESELECTOR;
  peerHints[AdfDhtmlPopupHints.FOCUS] = true;
  peerHints[AdfDhtmlPopupHints.CLOSE_ON_ESCAPE] = true;
  if (component._childHints) {
    AdfCollections.copyInto(peerHints, component._childHints);
  }
  if (popupId == null) {
    popupId = AdfRichUIPeer._POPUP_ID_DEFAULT;
  }
  AdfCollections.copyInto(peerHints, hints);
  if (hints) {
    hints["popupId"] = popupId;
  }
  peerHints["popupId"] = popupId;
  var popupWindow = popupList[popupId];
  var page = AdfPage.PAGE;
  if (!popupWindow) {
    popupWindow = AdfDhtmlPopupWindowFactory.createPopup(peerHints);
    popupList[popupId] = popupWindow;
    var contentId = contentDom.id;
    var needsUnmapping = false;
    if (contentId && !page.findComponent(contentId)) {
      AdfPage.PAGE.mapComponent(contentId, component);
      needsUnmapping = true;
    }
  }
  var anchorNode = contentDom.parentNode;
  var anchorId;
  if (anchorNode) {
    anchorId = anchorNode.id;
  }
  peerHints[AdfDhtmlPopupHints.CONTENT] = contentDom;
  peerHints[AdfDhtmlPopupHints.CLOSE_HANDLER] = this.createCallback(this._popupClosedHandler);
  peerHints[AdfDhtmlPopupHints.COMPONENT_CLIENT_ID] = component.getClientId();
  var popupClosedHandlerParams = {"component":component, "contentDom":contentDom, "unmap":needsUnmapping, "popupId":popupId, "anchorId":anchorId};
  page.__addPopupInfo(component, popupClosedHandlerParams);
  var otherClosedHandler = hints ? hints[AdfDhtmlPopupHints.CLOSE_HANDLER] : null;
  if (otherClosedHandler) {
    popupClosedHandlerParams["otherClosedHandler"] = otherClosedHandler;
    popupClosedHandlerParams["otherClosedHandlerParams"] = hints[AdfDhtmlPopupHints.CLOSE_HANDLER_PARAM];
  }
  peerHints[AdfDhtmlPopupHints.CLOSE_HANDLER_PARAM] = popupClosedHandlerParams;
  var alignId = hints ? hints[AdfRichPopup.HINT_ALIGN_ID] : null;
  if (alignId) {
    var alignElement = AdfAgent.AGENT.getElementById(alignId);
    if (alignElement) {
      peerHints[AdfDhtmlPopupHints.ALIGN_ELEMENT] = alignElement;
    }
    peerHints[AdfRichPopup.HINT_ALIGN_ID] = null;
  }
  var ariaLabel = hints ? hints[AdfDhtmlPopupHints.ARIA_LABEL] : null;
  if (ariaLabel) {
    peerHints[AdfDhtmlPopupHints.ARIA_LABEL] = ariaLabel;
  }
  popupWindow.show(peerHints);
};
AdfRichUIPeer.prototype.isPopupVisible = function(component, popupId) {
  var popupWindow = this.getPopupWindow(component, popupId);
  if (popupWindow) {
    return true;
  }
  return false;
};
AdfRichUIPeer.prototype.hidePopup = function(component, popupId) {
  var popupWindow = this.getPopupWindow(component, popupId);
  if (popupWindow) {
    popupWindow.hide();
  }
};
AdfRichUIPeer.prototype.hideAllPopups = function(component) {
  var popupList = component[AdfRichUIPeer._POPUP_LIST];
  if (popupList != null) {
    for (var popupId in popupList) {
      var popupWindow = popupList[popupId];
      if (popupWindow && popupWindow.hide) {
        popupWindow.hide();
      }
    }
  }
};
AdfRichUIPeer.prototype.cancelPopup = function(component, popupId) {
  var popupWindow = this.getPopupWindow(component, popupId);
  if (popupWindow) {
    popupWindow.cancel();
  }
};
AdfRichUIPeer.prototype.cancelAllPopups = function(component, replaceDom) {
  var popupList = component[AdfRichUIPeer._POPUP_LIST];
  if (popupList != null) {
    for (var popupId in popupList) {
      var popupWindow = popupList[popupId];
      if (popupWindow && popupWindow.cancel) {
        popupWindow.cancel(replaceDom);
      }
    }
  }
};
AdfRichUIPeer.prototype.getPopupWindow = function(component, popupId) {
  var popupWindow = null;
  var popupList = component[AdfRichUIPeer._POPUP_LIST];
  if (popupList != null) {
    if (popupId == null) {
      popupId = AdfRichUIPeer._POPUP_ID_DEFAULT;
    }
    popupWindow = popupList[popupId];
  }
  return popupWindow;
};
AdfRichUIPeer.prototype.getAllPopups = function(component) {
  return component[AdfRichUIPeer._POPUP_LIST];
};
AdfRichUIPeer._removeTwinkleCallback = function(domId) {
  var activeDomElement = AdfAgent.AGENT.getElementById(domId);
  if (activeDomElement != null) {
    activeDomElement.removeAttribute(AdfRichUIPeer._TWINKLE_TIMER_ID_ATTR);
    AdfDomUtils.removeCSSClassName(activeDomElement, AdfRichUIPeer._TWINKLE_ON_STYLECLASS);
  }
};
AdfRichUIPeer.prototype._popupClosedHandler = function(param) {
  var component = param["component"];
  var popupList = component[AdfRichUIPeer._POPUP_LIST];
  if (popupList == null) {
    return;
  }
  var popupWindow = popupList[param["popupId"]];
  if (!popupWindow) {
    return;
  }
  var contentDom = param["contentDom"];
  var popupId = param["popupId"];
  delete popupList[popupId];
  page.__removePopupInfo(component, popupId);
  if (param["unmap"]) {
    AdfPage.PAGE.unmapComponent(contentDom["id"]);
  }
  this.bind(component);
  this.PopupClosed(component, contentDom, popupId);
  var otherClosedHandler = param["otherClosedHandler"];
  if (otherClosedHandler) {
    var otherClosedHandlerParams = param["otherClosedHandlerParams"];
    otherClosedHandler(otherClosedHandlerParams);
  }
};
AdfRichUIPeer.prototype.PopupClosed = function(component, contentDom, popupId) {
};
AdfRichUIPeer.prototype.GetRichResourceURL = function(path) {
  return AdfPage.PAGE.getResourceURL("/afr" + path);
};
AdfRichUIPeer.prototype.scrollIntoView = function(component, focus, subTargetId) {
  this.bind(component);
  this.ScrollIntoView(component, focus, subTargetId);
};
AdfRichUIPeer.prototype.ScrollIntoView = function(component, focus, subTargetId) {
  var rootElement = this.getDomElement();
  rootElement.scrollIntoView();
  var subTargetElement = null;
  if (subTargetId != null) {
    subTargetElement = AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(component.getClientId(), subTargetId));
    if (subTargetElement) {
      subTargetElement.scrollIntoView();
    } else {
      AdfLogger.LOGGER.warning("Invalid subTargetId specified:" + subTargetId);
    }
  }
  if (focus) {
    if (subTargetElement) {
      AdfFocusUtils.focusElement(subTargetElement);
    } else {
      var firstTabStop = AdfFocusUtils.getFirstTabStop(rootElement);
      if (firstTabStop) {
        AdfFocusUtils.focusElement(firstTabStop);
      }
    }
  }
};
AdfRichUIPeer.prototype.getSubIdDomElement = function(component, subId) {
  this.bind(component);
  return this.GetSubIdDomElement(subId);
};
AdfRichUIPeer.prototype.GetSubIdDomElement = function(subId) {
  AdfLogger.LOGGER.warning("Unknown subId:", subId, " for component ", this.getComponent());
  return null;
};
AdfRichUIPeer.prototype.getFallbackDomElement = function(component, descendantLocator, subId) {
  this.bind(component);
  return this.GetFallbackDomElement(descendantLocator, subId);
};
AdfRichUIPeer.prototype.GetFallbackDomElement = function(descendantLocator, subId) {
  return null;
};
AdfRichUIPeer.prototype.simulateMouse = function(component, subId, mouseEvent) {
  this.bind(component);
  var domElement;
  if (subId) {
    domElement = this.GetSubIdDomElement(subId);
    if (!domElement) {
      AdfLogger.LOGGER.warning("No DOM element found for provided subId: " + subId + ". Mouse event will not be processed.");
      return;
    }
  } else {
    domElement = this.getDomElement();
  }
  this.SimulateMouseOnDescendant(component, domElement, mouseEvent);
};
AdfRichUIPeer.prototype.SimulateMouseOnDescendant = function(targetComponent, domElement, mouseEvent) {
  var parentComponent = this.getComponent().getParent();
  if (parentComponent) {
    var parentPeer = parentComponent.getPeer();
    parentPeer.bind(parentComponent);
    parentPeer.SimulateMouseOnDescendant(targetComponent, domElement, mouseEvent);
  } else {
    domElement.scrollIntoView();
    AdfPage.PAGE.simulateDomMouse(domElement, mouseEvent);
  }
};
AdfRichUIPeer.prototype.isAbsoluteLocatorCacheable = function() {
  return true;
};
AdfRichUIPeer.isInlineSVGIcon = function(component) {
  var iconUrl = AdfRichUIPeer._getIconUrl(component);
  if (!iconUrl) {
    return false;
  }
  var iconDelivery = component.getIconDelivery();
  if (iconDelivery == "inline" || iconDelivery == "fetchAndInline") {
    return true;
  }
  return false;
};
AdfRichUIPeer.prototype.GetElementToReplaceWithSVG = function(component) {
  var clientId = component.getClientId();
  var rootElem = document.getElementById(clientId);
  return rootElem.querySelector("span[" + AdfRichUIPeer._SVG_EXPANDO + "]");
};
AdfRichUIPeer.prototype._fetchSVGIcon = function(component) {
  var iconDelivery = component.getPropertyKeys()["iconDelivery"];
  if (iconDelivery && component.getIconDelivery() == "fetchAndInline") {
    var iconUrl = AdfRichUIPeer._getIconUrl(component);
    if (!iconUrl) {
      return;
    }
    var cacheManager = new AdfSvgCacheManager;
    var span = this.GetElementToReplaceWithSVG(component);
    if (!span) {
      AdfLogger.LOGGER.warning("AdfRichUIPeer#_fetchSVGIcon - span element not found in component with clientID: " + component.getClientId());
      return;
    }
    cacheManager.embedSVG(component, span, iconUrl);
  }
};
AdfRichUIPeer._getIconUrl = function(component) {
  return component.getIcon ? component.getIcon() : component.getSource ? AdfPage.PAGE.getResourceURL(component.getSource()) : null;
};
AdfRichUIPeer.DISABLED_STYLECLASS = "p_AFDisabled";
AdfRichUIPeer.SELECTED_STYLECLASS = "p_AFSelected";
AdfRichUIPeer.READONLY_STYLECLASS = "p_AFReadOnly";
AdfRichUIPeer.DROP_TARGET_STYLECLASS = "p_AFDropTarget";
AdfRichUIPeer.DRAG_SOURCE_STYLECLASS = "p_AFDragSource";
AdfRichUIPeer.BUSY_STYLECLASS = "p_AFBusy";
AdfRichUIPeer.HOVER_TARGET_STYLECLASS = "p_AFHoverTarget";
AdfRichUIPeer.FOCUS_TARGET_STYLECLASS = "p_AFFocusTarget";
AdfRichUIPeer.DRAG_READY_STYLECLASS = "p_AFDragReady";
AdfRichUIPeer.__TYPE_ATTR = "__adfPeerMsgType";
AdfRichUIPeer._POPUP_ID_DEFAULT = "__afrPeerPPDefault";
AdfRichUIPeer._POPUP_LIST = "__afrPeerPPList";
AdfRichUIPeer._TWINKLE_TIMER_ID_ATTR = "__afrTwinkleTimer";
AdfRichUIPeer._TWINKLE_ON_STYLECLASS = "p_AFTwinkleOn";
AdfRichUIPeer._FILTER_PREFIX = "_afrFltr";
AdfRichUIPeer._SVG_EXPANDO = "_afrSvg";
AdfRichUIPeer._COMPONENTS_WITH_ONLICK_EVENTS = ["oracle.adf.RichButton", "oracle.adf.RichCommandButton", "oracle.adf.RichMenu", "oracle.adf.RichCommandMenuItem", "oracle.adf.RichSelectBooleanRadio", "oracle.adf.RichCommandToolbarButton", "oracle.adf.RichCommandNavigationItem", "oracle.adf.RichGoMenuItem", "oracle.adf.RichLink", "oracle.adf.RichSelectOneRadio", "oracle.adf.RichSelectManyListbox", "oracle.adf.RichCalendar", "oracle.adf.RichChooseColor", "oracle.adf.RichColumn", "oracle.adf.RichInputFile", 
"oracle.adf.RichListView", "oracle.adf.RichSelectManyCheckbox", "oracle.adf.RichSelectManyChoice", "oracle.adf.RichPanelAccordion", "oracle.adf.RichCarouselItem", "oracle.adf.RichDocument", "oracle.adf.RichSelectOneListbox", "oracle.adf.RichTable", "oracle.adf.RichTree", "oracle.adf.RichQuickQuery", "oracle.adf.RichCommandLink", "oracle.adf.RichCommandImageLink", "oracle.adf.RichDialog"];
