AdfRichUIPeer.createPeerClass(AdfDhtmlTablePeer, "AdfDhtmlTreeTablePeer", false);
AdfDhtmlTreeTablePeer.InitSubclass = function() {
  AdfRichUIPeer.addComponentPropertyChanges(this, AdfUITree.DISCLOSED_ROW_KEYS);
  this._NODE_IMAGE_ATTR = "_afrDisImg";
  this._DISCLOSURE_ICON_ID = "di";
  this.NODE_DEPTH_ATTR = "_afrNdDth";
  this.TREE_FLAGS_ATTR = "_afrTrFgs";
  this._COLLAPSED_NODE_KEY = "af_tree.TIP_COLLAPSED_NODE";
  this._EXPANDED_NODE_KEY = "af_tree.TIP_EXPANDED_NODE";
  this._TREE_TABLE_ICON_EXPANDED = "af|treeTable::expanded-icon";
  this._TREE_TABLE_ICON_COLLAPSED = "af|treeTable::collapsed-icon";
  this._TREE_TABLE_ICON_ANIM = "af|treeTable::node-anim-icon";
  this._TREE_TABLE_ICON_LEAF = "af|treeTable::leaf-icon";
  this._TREE_TABLE_ICON_STYLE_EXPANDED = "af|treeTable::expanded-icon-style";
  this._TREE_TABLE_ICON_STYLE_COLLAPSED = "af|treeTable::collapsed-icon-style";
  this._TREE_TABLE_ICON_STYLE_ANIM = "af|treeTable::node-anim-icon-style";
  this._TREE_TABLE_ICON_STYLE_LEAF = "af|treeTable::leaf-icon-style";
  this._TREE_TABLE_ICON_STYLE_SELECTOR = "af|treeTable::selector-icon-style";
  this._NODE_STAMP_COLUMN = "_afrNdCol";
  this._TREE_UP_MARKER = "_afrTreeUp";
  this._CLIENT_ANCESTOR_PATH = "_afrAP";
  this._KEY_PATH_SEPARATOR = "_";
  this._INDENT_PADDING = 16;
  this._DEFAULT_FIRST_VISIBLE = 0;
  this._DEFAULT_VISIBLE_ROWS = 25;
  this._FIRST_VISIBLE_KEY = "_afrFstVbl";
  this._VISIBLE_ROWS_KEY = "_afrVblRws";
  this.READ_ONLY = "_afrReadOnly";
  this._SELECTED_CLASS = "p_AFSelected";
  this.NODE_COLLAPSE_ROW_MARGIN = 5
};
AdfDhtmlTreeTablePeer.prototype.ComponentRemoved = function(component) {
  this._getTreeUtils().removeContextMenuEventListeners(component);
  AdfDhtmlTreeTablePeer.superclass.ComponentRemoved.call(this, component)
};
AdfDhtmlTreeTablePeer.prototype.getNodeStampColumn = function() {
  var columns = this.__getVisibleLeafColumns();
  for(i = 0;i < columns.length;i++) {
    var column = columns[i];
    if(column.getProperty(AdfDhtmlTreeTablePeer._NODE_STAMP_COLUMN)) {
      return column
    }
  }
  return null
};
AdfDhtmlTreeTablePeer.prototype._findRowKeyByIndexPath = function(indexPath) {
  AdfAssert.assertNonEmptyString(indexPath);
  var rowKey = null;
  var dataBody = this.GetDataBody();
  var blocks = dataBody.childNodes;
  for(var i = 0;i < blocks.length && !rowKey;i++) {
    var block = blocks[i];
    var rows = block.rows;
    if(rows) {
      for(var r = 0;r < rows.length && !rowKey;r++) {
        var tr = rows[r];
        if(indexPath == tr.getAttribute("_afrIP")) {
          rowKey = tr.getAttribute(AdfDhtmlTableBasePeer._ROW_KEY)
        }
      }
    }
  }
  return rowKey
};
AdfDhtmlTreeTablePeer.prototype._findIndexPathByRowKey = function(rowKey) {
  AdfAssert.assertNonEmptyString(rowKey);
  var indexPath = null;
  var dataBody = this.GetDataBody();
  var blocks = dataBody.childNodes;
  for(var i = 0;i < blocks.length && !indexPath;i++) {
    var block = blocks[i];
    var rows = block.rows;
    if(rows) {
      for(var r = 0;r < rows.length && !indexPath;r++) {
        var tr = rows[r];
        if(rowKey == tr.getAttribute(AdfDhtmlTableBasePeer._ROW_KEY)) {
          indexPath = tr.getAttribute("_afrIP")
        }
      }
    }
  }
  return indexPath
};
AdfDhtmlTreeTablePeer.prototype.__triggerSortEvent = function(componentEvent, sortOrder) {
  this.queueSortEvent(this._currency, sortOrder)
};
AdfDhtmlTreeTablePeer.prototype.queueSortEvent = function(rowKey, sortOrder) {
  var component = this.getComponent();
  var nodeStampColumn = this.getNodeStampColumn();
  if(null != nodeStampColumn) {
    var sortProperty = nodeStampColumn.getSortProperty();
    if(null != sortProperty) {
      sortProperty += "$afr$" + rowKey;
      (new AdfSortEvent(component, [sortProperty], [sortOrder])).queue()
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.AutoPPRBlockReceived = function(block) {
  var agent = AdfAgent.AGENT;
  var rowDiscState = agent.getAttribute(block, "_autoPPRDiscUpdate", null);
  if(rowDiscState != null) {
    var state = rowDiscState.split(":");
    if(state.length == 2) {
      var image = this._getDisclosureImageFromRowKey(state[1]);
      if(image) {
        var rowInfo = this.FindRowByKey(state[1]);
        var tr = rowInfo ? rowInfo.tr : null;
        switch(state[0]) {
          default:
            break;
          case "exp":
            this._setDisclosureIcon(image, true, tr);
            break;
          case "clp":
            this._setDisclosureIcon(image, false, tr);
            break;
          case "lf":
            this._setLeafIcon(image);
            break
        }
      }
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.SetFirst = function(first) {
  var component = this.getComponent();
  component.setProperty(AdfDhtmlTreeTablePeer._FIRST_VISIBLE_KEY, first, false, true);
  var buddyComponent = this.GetAssociatedComponent();
  if(buddyComponent != null) {
    buddyComponent.setProperty(AdfDhtmlTreeTablePeer._FIRST_VISIBLE_KEY, first, false, true)
  }
};
AdfDhtmlTreeTablePeer.prototype.SetRows = function(rows) {
  var component = this.getComponent();
  component.setProperty(AdfDhtmlTreeTablePeer._VISIBLE_ROWS_KEY, rows, false, true)
};
AdfDhtmlTreeTablePeer.prototype.HandleComponentKeyDown = function(componentEvent) {
  if(this.isDisclosureFetchPending()) {
    return
  }
  var domEvent = componentEvent.getNativeEvent();
  var ctrlDown = domEvent.ctrlKey;
  var shiftDown = domEvent.shiftKey;
  var agent = AdfAgent.AGENT;
  var target = agent.getEventTarget(domEvent);
  var keyCode = domEvent.keyCode;
  var component = this.getComponent();
  var clientId = component.getClientId();
  var treeUtils = this._getTreeUtils();
  switch(keyCode) {
    default:
      AdfDhtmlTreeTablePeer.superclass.HandleComponentKeyDown.call(this, componentEvent);
      break;
    case 54:
      if(!treeUtils.isSelectorPopupVisible() && ctrlDown && shiftDown) {
        var iconId = AdfRichUIPeer.CreateSubId(clientId, AdfTreeUtils._SELECTOR_ICON_ID);
        var icon = AdfAgent.AGENT.getElementById(iconId);
        if(icon) {
          treeUtils.showSelectorPopup();
          agent.eatEvent(domEvent)
        }
      }else {
        AdfDhtmlTreeTablePeer.superclass.HandleComponentKeyDown.call(this, componentEvent)
      }
      break;
    case AdfKeyStroke.ARROWDOWN_KEY:
      if(treeUtils.isSelectorPopupVisible()) {
        treeUtils.selectSelectorPopupItem(true)
      }else {
        AdfDhtmlTreeTablePeer.superclass.HandleComponentKeyDown.call(this, componentEvent)
      }
      break;
    case AdfKeyStroke.ARROWUP_KEY:
      if(treeUtils.isSelectorPopupVisible()) {
        treeUtils.selectSelectorPopupItem(false)
      }else {
        AdfDhtmlTreeTablePeer.superclass.HandleComponentKeyDown.call(this, componentEvent)
      }
      break;
    case AdfKeyStroke.ENTER_KEY:
      if(treeUtils.isSelectorPopupVisible()) {
        var selectorRowKey = treeUtils.getSelectorSelectedRowKey();
        if(selectorRowKey) {
          treeUtils.hideSelectorPopup();
          AdfFocusEvent.queue(component, selectorRowKey)
        }
      }else {
        if(this._isDisclosure(target) && !this.BusyAnimating()) {
          this.HandleDisclosure(target)
        }else {
          AdfDhtmlTreeTablePeer.superclass.HandleComponentKeyDown.call(this, componentEvent)
        }
      }
      break
  }
};
AdfDhtmlTreeTablePeer.prototype.HandleComponentMouseDown = function(componentEvent) {
  if(this.isDisclosureFetchPending()) {
    return
  }
  var agent = AdfAgent.AGENT;
  var nativeEvent = componentEvent.getNativeEvent();
  var target = agent.getEventTarget(nativeEvent);
  if(!agent.isLeftButton(nativeEvent)) {
    AdfDhtmlTreeTablePeer.superclass.HandleComponentMouseDown.call(this, componentEvent)
  }else {
    if(this._isDisclosure(target) && !this.BusyAnimating()) {
      this.HandleDisclosure(target)
    }else {
      AdfDhtmlTreeTablePeer.superclass.HandleComponentMouseDown.call(this, componentEvent)
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.HandleDisclosure = function(target) {
  var attrs = this.GetRowKeyAndRow(target, this.getDomElement());
  if(attrs != null) {
    var rowKey = attrs[0];
    var row = attrs[1];
    if(!this.isLeaf(rowKey)) {
      var component = this.getComponent();
      var expanded = component.isPathExpanded(rowKey);
      var image = this._getDisclosureImageFromRowKey(rowKey);
      var laf = AdfPage.PAGE.getLookAndFeel();
      var iconStyleNames = this.GetIconStyleNames(component);
      var styleAnim = laf.getStyleClass(iconStyleNames.anim);
      image.className = styleAnim;
      var imageElem = this._getDisclosureIcon(image);
      if(imageElem) {
        var iconNames = this.GetIconNames(component);
        AdfDomUtils.swapIcon(imageElem, iconNames.anim)
      }
      component.setDisclosedRowKey(rowKey, !expanded);
      if(!this._setRowHeaderFocus(rowKey)) {
        this.UpdateFocusManager(AdfDhtmlTableBasePeer._TABLE_BODY_FOCUS_TYPE, rowKey, row)
      }
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.HandleComponentClick = function(componentEvent) {
  var agent = AdfAgent.AGENT;
  var nativeEvent = componentEvent.getNativeEvent();
  var target = agent.getEventTarget(nativeEvent);
  var treeUtils = this._getTreeUtils();
  var selectorRowKey = null;
  var component = this.getComponent();
  if(treeUtils.getParentWithAttribute(target, AdfTreeUtils.SELECTOR_IMAGE_ATTR, 1)) {
    treeUtils.showSelectorPopup();
    agent.eatEvent(nativeEvent)
  }else {
    if(null != (selectorRowKey = treeUtils.getSelectorItemRowKey(nativeEvent, target))) {
      treeUtils.hideSelectorPopup();
      AdfFocusEvent.queue(component, selectorRowKey)
    }else {
      if(!this._isDisclosure(target)) {
        AdfDhtmlTreeTablePeer.superclass.HandleComponentClick.call(this, componentEvent)
      }
    }
  }
};
AdfDhtmlTreeTablePeer.prototype._setRowHeaderFocus = function(rowKey) {
  var focusSet = false;
  var rowInfo = this.FindRowByKey(rowKey);
  if(rowInfo) {
    var rowHeaderCell = this.GetRowHeaderCellFromRow(rowInfo.tr);
    if(rowHeaderCell) {
      this.UpdateFocusManager(AdfDhtmlTableBasePeer._ROW_HEADER_FOCUS_TYPE, rowKey, rowHeaderCell);
      focusSet = true
    }
  }
  return focusSet
};
AdfDhtmlTreeTablePeer.prototype._setDisclosureIcon = function(element, disclosed, tr) {
  if(element) {
    var laf = AdfPage.PAGE.getLookAndFeel();
    var iconStyleNames = this.GetIconStyleNames(this.getComponent());
    var styleExpanded = laf.getStyleClass(iconStyleNames.expanded);
    var styleCollapsed = laf.getStyleClass(iconStyleNames.collapsed);
    element.className = disclosed ? styleExpanded : styleCollapsed;
    var title = disclosed ? laf.getTranslatedString(AdfDhtmlTreeTablePeer._EXPANDED_NODE_KEY) : laf.getTranslatedString(AdfDhtmlTreeTablePeer._COLLAPSED_NODE_KEY);
    element.title = title;
    var imageElem = this._getDisclosureIcon(element);
    if(imageElem) {
      var iconNames = this.GetIconNames(this.getComponent());
      var iconKey = disclosed ? iconNames.expanded : iconNames.collapsed;
      AdfDomUtils.swapIcon(imageElem, iconKey)
    }
    if(tr) {
      tr.setAttribute("aria-expanded", disclosed ? "true" : "false")
    }
  }
};
AdfDhtmlTreeTablePeer.prototype._setLeafIcon = function(element) {
  if(element) {
    var laf = AdfPage.PAGE.getLookAndFeel();
    var iconStyleNames = this.GetIconStyleNames(this.getComponent());
    var styleLeaf = laf.getStyleClass(iconStyleNames.leaf);
    element.className = styleLeaf;
    element.title = "";
    var imageElem = this._getDisclosureIcon(element);
    if(imageElem) {
      var iconNames = this.GetIconNames(this.getComponent());
      AdfDomUtils.swapIcon(imageElem, iconNames.leaf)
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.ComponentDisclosedRowKeysChanged = function(component, domElement, newValue, oldValue) {
  AdfDhtmlTreeTablePeer.superclass.ComponentDisclosedRowKeysChanged.call(this, component, domElement, newValue, oldValue);
  this._getTreeUtils().setAssociatedDisclosedRowKeys(newValue, oldValue);
  var pcPeer = this.GetPanelCollectionPeer();
  if(pcPeer) {
    pcPeer.updateRowSelectionContext()
  }
  return true
};
AdfDhtmlTreeTablePeer.prototype._getTotalRemovedHeight = function(collapsedItems) {
  var removedHeight = 0;
  for(var key in collapsedItems) {
    var listInfo = this._findChildList(key, false);
    if(listInfo) {
      removedHeight += listInfo.height
    }
  }
  return removedHeight
};
AdfDhtmlTreeTablePeer.prototype.HandleComponentCollapseEvent = function(collapsedItems) {
  var component = this.getComponent();
  if("page" == component.getProperty("scrollPolicy")) {
    AdfPage.PAGE.addPartialTargets(component);
    return
  }
  var isReadOnly = component.getProperty(AdfDhtmlTreeTablePeer.READ_ONLY);
  if(!isReadOnly || this.isHeightAutoSized()) {
    AdfDhtmlTreeTablePeer.superclass.HandleComponentCollapseEvent.call(this, collapsedItems);
    return
  }
  var dataBody = this.GetDataBody();
  var blockList = dataBody.childNodes;
  var numBlocks = blockList.length;
  var scrollTop = this._currentScrollTop;
  var lastBlock = blockList[numBlocks - 1];
  var lastBottom = lastBlock.startPos + lastBlock.cachedHeight - scrollTop;
  var viewportHeight = dataBody.offsetHeight;
  var removedHeight = this._getTotalRemovedHeight(collapsedItems);
  var newLastBottom = lastBottom - removedHeight;
  var doFetch = newLastBottom < viewportHeight && this._canvasHeight > viewportHeight;
  if(doFetch) {
    var deficit = (viewportHeight - newLastBottom) / this._averageRowHeight;
    deficit = Math.ceil(deficit);
    deficit += AdfDhtmlTreeTablePeer.NODE_COLLAPSE_ROW_MARGIN;
    var lastToken = this._findLastTokenAfterCollapse(collapsedItems);
    var evt = this._queueFetchEvent(false, AdfTableDataFetchEvent.COLLAPSE_SUBTYPE);
    if(evt) {
      evt.setFillRows(deficit);
      evt.setLastClientKey(lastToken);
      AdfDhtmlTableBasePeer.SetCursor(this.GetDataBody(), "wait")
    }
  }else {
    var hasListeners = component.getProperty(AdfUITree.DISCLOSURE_LISTENER_KEY) != null;
    var oldState = component.getProperty(AdfUITree.LOCAL_DISCLOSURE_STATE);
    var clientState = {};
    AdfCollections.copyInto(clientState, oldState);
    for(var key in collapsedItems) {
      var info = this.FindRowByKey(key);
      var row = info.tr;
      var rkPath = row.getAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH) + "_" + key;
      if(this._isParentInSet(collapsedItems, rkPath)) {
        continue
      }
      if(!hasListeners) {
        clientState[key] = true
      }
      this._removeChildNodes(key, true)
    }
    component.setProperty(AdfUITree.LOCAL_DISCLOSURE_STATE, clientState, false, AdfUIComponent.PROPAGATE_ALWAYS)
  }
};
AdfDhtmlTreeTablePeer.prototype.HandleComponentExpandEvent = function(collapsedItems) {
  var component = this.getComponent();
  if("page" == component.getProperty("scrollPolicy")) {
    AdfPage.PAGE.addPartialTargets(component);
    return
  }
  AdfDhtmlTreeTablePeer.superclass.HandleComponentExpandEvent.call(this, collapsedItems)
};
AdfDhtmlTreeTablePeer.prototype._removeChildNodes = function(rowKey, animate) {
  var listInfo = this._findChildList(rowKey, false);
  if(listInfo) {
    var totalCount = this.GetRowCount();
    var outerDiv = this.getDomElement();
    var ownerDoc = outerDiv.ownerDocument;
    var totalRemoved = listInfo.end - listInfo.start + 1;
    var node = ownerDoc.createElement("table");
    var rowInfo = this.FindRowByKey(rowKey);
    var startRow = rowInfo.index;
    node.setAttribute("totalRemoved", totalRemoved);
    node.setAttribute("_parentKey", rowKey);
    node.setAttribute("_startRow", startRow, null);
    node.setAttribute("_rowCount", totalCount - totalRemoved, null);
    var page = AdfPage.PAGE;
    var oldAnimate = page.isAnimationEnabled();
    page.setAnimationEnabled(animate);
    this.HandleCollapse(node, startRow, 0);
    page.setAnimationEnabled(oldAnimate)
  }
};
AdfDhtmlTreeTablePeer.prototype.HandleAutoPPRRemove = function(block) {
  var component = this.getComponent();
  var agent = AdfAgent.AGENT;
  var rowKey = agent.getAttribute(block, "_parentKey", null);
  if(rowKey) {
    this._removeChildNodes(rowKey, false)
  }
  return AdfDhtmlTreeTablePeer.superclass.HandleAutoPPRRemove.call(this, block)
};
AdfDhtmlTreeTablePeer.prototype.BeginHandleDataBlocks = function() {
  var component = this.getComponent();
  component.setProperty(AdfUITree.LOCAL_DISCLOSURE_STATE, {}, false, AdfUIComponent.PROPAGATE_ALWAYS)
};
AdfDhtmlTreeTablePeer.prototype._isChildOf = function(parentKey, childKey) {
  return childKey.indexOf(parentKey + "_") != -1
};
AdfDhtmlTreeTablePeer.prototype._isParentInSet = function(keySet, childKey) {
  for(var key in keySet) {
    if(this._isChildOf(key, childKey)) {
      return true
    }
  }
  return false
};
AdfDhtmlTreeTablePeer.prototype._findLastTokenAfterCollapse = function(collapsedItems) {
  var dataBody = this.GetDataBody();
  var blocks = dataBody.childNodes;
  for(var i = blocks.length - 1;i >= 0;i--) {
    var block = blocks[i];
    var rows = block.rows;
    for(var r = rows.length - 1;r >= 0;r--) {
      var tr = rows[r];
      var key = tr.getAttribute(AdfDhtmlTableBasePeer._ROW_KEY);
      var rkPath = tr.getAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH) + "_" + key;
      if(!this._isParentInSet(collapsedItems, rkPath)) {
        return key
      }
    }
  }
  return null
};
AdfDhtmlTreeTablePeer.prototype._isDisclosure = function(target) {
  var laf = AdfPage.PAGE.getLookAndFeel();
  var iconStyleNames = this.GetIconStyleNames(this.getComponent());
  var styleExpanded = laf.getStyleClass(iconStyleNames.expanded);
  var styleAnim = laf.getStyleClass(iconStyleNames.anim);
  var styleCollapsed = laf.getStyleClass(iconStyleNames.collapsed);
  var styleLeaf = laf.getStyleClass(iconStyleNames.leaf);
  var targetClassName = target.className;
  var isDisclosure = targetClassName.indexOf(styleExpanded) >= 0 || targetClassName.indexOf(styleCollapsed) >= 0 || targetClassName.indexOf(styleLeaf) >= 0 || targetClassName.indexOf(styleAnim) >= 0;
  if(isDisclosure) {
    return true
  }
  var parentClassName = target.parentNode.className;
  return parentClassName.indexOf(styleExpanded) >= 0 || parentClassName.indexOf(styleCollapsed) >= 0 || parentClassName.indexOf(styleLeaf) >= 0
};
AdfDhtmlTreeTablePeer.prototype._getDisclosureIcon = function(element) {
  var agent = AdfAgent.getAgent();
  if(element.firstChild != null) {
    var imgChild = element.firstChild;
    var nodeName = agent.getNodeName(imgChild).toLowerCase();
    if(nodeName == "img" || nodeName == "span" || nodeName == "#text") {
      return imgChild
    }
  }
  return null
};
AdfDhtmlTreeTablePeer.prototype.isLeaf = function(rowKey) {
  var row = null;
  var info = this.FindRowByKey(rowKey);
  if(info != null) {
    row = info.tr
  }
  if(null != row) {
    var cell = this._getNodeStampCell(row);
    if(null != cell) {
      var icon = this._getDisclosureIconInCell(cell);
      if(null != icon) {
        var laf = AdfPage.PAGE.getLookAndFeel();
        var iconStyleNames = this.GetIconStyleNames(this.getComponent());
        var styleLeaf = laf.getStyleClass(iconStyleNames.leaf);
        return icon.className.indexOf(styleLeaf) >= 0
      }
    }
  }
  return false
};
AdfDhtmlTreeTablePeer.prototype.isSelectorIconVisible = function() {
  return this._getTreeUtils().isSelectorIconVisible()
};
AdfDhtmlTreeTablePeer.prototype.getDepth = function(rowKey) {
  var agent = AdfAgent.AGENT;
  var depth = -1;
  var discImage = this._getDisclosureImageFromRowKey(rowKey);
  if(discImage) {
    var span = discImage.parentNode;
    if(span.tagName == "SPAN") {
      depth = agent.getIntAttribute(span, AdfDhtmlTreeTablePeer.NODE_DEPTH_ATTR, -1)
    }
  }
  return depth
};
AdfDhtmlTreeTablePeer.prototype.isMultiRoot = function() {
  return this._getTreeUtils().isMultiRoot()
};
AdfDhtmlTreeTablePeer.prototype.hasPathStamp = function() {
  return this._getTreeUtils().hasPathStamp()
};
AdfDhtmlTreeTablePeer.prototype._getNodeStampCell = function(row) {
  var agent = AdfAgent.AGENT;
  var dataBody = this.GetDataBody();
  var colCount = agent.getIntAttribute(dataBody, AdfDhtmlTableBasePeer._COL_COUNT, -1);
  var cells = row.cells;
  colCount = colCount >= 0 ? colCount : cells.length;
  for(var i = 0;i < colCount;i++) {
    var cell = this._lastFrozen >= 0 && i > this._lastFrozen ? this._getInnerTableCell(row, i) : cells[i];
    if(this.IsNodeStampCell(cell)) {
      return cell
    }
  }
  return null
};
AdfDhtmlTreeTablePeer.prototype.IsNodeStampCell = function(cell) {
  return AdfAgent.AGENT.getAttribute(cell, AdfDhtmlTreeTablePeer._NODE_STAMP_COLUMN)
};
AdfDhtmlTreeTablePeer.prototype._getDisclosureIconInCell = function(cell) {
  var agent = AdfAgent.AGENT;
  var spans = cell.getElementsByTagName("SPAN");
  var spanCount = spans.length;
  for(var i = 0;i < spanCount;i++) {
    if(undefined != agent.getAttribute(spans[i], AdfDhtmlTreeTablePeer._NODE_IMAGE_ATTR)) {
      var currentSpan = spans[i];
      var childCount = currentSpan.childNodes.length;
      for(var j = 0;j < childCount;j++) {
        var icon = currentSpan.childNodes[j];
        if(icon.nodeType == 1 && this._isDisclosure(icon)) {
          return icon
        }
      }
    }
  }
  return null
};
AdfDhtmlTreeTablePeer.prototype._getDisclosureImageFromRowKey = function(rowKey) {
  return document.getElementById(this._getDisclosureImageId(rowKey))
};
AdfDhtmlTreeTablePeer.prototype._getDisclosureImageId = function(rowKey) {
  var component = this.getComponent();
  var clientId = component.getClientId();
  var idPrefix = clientId + ":" + rowKey;
  var iconId = AdfRichUIPeer.CreateSubId(idPrefix, AdfDhtmlTreeTablePeer._DISCLOSURE_ICON_ID);
  return iconId
};
AdfDhtmlTreeTablePeer.prototype.GetRowContextMenuId = function(rowKey) {
  var component = this.getComponent();
  var menuId = component.getContextMenuId();
  if(!menuId) {
    var isLeaf = this.isLeaf(rowKey);
    var isExpanded = component.isPathExpanded(rowKey);
    var isMultiRoot = this.isMultiRoot();
    var nodeDepth = this.getDepth(rowKey);
    var treeUtils = this._getTreeUtils();
    var isFocusRow = rowKey == component.getFocusRowKey();
    var defaultContextMenu = treeUtils.setupDefaultRowContextMenu(isLeaf, isExpanded, nodeDepth, isMultiRoot, isFocusRow);
    return defaultContextMenu.getClientId()
  }else {
    return menuId
  }
};
AdfDhtmlTreeTablePeer.prototype.HandleRowContextMenu = function(domEvent, rowKey, row, alignElement, alignHint) {
  this._saveCurrency(rowKey);
  AdfDhtmlTreeTablePeer.superclass.HandleRowContextMenu.call(this, domEvent, rowKey, row, alignElement, alignHint)
};
AdfDhtmlTreeTablePeer.prototype.ContextMenuOpened = function(componentEvent, popup) {
  var component = this.getComponent();
  var currency = this._currency;
  var treeUtils = this._getTreeUtils();
  if(currency) {
    treeUtils.addContextMenuEventListeners();
    var isLeaf = this.isLeaf(currency);
    var isExpanded = component.isPathExpanded(currency);
    var isMultiRoot = this.isMultiRoot();
    var nodeDepth = this.getDepth(currency);
    var isContextMenuSelect = component.getContextMenuSelect();
    var isFocusRow = currency == component.getFocusRowKey();
    treeUtils.updateContextMenu(isLeaf, isExpanded, nodeDepth, isMultiRoot, isContextMenuSelect, isFocusRow)
  }
};
AdfDhtmlTreeTablePeer.prototype.ContextMenuClosed = function(componentEvent, popup) {
  this._getTreeUtils().clearCachedContextMenuItems()
};
AdfDhtmlTreeTablePeer.prototype._saveCurrency = function(currency) {
  this._currency = currency
};
AdfDhtmlTreeTablePeer.prototype._clearCurrency = function() {
  this._currency = null
};
AdfDhtmlTreeTablePeer.prototype.__getCurrency = function() {
  return this._currency
};
AdfDhtmlTreeTablePeer.prototype.showAsTop = function(rowKey) {
  var component = this.getComponent();
  AdfFocusEvent.queue(component, rowKey)
};
AdfDhtmlTreeTablePeer.prototype.goUp = function() {
  var component = this.getComponent();
  AdfFocusEvent.queue(component, AdfDhtmlTreeTablePeer._TREE_UP_MARKER)
};
AdfDhtmlTreeTablePeer.prototype.discloseAll = function(rowKey, expand) {
  var component = this.getComponent();
  AdfDhtmlTableBasePeer.SetCursor(this.GetDataBody(), "wait");
  if(!expand && (!rowKey || rowKey.length == 0)) {
    component.setProperty("scrollTopRowKey", null, true, AdfUIComponent.PROPAGATE_ALWAYS)
  }
  AdfTreeExpandAllEvent.queue(component, rowKey, expand);
  var statusText = AdfPage.PAGE.getLookAndFeel().getTranslatedString("af_table.LABEL_FETCHING");
  this.DisplayStatus(statusText, true)
};
AdfDhtmlTreeTablePeer.prototype.InsertActiveRow = function(message, type) {
  var before = type != "insertAfter";
  var rerender = "";
  if(!this.IsEmpty) {
    blocks = this.GetDataBody().childNodes
  }
  if(blocks && blocks.length > 0) {
    var insertAt = -1;
    var insertLevel = 0;
    var insertRowKey = message["rKey"];
    var anchorKey = message["iKey"];
    var ancestorPath = null;
    if(!anchorKey) {
      if(before) {
        var last = blocks[blocks.length - 1];
        var count = this.GetRowCount();
        if(count != -1 && last.startRow + last.numRows == count) {
          insertAt = count
        }
      }else {
        if(blocks[0].startRow == 0) {
          insertAt = 0
        }
      }
    }else {
      var rowInfo = this.FindRowByKey(anchorKey);
      if(rowInfo) {
        if(type == "insertInside") {
          var image = this._getDisclosureImageFromRowKey(anchorKey);
          if(this.getComponent().isPathExpanded(anchorKey)) {
            insertAt = rowInfo.index + 1;
            insertLevel = this._getNodeStampDepth(anchorKey) + 1;
            var parentPath = rowInfo.tr.getAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH);
            ancestorPath = parentPath ? parentPath + AdfDhtmlTreeTablePeer._KEY_PATH_SEPARATOR + anchorKey : anchorKey;
            if(this.isLeaf(anchorKey)) {
              if(image) {
                this._setDisclosureIcon(image, true, rowInfo.tr)
              }else {
                this._updateDisclosureIconInLeaf(anchorKey, true)
              }
            }
          }else {
            if(image) {
              this._setDisclosureIcon(image, false, rowInfo.tr)
            }
          }
        }else {
          var childCount = 0;
          if(this.getComponent().isPathExpanded(anchorKey)) {
            var listInfo = this._findChildList(anchorKey, false);
            if(listInfo) {
              childCount = listInfo.count
            }
          }
          insertAt = before ? rowInfo.index : rowInfo.index + 1 + childCount;
          insertLevel = this._getNodeStampDepth(anchorKey);
          ancestorPath = rowInfo.tr.getAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH)
        }
      }
    }
    if(insertAt != -1 && this.IsInsertAllowed(insertAt)) {
      var templateRow = this.GetTemplateRow(blocks);
      var tr = this.InsertClonedRow(templateRow, insertAt, insertRowKey);
      if(ancestorPath) {
        tr.setAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH, ancestorPath)
      }
      this._resetTreeRow(tr, insertLevel, insertRowKey);
      this.InsertClonedComponents(templateRow, insertRowKey);
      var result = this.UpdateActiveRow(message);
      rerender = result["rerender"]
    }else {
      rerender = AdfDhtmlTableBasePeer.RERENDER_CONTAINER_CHILDREN
    }
  }else {
    rerender = AdfDhtmlTableBasePeer.RERENDER_CONTAINER
  }
  var update = this.GetActiveRowText(message["rKey"], type);
  return{"rerender":rerender, "updates":update}
};
AdfDhtmlTreeTablePeer.prototype._updateDisclosureIconInLeaf = function(rowKey, disclosed) {
  var row = null;
  var info = this.FindRowByKey(rowKey);
  if(info != null) {
    row = info.tr
  }
  if(null != row) {
    var cell = this._getNodeStampCell(row);
    if(null != cell) {
      var spans = cell.getElementsByTagName("SPAN");
      var spanCount = spans.length;
      var laf = AdfPage.PAGE.getLookAndFeel();
      var iconStyleNames = this.GetIconStyleNames(this.getComponent());
      var styleLeaf = laf.getStyleClass(iconStyleNames.leaf);
      var agent = AdfAgent.AGENT;
      for(var i = 0;i < spanCount;i++) {
        if(undefined != agent.getAttribute(spans[i], AdfDhtmlTreeTablePeer._NODE_IMAGE_ATTR)) {
          var currentSpan = spans[i];
          var childCount = currentSpan.childNodes.length;
          for(var j = 0;j < childCount;j++) {
            var icon = currentSpan.childNodes[j];
            if(icon.className && icon.className.indexOf(styleLeaf) >= 0) {
              currentSpan.removeChild(icon);
              var elem = currentSpan.ownerDocument.createElement("a");
              elem.id = this._getDisclosureImageId(rowKey);
              elem.onclick = "return false";
              elem.href = "#";
              currentSpan.appendChild(elem);
              this._setDisclosureIcon(elem, disclosed, row);
              break
            }
          }
          break
        }
      }
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.RemoveActiveRow = function(message) {
  if(this.IsEmpty) {
    return{"rerender":false, "updates":""}
  }
  var rerender = "";
  var update = "";
  var key = message["rKey"];
  var listInfo = this._findChildList(key, true);
  if(listInfo) {
    var info = this.FindRowByKey(key);
    var ancestorPath = null;
    if(info) {
      var row = info.tr;
      update = this.GetActiveRowText(key, "remove");
      ancestorPath = row.getAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH)
    }
    var count = listInfo.end - listInfo.start + 1;
    var deletedElems = new Array;
    this.DeleteBlock(listInfo.start, count, count, 0, deletedElems);
    for(var i = 0;i < deletedElems.length;i++) {
      AdfPage.PAGE.removeComponentsInSubtree(deletedElems[i])
    }
    if(null != ancestorPath) {
      var parentRow = this._findParentRowByAncestorPath(ancestorPath);
      if(null != parentRow) {
        var rowKey = parentRow.getAttribute(AdfDhtmlTableBasePeer._ROW_KEY);
        listInfo = this._findChildList(rowKey, false);
        if(!listInfo) {
          var image = this._getDisclosureImageFromRowKey(rowKey);
          this._setLeafIcon(image)
        }
      }
    }
  }
  return{"rerender":rerender, "updates":update}
};
AdfDhtmlTreeTablePeer.prototype._findParentRowByAncestorPath = function(ancestorPath) {
  var row = null;
  if(null != ancestorPath) {
    var results = ancestorPath.split(AdfDhtmlTreeTablePeer._KEY_PATH_SEPARATOR);
    var rowKey = results[results.length - 1];
    var rowinfo = this.FindRowByKey(rowKey);
    if(rowinfo) {
      row = rowinfo.tr
    }
  }
  return row
};
AdfDhtmlTreeTablePeer.prototype._getNodeStampDepth = function(rowKey) {
  var agent = AdfAgent.AGENT;
  var row = null;
  var info = this.FindRowByKey(rowKey);
  if(info != null) {
    row = info.tr
  }
  if(null != row) {
    var cell = this._getNodeStampCell(row);
    var spans = cell.getElementsByTagName("SPAN");
    var spanCount = spans.length;
    for(var i = 0;i < spanCount;i++) {
      var depth = agent.getAttribute(spans[i], AdfDhtmlTreeTablePeer.NODE_DEPTH_ATTR, -1);
      if(undefined != depth) {
        return parseInt(depth, 10)
      }
    }
  }
};
AdfDhtmlTreeTablePeer.prototype._resetTreeRow = function(tr, level, rowKey) {
  var agent = AdfAgent.AGENT;
  var treeCell = this._getNodeStampCell(tr);
  var icon = this._getDisclosureIconInCell(treeCell);
  icon.id = this._getDisclosureImageId(rowKey);
  this._setDisclosureIcon(icon, false, tr);
  var span = icon.parentNode;
  if(span.tagName == "SPAN") {
    depth = agent.setAttribute(span, AdfDhtmlTreeTablePeer.NODE_DEPTH_ATTR, level)
  }
  var div = AdfDhtmlTableBasePeer.FindFirstChildByTagName(treeCell, "DIV");
  div.style.paddingLeft = level * AdfDhtmlTreeTablePeer._INDENT_PADDING + "px"
};
AdfDhtmlTreeTablePeer.prototype._findChildList = function(parentKey, includeParent) {
  var info = null;
  var dataBody = this.GetDataBody();
  var blocks = dataBody.childNodes;
  var startIndex = -1;
  var endIndex = -1;
  var withParent = false;
  var done = false;
  var childListHeight = 0;
  var childCount = 0;
  for(var i = 0;i < blocks.length && !done;i++) {
    var block = blocks[i];
    var rows = block.rows;
    for(var r = 0;r < rows.length && !done;r++) {
      var tr = rows[r];
      var key = tr.getAttribute(AdfDhtmlTableBasePeer._ROW_KEY);
      var index = block.startRow + r;
      if(key == parentKey) {
        if(includeParent) {
          startIndex = endIndex = index;
          withParent = true;
          childListHeight += tr.offsetHeight
        }
      }else {
        var ancestorPath = tr.getAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH);
        var matched = false;
        if(ancestorPath) {
          var exp = new RegExp("(^|_)" + parentKey + "(_|$)");
          if(ancestorPath.match(exp)) {
            childListHeight += tr.offsetHeight;
            matched = true;
            endIndex = index;
            if(startIndex == -1) {
              startIndex = index
            }
            childCount++
          }
        }
        if(!matched && startIndex != -1) {
          done = true
        }
      }
    }
  }
  if(startIndex != -1) {
    info = {start:startIndex, end:endIndex, hasParent:withParent, height:childListHeight, count:childCount}
  }
  return info
};
AdfDhtmlTreeTablePeer.prototype.HandleExpand = function(node, size, remainingBlocks) {
  var agent = AdfAgent.AGENT;
  var key = agent.getAttribute(node, "_startKey");
  if(key) {
    var image = this._getDisclosureImageFromRowKey(key);
    var totalInserted = AdfAgent.AGENT.getIntAttribute(node, "totalInserted", 0);
    if(totalInserted > 0) {
      var rowInfo = this.FindRowByKey(key);
      if(rowInfo) {
        var start = rowInfo.index + 1;
        this.InsertBlock(node, start, size, totalInserted, remainingBlocks);
        this._setDisclosureIcon(image, true, rowInfo.tr);
        this.UpdateRange(false);
        this._expandBlockToAnimate = node
      }else {
        return false
      }
    }else {
      this._setLeafIcon(image)
    }
  }
  return true
};
AdfDhtmlTreeTablePeer.prototype.BlockInserted = function(block, startRow, numRows) {
  var pcPeer = this.GetPanelCollectionPeer();
  if(pcPeer) {
    pcPeer.updateRowSelectionContext()
  }
};
AdfDhtmlTreeTablePeer.prototype.BlockDeleted = function() {
  var pcPeer = this.GetPanelCollectionPeer();
  if(pcPeer) {
    pcPeer.updateRowSelectionContext()
  }
};
AdfDhtmlTreeTablePeer.prototype.FetchCompleted = function() {
  var expandBlock = this._expandBlockToAnimate;
  this._expandBlockToAnimate = null;
  if(expandBlock != null && !this.IsFetchPending()) {
    var animDuration = 0;
    if(AdfPage.PAGE.isAnimationEnabled() && !this.isHeightAutoSized()) {
      animDuration = this.GetDisclosureAnimationDuration()
    }
    if(animDuration > 0) {
      this._animateInsertedBlock(expandBlock, animDuration)
    }else {
      this.AdjustAutoHeight()
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.GetDisclosureAnimationDuration = function() {
  return parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|treeTable-tr-node-disclosure-animation-duration"))
};
AdfDhtmlTreeTablePeer.prototype._animateInsertedBlock = function(newBlock, animDuration) {
  var ownerDoc = newBlock.ownerDocument;
  var wrapper = ownerDoc.createElement("div");
  var wrapperStyle = wrapper.style;
  var finalHeight = newBlock.offsetHeight;
  this.SetAnimating(true);
  wrapperStyle.overflow = "hidden";
  wrapperStyle.position = "relative";
  wrapperStyle.height = "1px";
  newBlock.parentNode.replaceChild(wrapper, newBlock);
  wrapper.appendChild(newBlock);
  this.SetNewBlockScrollLeft(newBlock);
  this._insertDeleteAnimationInEffect = true;
  AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW, animDuration, [{element:wrapper, properties:{"height":finalHeight}}], null, AdfDhtmlTreeTablePeer._insertBlockAnimationComplete, {wrapper:wrapper, peer:this})
};
AdfDhtmlTreeTablePeer._insertBlockAnimationComplete = function(callbackObj) {
  var wrapper = callbackObj.wrapper;
  var peer = callbackObj.peer;
  var newBlock = wrapper.firstChild;
  wrapper.parentNode.replaceChild(newBlock, wrapper);
  peer._insertDeleteAnimationInEffect = false;
  if(peer) {
    peer.SetNewBlockScrollLeft(newBlock);
    peer.SetAnimating(false);
    if(peer.delayedResizeNotify) {
      peer.delayedResizeNotify();
      peer.delayedResizeNotify = null
    }
    peer.AdjustAutoHeight()
  }
};
AdfDhtmlTreeTablePeer.prototype._getFillerDataBlocksFromDeleteBlock = function(node) {
  var blocks = [];
  if(node.tagName == "TABLE") {
    var rows = node.rows;
    var count = rows.length;
    for(var r = 0;r < count;r++) {
      var block;
      var cells = rows[r].cells;
      if(cells.length > 0 && null != (block = AdfDhtmlTableBasePeer.FindFirstChildByTagName(cells[0], "TABLE"))) {
        cells[0].removeChild(block);
        blocks.push(block)
      }
    }
  }
  return blocks
};
AdfDhtmlTreeTablePeer.prototype.HandleCollapse = function(node, start, remainingBlocks) {
  var agent = AdfAgent.AGENT;
  var totalRemoved = agent.getIntAttribute(node, "totalRemoved", 0);
  var parentKey = node.getAttribute("_parentKey");
  var listInfo = null;
  if(parentKey) {
    listInfo = this._findChildList(parentKey, true)
  }
  if(listInfo && listInfo.hasParent) {
    var image = this._getDisclosureImageFromRowKey(parentKey);
    var parentRowInfo = this.FindRowByKey(parentKey);
    this._setDisclosureIcon(image, false, parentRowInfo ? parentRowInfo.tr : null);
    var parentStart = listInfo.start;
    var childStart = parentStart + 1;
    if(childStart > listInfo.end) {
      return false
    }
    var foundCount = listInfo.end - childStart + 1;
    var rowCountDelta = totalRemoved;
    var oldCount = this.GetRowCount();
    var newCount = agent.getIntAttribute(node, "_rowCount", -1);
    if(oldCount != -1 && newCount != -1) {
      rowCountDelta = oldCount - newCount
    }
    var animDuration = 0;
    var deletedElems = null;
    if(AdfPage.PAGE.isAnimationEnabled() && !this.isHeightAutoSized()) {
      animDuration = this.GetDisclosureAnimationDuration()
    }
    if(animDuration > 0) {
      deletedElems = [];
      deletedElems.totalHeight = 0
    }
    this.DeleteBlock(childStart, foundCount, rowCountDelta, remainingBlocks, deletedElems);
    var skipAnimate = foundCount != rowCountDelta;
    if(skipAnimate) {
      var indexShift = start - parentStart;
      if(indexShift != 0) {
        this.ShiftIndex(this.GetDataBody().firstChild, indexShift, true)
      }
      if(!this.IsReceivingActiveEvents()) {
        var dataBody = this.GetDataBody();
        var firstBlock = dataBody.firstChild;
        if(firstBlock.startRow < 0 || firstBlock.startRow == 0 && indexShift < 0) {
          this.RemoveAllBlocks(dataBody)
        }
        if(newCount != -1) {
          var lastBlock = dataBody.lastChild;
          var lastCount = lastBlock.startRow + lastBlock.numRows;
          if(lastCount > newCount || lastCount == newCount && indexShift > 0) {
            this.RemoveAllBlocks(dataBody)
          }
        }
      }
    }else {
      if(animDuration > 0) {
        disclosedRow = this.FindRowByKey(parentKey).tr;
        this._animateDeletedRows(deletedElems, disclosedRow, animDuration)
      }
    }
    var fillBlocks = this._getFillerDataBlocksFromDeleteBlock(node);
    var count = fillBlocks.length;
    for(var b = 0;b < count;b++) {
      var key = agent.getAttribute(fillBlocks[b], "_startKey");
      var rowInfo = this.FindRowByKey(key);
      if(rowInfo) {
        var startRow = rowInfo.index + 1;
        this._handleDataCallback(fillBlocks[b], AdfTableDataFetchEvent.AFTER_KEY_SUBTYPE, true, 0);
        agent.elementsAdded(fillBlocks[b])
      }
    }
    this.UpdateRange(false)
  }
  return true
};
AdfDhtmlTreeTablePeer.prototype._animateDeletedRows = function(deletedElems, parentRow, animDuration) {
  this.SetAnimating(true);
  var ownerDoc = parentRow.ownerDocument;
  var wrapper = ownerDoc.createElement("tr");
  var childDiv = ownerDoc.createElement("div");
  var childDivStyle = childDiv.style;
  childDivStyle.overflow = "hidden";
  childDivStyle.height = deletedElems.totalHeight + "px";
  childDivStyle.position = "relative";
  var childCell = ownerDoc.createElement("td");
  childCell.style.padding = "0px";
  wrapper.appendChild(childCell);
  childCell.appendChild(childDiv);
  childCell.colSpan = parentRow.cells.length;
  var wrapperTbody = null;
  while(deletedElems.length > 0) {
    var elem = deletedElems.pop();
    if(elem.tagName == "TR") {
      if(wrapperTbody == null) {
        var tableElem = ownerDoc.createElement("table");
        tableElem.cellSpacing = tableElem.cellPadding = 0;
        var parentBlock = parentRow.parentNode.parentNode;
        tableElem.style.cssText = parentBlock.style.cssText;
        wrapperTbody = ownerDoc.createElement("tbody");
        tableElem.appendChild(wrapperTbody);
        childDiv.appendChild(tableElem);
        var cells = elem.cells;
        var cellCount = cells.length;
        var targetCells = AdfDomUtils.getFirstChildElement(parentRow.parentNode).cells;
        for(var c = 0;c < cellCount;c++) {
          cells[c].style.width = targetCells[c].style.width
        }
      }
      wrapperTbody.appendChild(elem)
    }else {
      wrapperTbody = null;
      childDiv.appendChild(elem)
    }
  }
  if(parentRow.nextSibling) {
    parentRow.parentNode.insertBefore(wrapper, parentRow.nextSibling)
  }else {
    parentRow.parentNode.appendChild(wrapper)
  }
  var childCount = childDiv.childNodes.length;
  for(var i = 0;i < childCount;i++) {
    this.SetNewBlockScrollLeft(childDiv.childNodes[i])
  }
  this._insertDeleteAnimationInEffect = true;
  AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW, animDuration, [{element:childDiv, properties:{"height":0}}], null, AdfDhtmlTableBasePeer.CollapseAnimationComplete, {wrapper:wrapper, peer:this})
};
AdfDhtmlTreeTablePeer.prototype.HandleTableBodyArrowLeftRight = function(arrowLeft, ctrlKey, shiftKey) {
  AdfDhtmlTreeTablePeer.superclass.HandleTableBodyArrowLeftRight.call(this, arrowLeft, ctrlKey, shiftKey);
  if(ctrlKey && !this.isDisclosureFetchPending() && !this.BusyAnimating()) {
    var lastRowKey = this.GetLastRowKey();
    if(lastRowKey != null) {
      this.scrollToPos(0, -1);
      var component = this.getComponent();
      isLeafNode = this.isLeaf(lastRowKey);
      if(!isLeafNode) {
        component.setDisclosedRowKey(lastRowKey, !arrowLeft)
      }
    }
  }
};
AdfDhtmlTreeTablePeer.prototype.GetIconNames = function(component) {
  var iconNames = {};
  iconNames.expanded = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_EXPANDED;
  iconNames.collapsed = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_COLLAPSED;
  iconNames.anim = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_ANIM;
  iconNames.leaf = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_LEAF;
  return iconNames
};
AdfDhtmlTreeTablePeer.prototype.GetIconStyleNames = function(component) {
  var iconNames = {};
  iconNames.expanded = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_STYLE_EXPANDED;
  iconNames.collapsed = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_STYLE_COLLAPSED;
  iconNames.anim = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_STYLE_ANIM;
  iconNames.leaf = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_STYLE_LEAF;
  iconNames.selector = AdfDhtmlTreeTablePeer._TREE_TABLE_ICON_STYLE_SELECTOR;
  return iconNames
};
AdfDhtmlTreeTablePeer.prototype._getTreeUtils = function() {
  if(!this._treeUtils) {
    this._treeUtils = new AdfTreeUtils(this)
  }
  return this._treeUtils
};
AdfDhtmlTreeTablePeer.prototype.RegisterFirstPropertyChange = function() {
  AdfRichUIPeer.addComponentPropertyChanges(AdfDhtmlTreeTablePeer, AdfDhtmlTreeTablePeer._FIRST_VISIBLE_KEY)
};
AdfDhtmlTreeTablePeer.prototype.GetFirst = function() {
  return this.getComponent().getProperty(AdfDhtmlTreeTablePeer._FIRST_VISIBLE_KEY)
};
AdfDhtmlTreeTablePeer.prototype.GetRows = function() {
  var component = this.getComponent();
  return component.getProperty(AdfDhtmlTreeTablePeer._VISIBLE_ROWS_KEY)
};
AdfDhtmlTreeTablePeer.prototype.Component_afrFstVblChanged = function(component, domElement, newValue, oldValue) {
  AdfPage.PAGE.addPartialTargets(component);
  this.QueueRangeChangeEvent(oldValue, newValue);
  return false
};
AdfDhtmlTreeTablePeer.prototype.GetRowHeaderText = function(td, table) {
  try {
    var rowElement = this.GetRowKeyAndRow(td, table);
    var row = rowElement[1];
    var cell = this._getNodeStampCell(row);
    return cell.textContent
  }catch(err) {
    AdfLogger.LOGGER.fine("Exception while trying to get node stamp text for the active row" + err);
    return""
  }
};
AdfDhtmlTreeTablePeer.prototype.GetActiveDataAnnouncementKey = function(type) {
  return AdfDhtmlTreeTablePeer.msgMap[type] || "AFActiveDataTreeTableRowInsert"
};
AdfDhtmlTreeTablePeer.prototype.GetParentRowNodeText = function(row) {
  try {
    var ancestorPath = row.getAttribute(AdfDhtmlTreeTablePeer._CLIENT_ANCESTOR_PATH);
    var parentRow = this._findParentRowByAncestorPath(ancestorPath);
    var cell = this._getNodeStampCell(parentRow);
    return cell.textContent
  }catch(err) {
    AdfLogger.LOGGER.fine("Exception while trying to get the text for the parent row of the active row" + err);
    return""
  }
};
AdfDhtmlTreeTablePeer.prototype.GetRowText = function(rowKey, table, agent) {
  var text = "";
  try {
    var rowInfo = this.FindRowByKey(rowKey);
    var tr = rowInfo.tr;
    var cells = tr.cells;
    if(this.IsWholeRowRead(table, agent)) {
      var length = cells.length;
      for(var i = 0;i < length;i++) {
        text = text + cells[i].textContent + " "
      }
    }else {
      var cell = this._getNodeStampCell(tr);
      text = cell.textContent
    }
    text = text.trim();
    var parent = this.GetParentRowNodeText(tr);
    if("" === parent) {
      return text
    }else {
      var laf = AdfPage.PAGE.getLookAndFeel();
      var parentMsg = laf.getTranslatedString("AFActiveDataTreeTableParent");
      text = TrFastMessageFormatUtils["format"](parentMsg, parent, text)
    }
    return text
  }catch(err) {
    AdfLogger.LOGGER.fine("Exception while trying to get the node text for the active data row" + err);
    return text
  }
};
AdfDhtmlTreeTablePeer.prototype._handleEnterKey = function(eventTarget, domEvent) {
  var propagate = AdfDhtmlTreeTablePeer.superclass._handleEnterKey.call(this, eventTarget, domEvent);
  if(propagate) {
    var fm = this._focusManager;
    if(fm.objectType == AdfDhtmlTableBasePeer._TABLE_BODY_FOCUS_TYPE) {
      var activeRowKey = this.GetFocusedRowKey();
      if(activeRowKey != null) {
        var agent = AdfAgent.AGENT;
        var target = agent.getEventTarget(domEvent);
        var imageId = this._getDisclosureImageFromRowKey(activeRowKey);
        if(imageId != null) {
          var imageElem = this._getDisclosureIcon(imageId);
          if(imageElem != null) {
            if(AdfDomUtils.isAncestor(target, imageElem)) {
              this.HandleDisclosure(eventTarget);
              return
            }
          }
        }
      }
    }
  }
};
AdfDhtmlTreeTablePeer.msgMap = {"update":"AFActiveDataTreeTableRowUpdate", "remove":"AFActiveDataTreeTableRowDelete"};
