B2G/gecko/browser/base/content/sanitizeDialog.js
/**
   * Creates a new tree view suitable for contiguous selection.  If
   * aProtoTreeView is specified, it's used as the new view's prototype.
   * Otherwise the tree's current view is used as the prototype.
   *
   * @param aProtoTreeView
   *        Used as the new view's prototype if specified
   */
Creates a new tree view suitable for contiguous selection.  If
aProtoTreeView is specified, it's used as the new view's prototype.
Otherwise the tree's current view is used as the prototype.

@param aProtoTreeView
Used as the new view's prototype if specified
Creates a new tree view suitable for contiguous selection . If aProtoTreeView is specified it ' s used as the new view ' s prototype . Otherwise the tree ' s current view is used as the prototype . @param aProtoTreeView Used as the new view ' s prototype if specified
function CSTH__makeTreeView(aProtoTreeView)
  {
    var atomServ = Cc["@mozilla.org/atom-service;1"].
                   getService(Ci.nsIAtomService);
    var view = aProtoTreeView;
    var that = this;
    view.isSeparator = function CSTH_View_isSeparator(aRow)
    {
      return aRow === that.getGrippyRow();
    };
    view.__defineGetter__("_rowCount", view.__lookupGetter__("rowCount"));
    view.__defineGetter__("rowCount",
      function CSTH_View_rowCount()
      {
        return this._rowCount + 1;
      });
    view.canDrop = function CSTH_View_canDrop() { return false; };
    view.cycleHeader = function CSTH_View_cycleHeader() {};
    view.sortingChanged = function CSTH_View_sortingChanged() {};
    view._getCellProperties = view.getCellProperties;
    view.getCellProperties =
      function CSTH_View_getCellProperties(aRow, aCol, aProps)
      {
        var grippyRow = that.getGrippyRow();
        if (aRow === grippyRow)
          aProps.AppendElement(atomServ.getAtom("grippyRow"));
        else if (aRow < grippyRow)
          this._getCellProperties(aRow, aCol, aProps);
        else
          this._getCellProperties(aRow - 1, aCol, aProps);
      };
    view._getRowProperties = view.getRowProperties;
    view.getRowProperties =
      function CSTH_View_getRowProperties(aRow, aProps)
      {
        var grippyRow = that.getGrippyRow();
        if (aRow === grippyRow)
          aProps.AppendElement(atomServ.getAtom("grippyRow"));
        else if (aRow < grippyRow)
          this._getRowProperties(aRow, aProps);
        else
          this._getRowProperties(aRow - 1, aProps);
      };
    view._getCellText = view.getCellText;
    view.getCellText =
      function CSTH_View_getCellText(aRow, aCol)
      {
        var grippyRow = that.getGrippyRow();
        if (aRow === grippyRow)
          return "";
        aRow = aRow < grippyRow ? aRow : aRow - 1;
        return this._getCellText(aRow, aCol);
      };
    view._getImageSrc = view.getImageSrc;
    view.getImageSrc =
      function CSTH_View_getImageSrc(aRow, aCol)
      {
        var grippyRow = that.getGrippyRow();
        if (aRow === grippyRow)
          return "";
        aRow = aRow < grippyRow ? aRow : aRow - 1;
        return this._getImageSrc(aRow, aCol);
      };
    view.isContainer = function CSTH_View_isContainer(aRow) { return false; };
    view.getParentIndex = function CSTH_View_getParentIndex(aRow) { return -1; };
    view.getLevel = function CSTH_View_getLevel(aRow) { return 0; };
    view.hasNextSibling = function CSTH_View_hasNextSibling(aRow, aAfterIndex)
    {
      return aRow < this.rowCount - 1;
    };
    return view;
  }
function CSTH__makeTreeView ( aProtoTreeView ) { var atomServ = Cc [ "@mozilla.org/atom-service;1" ] . getService ( Ci . nsIAtomService ) ; var view = aProtoTreeView ; var that = this ; view . isSeparator = function CSTH_View_isSeparator ( aRow ) { return aRow === that . getGrippyRow ( ) ; } ; view . __defineGetter__ ( "_rowCount" , view . __lookupGetter__ ( "rowCount" ) ) ; view . __defineGetter__ ( "rowCount" , function CSTH_View_rowCount ( ) { return this . _rowCount + 1 ; } ) ; view . canDrop = function CSTH_View_canDrop ( ) { return false ; } ; view . cycleHeader = function CSTH_View_cycleHeader ( ) { } ; view . sortingChanged = function CSTH_View_sortingChanged ( ) { } ; view . _getCellProperties = view . getCellProperties ; view . getCellProperties = function CSTH_View_getCellProperties ( aRow , aCol , aProps ) { var grippyRow = that . getGrippyRow ( ) ; if ( aRow === grippyRow ) aProps . AppendElement ( atomServ . getAtom ( "grippyRow" ) ) ; else if ( aRow < grippyRow ) this . _getCellProperties ( aRow , aCol , aProps ) ; else this . _getCellProperties ( aRow - 1 , aCol , aProps ) ; } ; view . _getRowProperties = view . getRowProperties ; view . getRowProperties = function CSTH_View_getRowProperties ( aRow , aProps ) { var grippyRow = that . getGrippyRow ( ) ; if ( aRow === grippyRow ) aProps . AppendElement ( atomServ . getAtom ( "grippyRow" ) ) ; else if ( aRow < grippyRow ) this . _getRowProperties ( aRow , aProps ) ; else this . _getRowProperties ( aRow - 1 , aProps ) ; } ; view . _getCellText = view . getCellText ; view . getCellText = function CSTH_View_getCellText ( aRow , aCol ) { var grippyRow = that . getGrippyRow ( ) ; if ( aRow === grippyRow ) return "" ; aRow = aRow < grippyRow ? aRow : aRow - 1 ; return this . _getCellText ( aRow , aCol ) ; } ; view . _getImageSrc = view . getImageSrc ; view . getImageSrc = function CSTH_View_getImageSrc ( aRow , aCol ) { var grippyRow = that . getGrippyRow ( ) ; if ( aRow === grippyRow ) return "" ; aRow = aRow < grippyRow ? aRow : aRow - 1 ; return this . _getImageSrc ( aRow , aCol ) ; } ; view . isContainer = function CSTH_View_isContainer ( aRow ) { return false ; } ; view . getParentIndex = function CSTH_View_getParentIndex ( aRow ) { return - 1 ; } ; view . getLevel = function CSTH_View_getLevel ( aRow ) { return 0 ; } ; view . hasNextSibling = function CSTH_View_hasNextSibling ( aRow , aAfterIndex ) { return aRow < this . rowCount - 1 ; } ; return view ; }
Creates a new tree view suitable for contiguous selection.
Creates a new tree view suitable for contiguous selection .
//XXXadw: When Alex gets the grippy icon done, this may or may not change, //        depending on how we style it. // rowCount includes the grippy row. // This has to do with visual feedback in the view itself, e.g., drawing // a small line underneath the dropzone.  Not what we want. // No clicking headers to sort the tree or sort feedback on columns. // Override a bunch of methods to account for the grippy row.