var $AdfDhtmlTogglePeer$$ = $AdfRichUIPeer$$.$createPeerClass$($AdfRichUIPeer$$, "AdfDhtmlTogglePeer");
$goog$exportSymbol$$("AdfDhtmlTogglePeer", $AdfDhtmlTogglePeer$$);
$AdfDhtmlTogglePeer$$.$InitSubclass$ = function $$AdfDhtmlTogglePeer$$$$InitSubclass$$($initializationState$$2$$) {
  $initializationState$$2$$ && ($AdfRichUIPeer$$.$addComponentPropertyChanges$(this, $initializationState$$2$$.$propertyChanges$), $AdfRichUIPeer$$.$addComponentEventHandlers$(this, $initializationState$$2$$.$eventHandlers$));
  this.$_STYLE_CLASS_PROPERTIES$ = ["toggledStyleClass", "untoggledStyleClass"];
  this.$_TRANSLATION_PROPERTIES$ = ["toggledTipResource", "untoggledTipResource"];
  this.$_COPIED_PROPERTIES$ = "propertyName clientEventType ltrToggledIconName ltrUntoggledIconName rtlToggledIconName rtlUntoggledIconName".split(" ")
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.InitSubclass", $AdfDhtmlTogglePeer$$.$InitSubclass$);
$AdfDhtmlTogglePeer$$.$Config$ = function $$AdfDhtmlTogglePeer$$$$Config$$($subclass$$, $config$$4$$) {
  for(var $copiedProps_laf$$96$$ = $AdfPage$$.$PAGE$.$getLookAndFeel$(), $subclassProto$$ = $subclass$$.prototype, $basePropName_styleClassProps$$ = $AdfDhtmlTogglePeer$$.$_STYLE_CLASS_PROPERTIES$, $propCount$$2$$ = $basePropName_styleClassProps$$.length, $i$$545$$ = 0;$i$$545$$ < $propCount$$2$$;$i$$545$$++) {
    var $propName$$30_translationProps$$ = $basePropName_styleClassProps$$[$i$$545$$], $styleClass$$11_translatedString_translationKey$$ = $config$$4$$[$propName$$30_translationProps$$];
    $styleClass$$11_translatedString_translationKey$$ && ($subclassProto$$[$propName$$30_translationProps$$] = $copiedProps_laf$$96$$.getStyleClass($styleClass$$11_translatedString_translationKey$$))
  }
  $propName$$30_translationProps$$ = $AdfDhtmlTogglePeer$$.$_TRANSLATION_PROPERTIES$;
  $propCount$$2$$ = $propName$$30_translationProps$$.length;
  for($i$$545$$ = 0;$i$$545$$ < $propCount$$2$$;$i$$545$$++) {
    if($basePropName_styleClassProps$$ = $propName$$30_translationProps$$[$i$$545$$], $styleClass$$11_translatedString_translationKey$$ = $config$$4$$[$basePropName_styleClassProps$$ + "Key"]) {
      $styleClass$$11_translatedString_translationKey$$ = $copiedProps_laf$$96$$.$getTranslatedString$($styleClass$$11_translatedString_translationKey$$), $AdfAssert$$.$assertString$($styleClass$$11_translatedString_translationKey$$), $subclassProto$$[$basePropName_styleClassProps$$] = $styleClass$$11_translatedString_translationKey$$
    }
  }
  $copiedProps_laf$$96$$ = $AdfDhtmlTogglePeer$$.$_COPIED_PROPERTIES$;
  $propCount$$2$$ = $copiedProps_laf$$96$$.length;
  for($i$$545$$ = 0;$i$$545$$ < $propCount$$2$$;$i$$545$$++) {
    $propName$$30_translationProps$$ = $copiedProps_laf$$96$$[$i$$545$$], $propName$$30_translationProps$$ in $config$$4$$ && ($subclassProto$$[$propName$$30_translationProps$$] = $config$$4$$[$propName$$30_translationProps$$])
  }
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.Config", $AdfDhtmlTogglePeer$$.$Config$);
$AdfDhtmlTogglePeer$$.prototype.$QueueClientEvent$ = function $$AdfDhtmlTogglePeer$$$$$QueueClientEvent$$() {
  $AdfAssert$$.$failedInAbstractFunction$()
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.QueueClientEvent", {$QueueClientEvent$:$AdfDhtmlTogglePeer$$.prototype.$QueueClientEvent$});
$AdfDhtmlTogglePeer$$.prototype.$UpdateButton$ = function $$AdfDhtmlTogglePeer$$$$$UpdateButton$$($newImageURL_toggled$$1$$) {
  var $buttonElem_imageElement$$ = this.$GetButtonElement$();
  if(!$buttonElem_imageElement$$) {
    return $JSCompiler_alias_FALSE$$
  }
  var $oldStyleClass$$ = this.$toggledStyleClass$, $newStyleClass$$1$$ = this.$untoggledStyleClass$, $temp$$1_titleFormat$$ = this.$untoggledTipResource$;
  $newImageURL_toggled$$1$$ && ($temp$$1_titleFormat$$ = $oldStyleClass$$, $oldStyleClass$$ = $newStyleClass$$1$$, $newStyleClass$$1$$ = $temp$$1_titleFormat$$, $temp$$1_titleFormat$$ = this.$toggledTipResource$);
  if($oldStyleClass$$) {
    $AdfDomUtils$$.$removeCSSClassName$($buttonElem_imageElement$$, $oldStyleClass$$), $AdfDomUtils$$.$addCSSClassName$($buttonElem_imageElement$$, $newStyleClass$$1$$)
  }else {
    if($buttonElem_imageElement$$ = this.$GetButtonImageElement$()) {
      if($newImageURL_toggled$$1$$ = this.$getIconURL$($newImageURL_toggled$$1$$)) {
        $buttonElem_imageElement$$.src = $newImageURL_toggled$$1$$
      }
    }
  }
  $temp$$1_titleFormat$$ && this.$ApplyTitle$(TrFastMessageFormatUtils.$format$($temp$$1_titleFormat$$, this.$GetTitle$()));
  return $JSCompiler_alias_TRUE$$
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.UpdateButton", {$UpdateButton$:$AdfDhtmlTogglePeer$$.prototype.$UpdateButton$});
$AdfDhtmlTogglePeer$$.prototype.$ApplyTitle$ = function $$AdfDhtmlTogglePeer$$$$$ApplyTitle$$($titleText$$2$$) {
  var $buttonElem$$1$$ = this.$GetButtonElement$();
  $AdfAgent$$.$AGENT$.setAttribute($buttonElem$$1$$, "title", $titleText$$2$$)
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.ApplyTitle", {$ApplyTitle$:$AdfDhtmlTogglePeer$$.prototype.$ApplyTitle$});
$AdfDhtmlTogglePeer$$.prototype.$GetTitle$ = function $$AdfDhtmlTogglePeer$$$$$GetTitle$$() {
  return this.$getComponent$().$getProperty$("text")
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetTitle", {$GetTitle$:$AdfDhtmlTogglePeer$$.prototype.$GetTitle$});
$AdfDhtmlTogglePeer$$.prototype.$GetButtonElement$ = function $$AdfDhtmlTogglePeer$$$$$GetButtonElement$$() {
  return this.$getDomElement$()
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetButtonElement", {$GetButtonElement$:$AdfDhtmlTogglePeer$$.prototype.$GetButtonElement$});
$AdfDhtmlTogglePeer$$.prototype.$GetButtonImageElement$ = function $$AdfDhtmlTogglePeer$$$$$GetButtonImageElement$$() {
  var $buttonElement$$2$$ = this.$GetButtonElement$();
  return $buttonElement$$2$$ ? $buttonElement$$2$$.firstChild : $JSCompiler_alias_NULL$$
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetButtonImageElement", {$GetButtonImageElement$:$AdfDhtmlTogglePeer$$.prototype.$GetButtonImageElement$});
$AdfDhtmlTogglePeer$$.prototype.$getIconURL$ = function $$AdfDhtmlTogglePeer$$$$$getIconURL$$($iconName_rawIcon_state$$94$$) {
  $iconName_rawIcon_state$$94$$ = $AdfPage$$.$PAGE$.$getLocaleContext$().$isRightToLeft$() ? $iconName_rawIcon_state$$94$$ ? this.$rtlToggledIconName$ : this.$rtlUntoggledIconName$ : $iconName_rawIcon_state$$94$$ ? this.$ltrToggledIconName$ : this.$ltrUntoggledIconName$;
  return($iconName_rawIcon_state$$94$$ = $AdfPage$$.$PAGE$.$getLookAndFeel$().$getRawIcon$($iconName_rawIcon_state$$94$$)) ? $iconName_rawIcon_state$$94$$.src : $JSCompiler_alias_NULL$$
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.getIconURL", {$getIconURL$:$AdfDhtmlTogglePeer$$.prototype.$getIconURL$});
$AdfDhtmlTogglePeer$$.prototype.$EventPropagatesToServer$ = $JSCompiler_returnArg$$($JSCompiler_alias_TRUE$$);
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.EventPropagatesToServer", {$EventPropagatesToServer$:$AdfDhtmlTogglePeer$$.prototype.$EventPropagatesToServer$});
$AdfDhtmlTogglePeer$$.prototype.$isEventForButton$ = function $$AdfDhtmlTogglePeer$$$$$isEventForButton$$($evtTarget$$10_nativeEvent$$61$$) {
  $evtTarget$$10_nativeEvent$$61$$ = $AdfAgent$$.$AGENT$.$getEventTarget$($evtTarget$$10_nativeEvent$$61$$);
  $evtTarget$$10_nativeEvent$$61$$ = "A" != $evtTarget$$10_nativeEvent$$61$$.tagName ? $evtTarget$$10_nativeEvent$$61$$.parentNode : $evtTarget$$10_nativeEvent$$61$$;
  return $evtTarget$$10_nativeEvent$$61$$ == this.$GetButtonElement$()
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.isEventForButton", {$isEventForButton$:$AdfDhtmlTogglePeer$$.prototype.$isEventForButton$});
$AdfDhtmlTogglePeer$$.prototype.$HandleClientSideToggle$ = function $$AdfDhtmlTogglePeer$$$$$HandleClientSideToggle$$($toggled$$2$$) {
  return this.$UpdateButton$($toggled$$2$$)
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.HandleClientSideToggle", {$HandleClientSideToggle$:$AdfDhtmlTogglePeer$$.prototype.$HandleClientSideToggle$});
$AdfDhtmlTogglePeer$$.prototype.$HandleComponentClick$ = function $$AdfDhtmlTogglePeer$$$$$HandleComponentClick$$($componentEvent$$419$$) {
  if(!$componentEvent$$419$$.$isCanceled$()) {
    var $nativeEvent$$62$$ = $componentEvent$$419$$.$getNativeEvent$();
    if($componentEvent$$419$$.$isLeftButtonPressed$() && this.$isEventForButton$($nativeEvent$$62$$)) {
      var $newToggleState$$inline_4323$$ = !this.$GetPropertyValue$();
      this.$QueueClientEvent$($newToggleState$$inline_4323$$, $JSCompiler_alias_TRUE$$);
      $AdfAgent$$.$AGENT$.preventDefault($nativeEvent$$62$$);
      $componentEvent$$419$$.cancel()
    }
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.HandleComponentClick", {$HandleComponentClick$:$AdfDhtmlTogglePeer$$.prototype.$HandleComponentClick$});
$AdfDhtmlTogglePeer$$.prototype.$HandleComponentKeyUp$ = function $$AdfDhtmlTogglePeer$$$$$HandleComponentKeyUp$$($componentEvent$$420$$) {
  if(!$componentEvent$$420$$.$isCanceled$()) {
    var $nativeEvent$$63$$ = $componentEvent$$420$$.$getNativeEvent$();
    if(this.$isEventForButton$($nativeEvent$$63$$)) {
      var $keyCode$$97$$ = $AdfAgent$$.$AGENT$.$getKeyCode$($nativeEvent$$63$$), $toggled$$3$$ = this.$GetPropertyValue$();
      if($keyCode$$97$$ == $AdfKeyStroke$$.$ARROWUP_KEY$ && !$toggled$$3$$ || $keyCode$$97$$ == $AdfKeyStroke$$.$ARROWDOWN_KEY$ && $toggled$$3$$) {
        this.$QueueClientEvent$(!$toggled$$3$$, $JSCompiler_alias_TRUE$$), $AdfAgent$$.$AGENT$.preventDefault($nativeEvent$$63$$), $componentEvent$$420$$.cancel()
      }
    }
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.HandleComponentKeyUp", {$HandleComponentKeyUp$:$AdfDhtmlTogglePeer$$.prototype.$HandleComponentKeyUp$});
$AdfDhtmlTogglePeer$$.$TogglePropertyChangedImpl$ = function $$AdfDhtmlTogglePeer$$$$TogglePropertyChangedImpl$$($component$$1683$$, $domElement$$496$$, $newValue$$148$$) {
  this.$_inHandlePropertyChange$ || this.$QueueClientEvent$($newValue$$148$$, $JSCompiler_alias_TRUE$$);
  return $JSCompiler_alias_TRUE$$
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.TogglePropertyChangedImpl", $AdfDhtmlTogglePeer$$.$TogglePropertyChangedImpl$);
$AdfDhtmlTogglePeer$$.$HandleToggleEventImpl$ = function $$AdfDhtmlTogglePeer$$$$HandleToggleEventImpl$$($componentEvent$$421$$) {
  var $component$$1684$$ = this.$getComponent$();
  if(!$componentEvent$$421$$.$isCanceled$() && $componentEvent$$421$$.getSource() == $component$$1684$$) {
    this.$_inHandlePropertyChange$ = $JSCompiler_alias_TRUE$$;
    try {
      var $newValue$$149$$ = this.$GetNewValueFromEvent$($componentEvent$$421$$);
      !$componentEvent$$421$$.$propagatesToServer$() && $componentEvent$$421$$.$getDisclosureCounterpart$ != $JSCompiler_alias_NULL$$ && $componentEvent$$421$$.$getDisclosureCounterpart$() == $JSCompiler_alias_NULL$$ ? $component$$1684$$.setProperty(this.propertyName, $newValue$$149$$, $JSCompiler_alias_TRUE$$) : $componentEvent$$421$$.$getDisclosureCounterpart$ == $JSCompiler_alias_NULL$$ && $component$$1684$$.setProperty(this.propertyName, $newValue$$149$$, $JSCompiler_alias_TRUE$$);
      return this.$HandleClientSideToggle$($newValue$$149$$)
    }finally {
      delete this.$_inHandlePropertyChange$
    }
  }
  return $JSCompiler_alias_FALSE$$
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.HandleToggleEventImpl", $AdfDhtmlTogglePeer$$.$HandleToggleEventImpl$);
$AdfDhtmlTogglePeer$$.prototype.$GetNewValueFromEvent$ = function $$AdfDhtmlTogglePeer$$$$$GetNewValueFromEvent$$() {
  return!this.$GetPropertyValue$()
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetNewValueFromEvent", {$GetNewValueFromEvent$:$AdfDhtmlTogglePeer$$.prototype.$GetNewValueFromEvent$});
$AdfDhtmlTogglePeer$$.prototype.$GetPropertyValue$ = function $$AdfDhtmlTogglePeer$$$$$GetPropertyValue$$() {
  return this.$getComponent$().$getProperty$(this.propertyName)
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetPropertyValue", {$GetPropertyValue$:$AdfDhtmlTogglePeer$$.prototype.$GetPropertyValue$});
