michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: %treeDTD; michael@0: ]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: # contentView is obsolete (see bug 202391) michael@0: michael@0: # builderView is obsolete (see bug 202393) michael@0: michael@0: michael@0: #ifdef XP_MACOSX michael@0: false michael@0: #else michael@0: true michael@0: #endif michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: null michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: -1 michael@0: null michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: true michael@0: 0 michael@0: "" michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0) { michael@0: currentX += cw; michael@0: if (currentX - (cw * aThresh) > adjustedX) michael@0: return col.element; michael@0: } michael@0: } michael@0: michael@0: if (aPos) michael@0: aPos.value = isRTL ? "before" : "after"; michael@0: return columns.pop().element; michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 1000) michael@0: this._incrementalString = key; michael@0: else michael@0: this._incrementalString += key; michael@0: this._lastKeyTime = event.timeStamp; michael@0: michael@0: var length = this._incrementalString.length; michael@0: var incrementalString = this._incrementalString; michael@0: var charIndex = 1; michael@0: while (charIndex < length && incrementalString[charIndex] == incrementalString[charIndex - 1]) michael@0: charIndex++; michael@0: // If all letters in incremental string are same, just try to match the first one michael@0: if (charIndex == length) { michael@0: length = 1; michael@0: incrementalString = incrementalString.substring(0, length); michael@0: } michael@0: michael@0: var keyCol = this.columns.getKeyColumn(); michael@0: var rowCount = this.view.rowCount; michael@0: var start = 1; michael@0: michael@0: var c = this.currentIndex; michael@0: if (length > 1) { michael@0: start = 0; michael@0: if (c < 0) michael@0: c = 0; michael@0: } michael@0: michael@0: for (var i = 0; i < rowCount; i++) { michael@0: var l = (i + start + c) % rowCount; michael@0: var cellText = this.view.getCellText(l, keyCol); michael@0: cellText = cellText.substring(0, length).toLowerCase(); michael@0: if (cellText == incrementalString) michael@0: return l; michael@0: } michael@0: return -1; michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: = this.view.rowCount || !column) michael@0: return false; michael@0: if (column.type != Components.interfaces.nsITreeColumn.TYPE_TEXT || michael@0: column.cycler || !this.view.isEditable(row, column)) michael@0: return false; michael@0: michael@0: // Beyond this point, we are going to edit the cell. michael@0: if (this._editingColumn) michael@0: this.stopEditing(); michael@0: michael@0: var input = this.inputField; michael@0: michael@0: var box = this.treeBoxObject; michael@0: box.ensureCellIsVisible(row, column); michael@0: michael@0: // Get the coordinates of the text inside the cell. michael@0: var textx = {}, texty = {}, textwidth = {}, textheight = {}; michael@0: var coords = box.getCoordsForCellItem(row, column, "text", michael@0: textx, texty, textwidth, textheight); michael@0: michael@0: // Get the coordinates of the cell itself. michael@0: var cellx = {}, cellwidth = {}; michael@0: coords = box.getCoordsForCellItem(row, column, "cell", michael@0: cellx, {}, cellwidth, {}); michael@0: michael@0: // Calculate the top offset of the textbox. michael@0: var style = window.getComputedStyle(input, ""); michael@0: var topadj = parseInt(style.borderTopWidth) + parseInt(style.paddingTop); michael@0: input.top = texty.value - topadj; michael@0: michael@0: // The leftside of the textbox is aligned to the left side of the text michael@0: // in LTR mode, and left side of the cell in RTL mode. michael@0: var left, widthdiff; michael@0: if (style.direction == "rtl") { michael@0: left = cellx.value; michael@0: widthdiff = cellx.value + cellwidth.value - textx.value - textwidth.value; michael@0: } else { michael@0: left = textx.value; michael@0: widthdiff = textx.value - cellx.value; michael@0: } michael@0: michael@0: input.left = left; michael@0: input.height = textheight.value + topadj + michael@0: parseInt(style.borderBottomWidth) + michael@0: parseInt(style.paddingBottom); michael@0: input.width = cellwidth.value - widthdiff; michael@0: input.hidden = false; michael@0: michael@0: input.value = this.view.getCellText(row, column); michael@0: var selectText = function selectText() { michael@0: input.select(); michael@0: input.inputField.focus(); michael@0: } michael@0: setTimeout(selectText, 0); michael@0: michael@0: this._editingRow = row; michael@0: this._editingColumn = column; michael@0: michael@0: this.setAttribute("editing", "true"); michael@0: return true; michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0 ? c > edge : c < edge) { michael@0: if (this.view.selection.isSelected(edge) && this.view.selection.count <= 1) michael@0: return; michael@0: c = edge; michael@0: } michael@0: michael@0: var cellSelType = this._cellSelType; michael@0: if (cellSelType) { michael@0: var column = this.view.selection.currentColumn; michael@0: if (!column) michael@0: return; michael@0: michael@0: while ((offset > 0 ? c <= edge : c >= edge) && !this.view.isSelectable(c, column)) michael@0: c += offset; michael@0: if (offset > 0 ? c > edge : c < edge) michael@0: return; michael@0: } michael@0: michael@0: if (!this._isAccelPressed(event)) michael@0: this.view.selection.timedSelect(c, this._selectDelay); michael@0: else // Ctrl+Up/Down moves the anchor without selecting michael@0: this.currentIndex = c; michael@0: this.treeBoxObject.ensureRowIsVisible(c); michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0) { michael@0: i += p - 1; michael@0: if (c >= i) { michael@0: i = c + p; michael@0: this.treeBoxObject.ensureRowIsVisible(i > edge ? edge : i); michael@0: } michael@0: i = i > edge ? edge : i; michael@0: michael@0: } else { michael@0: if (c <= i) { michael@0: i = c <= p ? 0 : c - p; michael@0: this.treeBoxObject.ensureRowIsVisible(i); michael@0: } michael@0: } michael@0: this.view.selection.timedSelect(i, this._selectDelay); michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0) { michael@0: i += p - 1; michael@0: if (c >= i) { michael@0: i = c + p; michael@0: this.treeBoxObject.ensureRowIsVisible(i > edge ? edge : i); michael@0: } michael@0: // Extend the selection from the existing pivot, if any michael@0: this.view.selection.rangedSelect(-1, i > edge ? edge : i, this._isAccelPressed(event)); michael@0: michael@0: } else { michael@0: michael@0: if (c <= i) { michael@0: i = c <= p ? 0 : c - p; michael@0: this.treeBoxObject.ensureRowIsVisible(i); michael@0: } michael@0: // Extend the selection from the existing pivot, if any michael@0: this.view.selection.rangedSelect(-1, i, this._isAccelPressed(event)); michael@0: } michael@0: michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0) { michael@0: this.currentIndex = this.treeBoxObject.getFirstVisibleRow(); michael@0: } michael@0: if (this._cellSelType && !this.view.selection.currentColumn) { michael@0: var col = this._getNextColumn(this.currentIndex, false); michael@0: this.view.selection.currentColumn = col; michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: if (this._handleEnter(event)) { michael@0: event.stopPropagation(); michael@0: event.preventDefault(); michael@0: } michael@0: michael@0: #ifndef XP_MACOSX michael@0: michael@0: michael@0: michael@0: michael@0: #endif // XP_MACOSX michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: = 0) { michael@0: if (cellSelType && !this.view.isSelectable(parentIndex, currentColumn)) { michael@0: return; michael@0: } michael@0: this.view.selection.select(parentIndex); michael@0: this.treeBoxObject.ensureRowIsVisible(parentIndex); michael@0: event.preventDefault(); michael@0: return; michael@0: } michael@0: } michael@0: } michael@0: michael@0: if (cellSelType) { michael@0: var col = this._getNextColumn(row, true); michael@0: if (col) { michael@0: this.view.selection.currentColumn = col; michael@0: this.treeBoxObject.ensureCellIsVisible(row, col); michael@0: event.preventDefault(); michael@0: } michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0 && michael@0: !event.altKey && !this._isAccelPressed(event) && michael@0: !event.metaKey && !event.ctrlKey) { michael@0: var l = this._keyNavigate(event); michael@0: if (l >= 0) { michael@0: this.view.selection.timedSelect(l, this._selectDelay); michael@0: this.treeBoxObject.ensureRowIsVisible(l); michael@0: } michael@0: event.preventDefault(); michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: if ("_ensureColumnOrder" in this.parentNode) michael@0: this.parentNode._ensureColumnOrder(); michael@0: michael@0: michael@0: michael@0: -1 michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: = 0 && michael@0: b.view.isContainerOpen(row.value)) { michael@0: var parentIndex = b.view.getParentIndex(b.view.selection.currentIndex); michael@0: while (parentIndex >= 0 && parentIndex != row.value) michael@0: parentIndex = b.view.getParentIndex(parentIndex); michael@0: if (parentIndex == row.value) { michael@0: var parentSelectable = true; michael@0: if (this.parentNode._cellSelType) { michael@0: var currentColumn = b.view.selection.currentColumn; michael@0: if (!b.view.isSelectable(parentIndex, currentColumn)) michael@0: parentSelectable = false; michael@0: } michael@0: if (parentSelectable) michael@0: b.view.selection.select(parentIndex); michael@0: } michael@0: } michael@0: this.parentNode.changeOpenState(row.value); michael@0: return; michael@0: } michael@0: michael@0: if (! b.view.selection.single) { michael@0: var augment = this._isAccelPressed(event); michael@0: if (event.shiftKey) { michael@0: b.view.selection.rangedSelect(-1, row.value, augment); michael@0: b.ensureRowIsVisible(row.value); michael@0: return; michael@0: } michael@0: if (augment) { michael@0: b.view.selection.toggleSelect(row.value); michael@0: b.ensureRowIsVisible(row.value); michael@0: b.view.selection.currentIndex = row.value; michael@0: return; michael@0: } michael@0: } michael@0: michael@0: /* We want to deselect all the selected items except what was michael@0: clicked, UNLESS it was a right-click. We have to do this michael@0: in click rather than mousedown so that you can drag a michael@0: selected group of items */ michael@0: michael@0: if (!col.value) return; michael@0: michael@0: // if the last row has changed in between the time we michael@0: // mousedown and the time we click, don't fire the select handler. michael@0: // see bug #92366 michael@0: if (!col.value.cycler && this._lastSelectedRow == row.value && michael@0: col.value.type != Components.interfaces.nsITreeColumn.TYPE_CHECKBOX) { michael@0: michael@0: var cellSelType = this.parentNode._cellSelType; michael@0: if (cellSelType == "text" && obj.value != "text" && obj.value != "image") michael@0: return; michael@0: michael@0: if (cellSelType) { michael@0: if (!col.value.selectable || michael@0: !b.view.isSelectable(row.value, col.value)) { michael@0: return; michael@0: } michael@0: } michael@0: michael@0: b.view.selection.select(row.value); michael@0: b.ensureRowIsVisible(row.value); michael@0: michael@0: if (cellSelType) { michael@0: b.view.selection.currentColumn = col.value; michael@0: } michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: this.parentNode.parentNode._columnsDirty = true; michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0 && sib.parentNode == this.parentNode) michael@0: return sib; michael@0: sib = sib.boxObject.previousSibling; michael@0: } michael@0: return null; michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 0) ++visible; michael@0: michael@0: if (visible > 1) { michael@0: window.addEventListener("mousemove", this._onDragMouseMove, true); michael@0: window.addEventListener("mouseup", this._onDragMouseUp, true); michael@0: document.treecolDragging = this; michael@0: this.mDragGesturing = true; michael@0: this.mStartDragX = event.clientX; michael@0: this.mStartDragY = event.clientY; michael@0: } michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: 2) michael@0: aPopup.removeChild(aPopup.firstChild); michael@0: michael@0: var refChild = aPopup.firstChild; michael@0: michael@0: var tree = this.parentNode.parentNode; michael@0: for (var currCol = tree.columns.getFirstColumn(); currCol; michael@0: currCol = currCol.getNext()) { michael@0: // Construct an entry for each column in the row, unless michael@0: // it is not being shown. michael@0: var currElement = currCol.element; michael@0: if (!currElement.hasAttribute("ignoreincolumnpicker")) { michael@0: var popupChild = document.createElement("menuitem"); michael@0: popupChild.setAttribute("type", "checkbox"); michael@0: var columnName = currElement.getAttribute("display") || michael@0: currElement.getAttribute("label"); michael@0: popupChild.setAttribute("label", columnName); michael@0: popupChild.setAttribute("colindex", currCol.index); michael@0: if (currElement.getAttribute("hidden") != "true") michael@0: popupChild.setAttribute("checked", "true"); michael@0: if (currCol.primary) michael@0: popupChild.setAttribute("disabled", "true"); michael@0: aPopup.insertBefore(popupChild, refChild); michael@0: } michael@0: } michael@0: michael@0: var hidden = !tree.enableColumnDrag; michael@0: const anonids = ["menuseparator", "menuitem"]; michael@0: for (var i = 0; i < anonids.length; i++) { michael@0: var element = document.getAnonymousElementByAttribute(this, "anonid", anonids[i]); michael@0: element.hidden = hidden; michael@0: } michael@0: ]]> michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: michael@0: