AdfRichUIPeer.createPeerClass(AdfDhtmlInputBasePeer, "AdfDhtmlInputListOfValuesSuperBasePeer");
AdfDhtmlInputListOfValuesSuperBasePeer.InitSubclass = function() {
  AdfRichUIPeer.addComponentEventHandlers(this, AdfUIInputEvent.DOUBLE_CLICK_EVENT_TYPE, AdfPopupOpeningEvent.POPUP_OPENING_EVENT_TYPE, AdfPopupClosedEvent.POPUP_CLOSED_EVENT_TYPE, AdfDialogEvent.EVENT_TYPE, AdfUIInputEvent.KEY_PRESS_EVENT_TYPE);
  this._POPUP_SUFFIX_ID = "_afrLovPopupId";
  this._SHOWN = "_shown";
  this._DIALOG_CONTENT_HEIGHT = "_dialogContentHeight";
  this._DIALOG_CONTENT_WIDTH = "_dialogContentWidth";
  this._INTERNAL_TABLE_SUFFIX_ID = "_afrLovInternalTableId";
  this._INTERNAL_QUERY_ID = "_afrLovInternalQueryId";
  this._LOVINTERNAL_EVENT_QUEUED = "_afrLovInternalEventQueued";
  this._LOVINTERNAL_DIALOG_SUFFIX_ID = "_afrLovDialogId";
  this._OK_PRESSED = false;
  this._EDIT_MODE_SELECT = "select";
  this._clientId = null;
  AdfRichUIPeer.addSuppressedPPRAttributes(this, AdfDhtmlInputListOfValuesSuperBasePeer._DIALOG_CONTENT_HEIGHT, AdfDhtmlInputListOfValuesSuperBasePeer._DIALOG_CONTENT_WIDTH, AdfDhtmlInputListOfValuesSuperBasePeer._SHOWN)
};
AdfDhtmlInputListOfValuesSuperBasePeer.FocusInputElement = function(component) {
  var inputDom = AdfDhtmlEditableValuePeer.getContentNode(component);
  AdfDhtmlInputBasePeer.setLastValue(inputDom);
  AdfFocusUtils.focusElement(inputDom)
};
AdfDhtmlInputListOfValuesSuperBasePeer.GetLabelText = function(component) {
  var label = component.getLabel();
  if(label) {
    return label
  }
  var contentNode = AdfDhtmlEditableValuePeer.getContentNode(component);
  var labelElem;
  if(contentNode.labels) {
    labelElem = contentNode.labels[0]
  }else {
    labelElem = document.querySelector("label[for\x3d'" + AdfDhtmlEditableValuePeer.GetContentNodeId(component) + "']")
  }
  if(labelElem) {
    return labelElem.textContent
  }
  AdfLogger.LOGGER.info("Application hasn't provided label for ", component.getClientId())
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.AnnounceAutoComplete = function() {
  AdfAssert.failedInAbstractFunction()
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentClickOrTouch = function(componentEvent) {
  AdfAssert.failedInAbstractFunction()
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.ComponentRemoved = function(component) {
  var callback = this._busyStateListenerCallback;
  if(callback && this.getComponent() == component) {
    AdfPage.PAGE.removeBusyStateListener(this, callback);
    delete this._busyStateListenerCallback
  }
  callback = this._popupClosedCallback;
  if(callback) {
    AdfLogger.LOGGER.info("Potential callback leak detected - LOV _popupClosedCallback: ", callback)
  }
  AdfDhtmlInputListOfValuesSuperBasePeer.superclass.ComponentRemoved.call(this, component)
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.SetDisplayValue = function(component, domElement, newValue) {
  AdfAssert.assertString(newValue);
  var domNode = AdfDhtmlEditableValuePeer.getContentNode(component);
  var domNodeTagName = domNode.tagName;
  var isInput = domNodeTagName == "INPUT";
  if(component.getReadOnly()) {
    AdfAgent.AGENT.setTextContent(domNode, newValue)
  }else {
    domNode.title = newValue;
    if(isInput) {
      domNode.value = newValue
    }else {
      AdfAgent.AGENT.setTextContent(domNode, newValue)
    }
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentDblClick = function(componentEvent) {
  var srcComponent = componentEvent.getSource();
  if(srcComponent instanceof AdfRichTable) {
    var myComponent = this.getComponent();
    var srcParent = srcComponent.getParent();
    while(srcParent != myComponent && srcParent != null) {
      if(srcParent instanceof AdfRichDialog) {
        (new AdfDialogEvent(srcParent, AdfDialogEvent.OUTCOME_OK)).queue();
        break
      }
      srcParent = srcParent.getParent()
    }
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentDialog = function(componentEvent) {
  var component = this.getComponent();
  var dialog = componentEvent.getSource();
  var dialogClientId = component.getClientId() + AdfDhtmlInputListOfValuesSuperBasePeer._LOVINTERNAL_DIALOG_SUFFIX_ID;
  if(dialog.getClientId() == dialogClientId) {
    componentEvent.setRoot(component);
    this._OK_PRESSED = componentEvent.getOutcome() == AdfDialogEvent.OUTCOME_OK;
    if(!this._OK_PRESSED) {
      AdfLovInternalPopupClosedEvent.queue(component, AdfLovInternalPopupClosedEvent.OPERATION_CANCEL, true)
    }else {
      var queryClientId = component.getClientId() + AdfDhtmlInputListOfValuesSuperBasePeer._INTERNAL_QUERY_ID;
      var query = AdfPage.PAGE.findComponent(queryClientId);
      if(query) {
        var queryPeer = query.getPeer();
        queryPeer.bind(query);
        if(!queryPeer.validateCriterionFields()) {
          componentEvent.cancel();
          componentEvent.stopBubbling();
          return
        }
        this.bind(component)
      }
      AdfReturnPopupDataEvent.queue(component, true)
    }
    AdfDhtmlInputListOfValuesSuperBasePeer.FocusInputElement(component);
    var callback = this._busyStateListenerCallback;
    if(callback) {
      AdfPage.PAGE.removeBusyStateListener(this, callback);
      delete this._busyStateListenerCallback
    }
    component.setProperty(AdfDhtmlInputListOfValuesSuperBasePeer._DIALOG_CONTENT_HEIGHT, dialog.getContentHeight(), false, AdfUIComponent.PROPAGATE_ALWAYS);
    component.setProperty(AdfDhtmlInputListOfValuesSuperBasePeer._DIALOG_CONTENT_WIDTH, dialog.getContentWidth(), false, AdfUIComponent.PROPAGATE_ALWAYS)
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentKeyUp = function(componentEvent) {
  var component = this.getComponent();
  var keyCode = componentEvent.getKeyCode();
  if((AdfKeyStroke.ENTER_KEY == keyCode || AdfKeyStroke.TAB_KEY == keyCode) && component.getProperty(AdfDhtmlInputListOfValuesSuperBasePeer._LOVINTERNAL_EVENT_QUEUED)) {
    componentEvent.cancel();
    componentEvent.stopBubbling();
    component.setProperty(AdfDhtmlInputListOfValuesSuperBasePeer._LOVINTERNAL_EVENT_QUEUED, false, false, AdfUIComponent.PROPAGATE_NEVER);
    return
  }
  if(!componentEvent.isCanceled() && AdfKeyStroke.ENTER_KEY == keyCode) {
    var tableId = component.getClientId() + AdfDhtmlInputListOfValuesSuperBasePeer._INTERNAL_TABLE_SUFFIX_ID;
    var sourceId = componentEvent.getSource().getClientId();
    if(sourceId && sourceId == tableId) {
      componentEvent.cancel();
      componentEvent.stopBubbling();
      return
    }
  }
  if(componentEvent.getEventPhase() == AdfBaseEvent.AT_TARGET_PHASE) {
    if(keyCode != AdfKeyStroke.TAB_KEY) {
      this.AutoTab(component, componentEvent.getNativeEventTarget())
    }
    delete this._nodeLength
  }
  AdfDhtmlInputListOfValuesSuperBasePeer.superclass.HandleComponentKeyUp.call(this, componentEvent)
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.AutoTab = function(component, node) {
  if(component.getAutoTab && component.getAutoTab()) {
    var maximumLength = component.getMaximumLength();
    if(maximumLength < 1) {
      return
    }
    var nodeLength = node.value ? node.value.length : 0;
    if(nodeLength >= maximumLength && nodeLength > this._nodeLength) {
      this.FocusNextElement(node)
    }
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.FocusNextElement = function(node) {
  AdfAssert.failedInAbstractFunction()
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentKeyPress = function(componentEvent) {
  this.StopArrowKeyBubbling(componentEvent);
  var component = this.getComponent();
  var keyCode = componentEvent.getKeyCode();
  if((AdfKeyStroke.ENTER_KEY == keyCode || AdfKeyStroke.TAB_KEY == keyCode) && component.getProperty(AdfDhtmlInputListOfValuesSuperBasePeer._LOVINTERNAL_EVENT_QUEUED)) {
    componentEvent.cancel();
    componentEvent.stopBubbling();
    return
  }
  if(!componentEvent.isCanceled() && AdfKeyStroke.ENTER_KEY == keyCode) {
    var tableId = component.getClientId() + AdfDhtmlInputListOfValuesSuperBasePeer._INTERNAL_TABLE_SUFFIX_ID;
    var sourceId = componentEvent.getSource().getClientId();
    if(sourceId && sourceId == tableId) {
      componentEvent.cancel();
      componentEvent.stopBubbling();
      return
    }
  }
  var targetNode = componentEvent.getNativeEventTarget();
  this._nodeLength = targetNode.value ? targetNode.value.length : 0
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentKeyDown = function(componentEvent) {
  this.StopArrowKeyBubbling(componentEvent);
  var keyCode = componentEvent.getKeyCode();
  var component = this.getComponent();
  switch(keyCode) {
    case AdfKeyStroke.ENTER_KEY:
      if(window["AdfAutoSuggestBehaviorImpl"] && AdfAutoSuggestBehaviorImpl.isPopupVisible(component, this)) {
        componentEvent.cancel();
        componentEvent.stopBubbling();
        break
      }
    ;
    case AdfKeyStroke.TAB_KEY:
      var targetNode = componentEvent.getNativeEventTarget();
      if(this.IsKeyEventInInput(component, componentEvent)) {
        if(this._queueLovInternalEvent(component, targetNode)) {
          componentEvent.cancel();
          componentEvent.stopBubbling();
          component.setProperty(AdfDhtmlInputListOfValuesSuperBasePeer._LOVINTERNAL_EVENT_QUEUED, true, false, AdfUIComponent.PROPAGATE_NEVER);
          if(keyCode == AdfKeyStroke.TAB_KEY) {
            this.preventNextValueSubmission();
            AdfFocusUtils.focusNextTabStop(targetNode)
          }
        }else {
          if(keyCode == AdfKeyStroke.ENTER_KEY) {
            this.RunValidation(component, targetNode)
          }
        }
      }
      break;
    case AdfKeyStroke.BACKSPACE_KEY:
      if(component.getEditMode() == AdfDhtmlInputListOfValuesSuperBasePeer._EDIT_MODE_SELECT && this.IsCancelBackSpaceKeyEvent(component, componentEvent)) {
        componentEvent.cancel()
      }
      break
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.IsCancelBackSpaceKeyEvent = function(component, componentEvent) {
  AdfAssert.failedInAbstractFunction()
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.IsKeyEventInInput = function(component, componentEvent) {
  var subid = AdfDhtmlEditableValuePeer.GetContentNodeId(component);
  var targetNode = componentEvent.getNativeEventTarget();
  if(targetNode.id == subid) {
    return true
  }
  return false
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentPopupClosed = function(componentEvent) {
  var popup = componentEvent.getSource();
  var component = this.getComponent();
  var lovClientId = component.getClientId();
  var popupDialogId = lovClientId + AdfDhtmlInputListOfValuesSuperBasePeer._POPUP_SUFFIX_ID;
  if(popup.getClientId() == popupDialogId) {
    AdfDhtmlInputListOfValuesSuperBasePeer._setShown(component, null);
    if(this._OK_PRESSED == true) {
      AdfReturnPopupDataEvent.queue(component, true)
    }
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.HandleComponentPopupOpening = function(componentEvent) {
  var popup = componentEvent.getSource();
  var component = this.getComponent();
  var clientId = component.getClientId();
  if(popup == AdfDhtmlInputListOfValuesSuperBasePeer._getLovPopup(clientId)) {
    this.HideNoteWindow();
    AdfDhtmlInputListOfValuesSuperBasePeer._setShown(component, clientId);
    var callback = this._busyStateListenerCallback;
    if(!callback) {
      this._busyStateListenerCallback = callback = this.createCallback(this._busyStateListener)
    }
    AdfPage.PAGE.addBusyStateListener(this, callback)
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype._busyStateListener = function(event) {
  var component = this.getComponent();
  if(component == null) {
    AdfLogger.LOGGER.severe("Unexpected null component! ", event)
  }
  var clientId = component.getClientId();
  if(this.IsLovPopupVisible(clientId)) {
    var dialogClientId = clientId + AdfDhtmlInputListOfValuesSuperBasePeer._LOVINTERNAL_DIALOG_SUFFIX_ID;
    var dialog = AdfPage.PAGE.findComponent(dialogClientId);
    if(dialog) {
      var peer = dialog.getPeer();
      peer.__setDefaultButtonDisabled(dialogClientId, event.isBusy())
    }
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.IsLovPopupVisible = function(clientId) {
  var popup = AdfDhtmlInputListOfValuesSuperBasePeer._getLovPopup(clientId);
  if(popup && popup.isPopupVisible()) {
    return true
  }
  return false
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.ShowNoteWindow = function(component, isMouseOver) {
  if(!component) {
    component = this.getComponent()
  }
  if(component && this.getDomElement()) {
    AdfDhtmlInputListOfValuesSuperBasePeer.superclass.ShowNoteWindow.call(this, component, isMouseOver)
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.IsNoteWindowVisible = function(component) {
  if(!component) {
    component = this.getComponent()
  }
  if(component && this.getDomElement()) {
    return AdfDhtmlInputListOfValuesSuperBasePeer.superclass.IsNoteWindowVisible.call(this, component)
  }
  return false
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype._queueLovInternalEvent = function(component, targetNode) {
  var contentNode = AdfDhtmlEditableValuePeer.getContentNode(component);
  if(targetNode == contentNode) {
    if(targetNode.tagName == "INPUT") {
      var lastValue = AdfDhtmlInputBasePeer.getLastValue(contentNode);
      var value = targetNode.value;
      if(value != lastValue && value.length > 0 && component.getAutoSubmit()) {
        AdfDhtmlInputBasePeer.setLastValue(contentNode, value);
        AdfLovInternalEvent.queue(component, AdfLovInternalEvent.ACTION_TAB, true);
        return true
      }
    }
  }
  return false
};
AdfDhtmlInputListOfValuesSuperBasePeer._getLovPopup = function(lovClientId) {
  var popupId = lovClientId + AdfDhtmlInputListOfValuesSuperBasePeer._POPUP_SUFFIX_ID;
  return AdfPage.PAGE.findComponent(popupId)
};
AdfDhtmlInputListOfValuesSuperBasePeer._setShown = function(component, shown) {
  component.setProperty(AdfDhtmlInputListOfValuesSuperBasePeer._SHOWN, shown, false, true)
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype.showToolbarPopup = function(clientId, popupId) {
  this._clientId = clientId;
  var toobarId = clientId + "_afrLovToolbar";
  var popup = AdfPage.PAGE.findComponent(popupId);
  if(popup != null) {
    if(!this._popupClosedCallback) {
      this._popupClosedCallback = this.createCallback(this._toolbarPopupClosed);
      popup.addEventListener(AdfPopupClosedEvent.POPUP_CLOSED_EVENT_TYPE, this._popupClosedCallback)
    }
    popup.show({"align":AdfRichPopup.ALIGN_AFTER_END, "alignId":toobarId})
  }
};
AdfDhtmlInputListOfValuesSuperBasePeer.prototype._toolbarPopupClosed = function(componentEvent) {
  var component = AdfPage.PAGE.findComponent(this._clientId);
  if(component != null) {
    AdfLovInternalPopupClosedEvent.queue(component, AdfLovInternalPopupClosedEvent.OPERATION_TOOLBAR_CLOSED, true)
  }
};
