home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / browser.xpi / bin / chrome / toolkit.jar / content / global / bindings / outliner.xml < prev    next >
Encoding:
Extensible Markup Language  |  2001-08-19  |  23.3 KB  |  646 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings id="outlinerBindings"
  4.    xmlns="http://www.mozilla.org/xbl"
  5.    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  6.   
  7.   <binding id="outliner-base">
  8.     <resources>
  9.       <stylesheet src="chrome://global/content/bindings/outliner.css"/>
  10.       <stylesheet src="chrome://global/skin/outliner.css"/>
  11.     </resources>
  12.   </binding>
  13.  
  14.   <binding id="outliner" extends="chrome://global/content/bindings/outliner.xml#outliner-base">
  15.     <content orient="vertical">
  16.       <xul:hbox class="outliner-columns">
  17.         <children includes="outlinercol|splitter"/>
  18.         <xul:outlinercol class="outliner-columnpicker" fixed="true"/>
  19.       </xul:hbox>
  20.       <xul:outlinerrows class="outliner-rows" flex="1">
  21.         <children/>
  22.       </xul:outlinerrows>
  23.     </content>
  24.     
  25.     <implementation>
  26.       <property name="outlinerBoxObject"
  27.                 onget="return this.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject);"
  28.                 readonly="true"/>
  29.       <property name="currentIndex"
  30.                 onget="return this.outlinerBoxObject.selection.currentIndex;"
  31.                 onset="return this.outlinerBoxObject.selection.currentIndex=val;"/>
  32.       <property name="selectionHead">
  33.         -1
  34.       </property>
  35.       <property name="selectionTail">
  36.         -1
  37.       </property>
  38.       <property name="singleSelection"
  39.                 onget="return this.getAttribute('seltype') == 'single'"
  40.                 readonly="true"/>
  41.     </implementation>
  42.     
  43.     <handlers>
  44.       <handler event="focus" action="this.outlinerBoxObject.focused = true;"/>
  45.       <handler event="blur" action="this.outlinerBoxObject.focused = false;"/>
  46.   
  47.       <handler event="dragenter" action="this.outlinerBoxObject.onDragEnter(event);"/>
  48.       <handler event="dragexit" action="this.outlinerBoxObject.onDragExit(event);"/>
  49.       <handler event="dragover" action="this.outlinerBoxObject.onDragOver(event);"/>
  50.       <handler event="dragdrop" action="this.outlinerBoxObject.onDragDrop(event);"/>
  51.  
  52.       <handler event="keypress" keycode="vk_enter">
  53.         <![CDATA[
  54.          if (this.currentIndex == -1)
  55.            return;
  56.          if (this.outlinerBoxObject.view.isContainer(this.currentIndex))
  57.            this.outlinerBoxObject.view.toggleOpenState(this.currentIndex);
  58.         ]]>
  59.       </handler>
  60.       <handler event="keypress" keycode="vk_return">
  61.         <![CDATA[
  62.          if (this.currentIndex == -1)
  63.            return;
  64.          if (this.outlinerBoxObject.view.isContainer(this.currentIndex))
  65.            this.outlinerBoxObject.view.toggleOpenState(this.currentIndex);
  66.         ]]>
  67.       </handler>
  68.       <handler event="keypress" keycode="vk_left">
  69.         <![CDATA[
  70.          if (this.currentIndex == -1)
  71.            return;
  72.          if (!this.outlinerBoxObject.view.isContainer(this.currentIndex))
  73.            return;
  74.          if (this.outlinerBoxObject.view.isContainerOpen(this.currentIndex))
  75.            this.outlinerBoxObject.view.toggleOpenState(this.currentIndex);
  76.         ]]>
  77.       </handler>
  78.       <handler event="keypress" keycode="vk_right">
  79.         <![CDATA[
  80.          if (this.currentIndex == -1)
  81.            return;
  82.          if (!this.outlinerBoxObject.view.isContainer(this.currentIndex))
  83.            return;
  84.          if (!this.outlinerBoxObject.view.isContainerOpen(this.currentIndex))
  85.            this.outlinerBoxObject.view.toggleOpenState(this.currentIndex);
  86.         ]]>
  87.       </handler>
  88.       <handler event="keypress" keycode="vk_up">
  89.         <![CDATA[
  90.          var c = this.currentIndex;
  91.          if (c == -1 || c == 0)
  92.            return;
  93.          this.selectionHead = -1;
  94.          this.selectionTail = -1;
  95.          this.outlinerBoxObject.selection.timedSelect(c-1, 500);
  96.          this.outlinerBoxObject.ensureRowIsVisible(c-1);
  97.         ]]>
  98.       </handler>
  99.       <handler event="keypress" keycode="vk_down">
  100.         <![CDATA[
  101.          var c = this.currentIndex;
  102.          try { if (c+1 == this.outlinerBoxObject.view.rowCount)
  103.            return;
  104.          } catch (e) {}
  105.          this.selectionHead = -1;
  106.          this.selectionTail = -1;
  107.          this.outlinerBoxObject.selection.timedSelect(c+1, 500);
  108.          this.outlinerBoxObject.ensureRowIsVisible(c+1);
  109.         ]]>
  110.       </handler>
  111.       <handler event="keypress" keycode="vk_up" modifiers="shift">
  112.         <![CDATA[
  113.          if (this.singleSelection)
  114.            return;
  115.          var c = this.currentIndex;
  116.          if (c == -1 || c == 0)
  117.            return;
  118.          if (c == this.selectionTail) {
  119.            if (this.selectionHead < this.selectionTail) {
  120.              this.outlinerBoxObject.selection.toggleSelect(c);
  121.              this.currentIndex = c - 1;
  122.            }
  123.            else {
  124.              this.outlinerBoxObject.selection.toggleSelect(c - 1);
  125.            }
  126.          }
  127.          else {
  128.            this.outlinerBoxObject.selection.clearSelection();
  129.            this.selectionHead = c;
  130.            this.outlinerBoxObject.selection.rangedSelect(c, c - 1, true);
  131.          }
  132.          this.selectionTail = c - 1;
  133.          this.outlinerBoxObject.ensureRowIsVisible(c - 1);
  134.         ]]>
  135.       </handler>
  136.       <handler event="keypress" keycode="vk_down" modifiers="shift">
  137.         <![CDATA[
  138.          if (this.singleSelection)
  139.            return;
  140.          var c = this.currentIndex;
  141.          try { if (c+1 == this.outlinerBoxObject.view.rowCount)
  142.            return;
  143.          } catch (e) {}
  144.          if (c == this.selectionTail) {
  145.            if (this.selectionHead > this.selectionTail) {
  146.              this.outlinerBoxObject.selection.toggleSelect(c);
  147.              this.currentIndex = c + 1;
  148.            }
  149.            else
  150.              this.outlinerBoxObject.selection.toggleSelect(c + 1);
  151.          }
  152.          else {
  153.            this.outlinerBoxObject.selection.clearSelection();
  154.            this.selectionHead = c;
  155.            this.outlinerBoxObject.selection.rangedSelect(c, c + 1, true);
  156.          }
  157.          this.selectionTail = c + 1;
  158.          this.outlinerBoxObject.ensureRowIsVisible(c + 1);
  159.         ]]>
  160.       </handler>
  161.       <handler event="keypress" keycode="vk_up" modifiers="control">
  162.         <![CDATA[
  163.          var c = this.currentIndex;
  164.          if (c == -1 || c == 0)
  165.            return;
  166.          this.currentIndex = c-1;
  167.          this.outlinerBoxObject.ensureRowIsVisible(c-1);
  168.         ]]>
  169.       </handler>
  170.       <handler event="keypress" keycode="vk_down" modifiers="control">
  171.         <![CDATA[
  172.          var c = this.currentIndex;
  173.          try { if (c+1 == this.outlinerBoxObject.view.rowCount)
  174.            return;
  175.          } catch (e) {}
  176.          this.currentIndex = c+1;
  177.          this.outlinerBoxObject.ensureRowIsVisible(c+1);
  178.         ]]>
  179.       </handler>
  180.       <handler event="keypress" keycode="vk_page_up">
  181.         <![CDATA[
  182.          var c = this.currentIndex;
  183.          if (c == 0)
  184.            return;
  185.          this.selectionHead = -1;
  186.          this.selectionTail = -1;
  187.          var f = this.outlinerBoxObject.getFirstVisibleRow();
  188.          var i = 0;
  189.          if (f > 0) {
  190.            var p = this.outlinerBoxObject.getPageCount();
  191.            if (f - p >= 0)
  192.              i = c - p;
  193.            else
  194.              i = c - f;
  195.            this.outlinerBoxObject.scrollByPages(-1);
  196.          }
  197.          this.outlinerBoxObject.selection.timedSelect(i, 500);
  198.         ]]>
  199.       </handler>
  200.       <handler event="keypress" keycode="vk_page_down">
  201.         <![CDATA[
  202.          var c = this.currentIndex;
  203.          var l = this.outlinerBoxObject.view.rowCount - 1;
  204.          if (c == l)
  205.            return;
  206.          this.selectionHead = -1;
  207.          this.selectionTail = -1;
  208.          var f = this.outlinerBoxObject.getFirstVisibleRow();
  209.          var p = this.outlinerBoxObject.getPageCount();
  210.          var i = l;
  211.          var lastTopRowIndex = l - p;
  212.          if (f <= lastTopRowIndex) {
  213.            if (f + p <= lastTopRowIndex)
  214.              i = c + p;
  215.            else
  216.              i = lastTopRowIndex + c - f + 1;
  217.            this.outlinerBoxObject.scrollByPages(1);
  218.          }
  219.          this.outlinerBoxObject.selection.timedSelect(i, 500);
  220.         ]]>
  221.       </handler>
  222.       <handler event="keypress" keycode="vk_page_up" modifiers="shift">
  223.         <![CDATA[
  224.          if (this.singleSelection)
  225.            return;
  226.          var c = this.currentIndex;
  227.          if (c == 0)
  228.            return;
  229.          var f = this.outlinerBoxObject.getFirstVisibleRow();
  230.          var i = 0;
  231.          if (f > 0) {
  232.            var p = this.outlinerBoxObject.getPageCount();
  233.            if (f - p >= 0)
  234.              i = c - p;
  235.            else
  236.              i = c - f;
  237.            this.outlinerBoxObject.scrollByPages(-1);
  238.          }
  239.          if (c == this.selectionTail) {
  240.            if (this.selectionHead < this.selectionTail) {
  241.              if (i < this.selectionHead) {
  242.                this.outlinerBoxObject.selection.clearRange(c, this.selectionHead + 1);
  243.                this.outlinerBoxObject.selection.rangedSelect(this.selectionHead - 1, i, true);
  244.              }
  245.              else {
  246.                this.outlinerBoxObject.selection.clearRange(c, i + 1);
  247.                this.currentIndex = i;
  248.              }
  249.            }
  250.            else
  251.              this.outlinerBoxObject.selection.rangedSelect(c - 1, i, true);
  252.          }
  253.          else {
  254.            this.outlinerBoxObject.selection.clearSelection();
  255.            this.selectionHead = c;
  256.            this.outlinerBoxObject.selection.rangedSelect(c, i, true);
  257.          }
  258.          this.selectionTail = i;
  259.         ]]>
  260.       </handler>
  261.       <handler event="keypress" keycode="vk_page_down" modifiers="shift">
  262.         <![CDATA[
  263.          if (this.singleSelection)
  264.            return;
  265.          var c = this.currentIndex;
  266.          var l = this.outlinerBoxObject.view.rowCount - 1;
  267.          if (c == l)
  268.            return;
  269.          var f = this.outlinerBoxObject.getFirstVisibleRow();
  270.          var p = this.outlinerBoxObject.getPageCount();
  271.          var i = l;
  272.          var lastTopRowIndex = l - p;
  273.          if (f <= lastTopRowIndex) {
  274.            if (f + p <= lastTopRowIndex)
  275.              i = c + p;
  276.            else
  277.              i = lastTopRowIndex + c - f + 1;
  278.            this.outlinerBoxObject.scrollByPages(1);
  279.          }
  280.          if (c == this.selectionTail) {
  281.            if (this.selectionHead > this.selectionTail) {
  282.              if (i > this.selectionHead) {
  283.                this.outlinerBoxObject.selection.clearRange(c, this.selectionHead - 1);
  284.                this.outlinerBoxObject.selection.rangedSelect(this.selectionHead + 1, i, true);
  285.              }
  286.              else {
  287.                this.outlinerBoxObject.selection.clearRange(c, i - 1);
  288.                this.currentIndex = i;
  289.              }
  290.            }
  291.            else
  292.              this.outlinerBoxObject.selection.rangedSelect(c + 1, i, true);
  293.          }
  294.          else {
  295.            this.outlinerBoxObject.selection.clearSelection();
  296.            this.selectionHead = c;
  297.            this.outlinerBoxObject.selection.rangedSelect(c, i, true);
  298.          }
  299.          this.selectionTail = i;
  300.         ]]>
  301.       </handler>
  302.       <handler event="keypress" keycode="vk_page_up" modifiers="control">
  303.         <![CDATA[
  304.          var c = this.currentIndex;
  305.          if (c == 0)
  306.            return;
  307.          var f = this.outlinerBoxObject.getFirstVisibleRow();
  308.          var i = 0;
  309.          if (f > 0) {
  310.            var p = this.outlinerBoxObject.getPageCount();
  311.            if (f - p >= 0)
  312.              i = c - p;
  313.            else
  314.              i = c - f;
  315.            this.outlinerBoxObject.scrollByPages(-1);
  316.          }
  317.          this.currentIndex = i;
  318.         ]]>
  319.       </handler>
  320.       <handler event="keypress" keycode="vk_page_down" modifiers="control">
  321.         <![CDATA[
  322.          var c = this.currentIndex;
  323.          var l = this.outlinerBoxObject.view.rowCount - 1;
  324.          if (c == l)
  325.            return;
  326.          var f = this.outlinerBoxObject.getFirstVisibleRow();
  327.          var p = this.outlinerBoxObject.getPageCount();
  328.          var i = l;
  329.          var lastTopRowIndex = l - p;
  330.          if (f <= lastTopRowIndex) {
  331.            if (f + p <= lastTopRowIndex)
  332.              i = c + p;
  333.            else
  334.              i = lastTopRowIndex + c - f + 1;
  335.            this.outlinerBoxObject.scrollByPages(1);
  336.          }
  337.          this.currentIndex = i;
  338.         ]]>
  339.       </handler>
  340.       <handler event="keypress" keycode="vk_home">
  341.         <![CDATA[
  342.          if (this.currentIndex == 0)
  343.            return;
  344.          this.selectionHead = -1;
  345.          this.selectionTail = -1;
  346.          this.outlinerBoxObject.selection.timedSelect(0, 500);
  347.          this.outlinerBoxObject.ensureRowIsVisible(0);
  348.         ]]>
  349.       </handler>
  350.       <handler event="keypress" keycode="vk_end">
  351.         <![CDATA[
  352.          var l = this.outlinerBoxObject.view.rowCount - 1;
  353.          if (this.currentIndex == l)
  354.            return;
  355.          this.selectionHead = -1;
  356.          this.selectionTail = -1;
  357.          this.outlinerBoxObject.selection.timedSelect(l, 500);
  358.          this.outlinerBoxObject.ensureRowIsVisible(l);
  359.         ]]>
  360.       </handler>
  361.       <handler event="keypress" keycode="vk_home" modifiers="shift">
  362.         <![CDATA[
  363.          if (this.singleSelection)
  364.            return;
  365.          var c = this.currentIndex;
  366.          if (c == 0)
  367.            return;
  368.          if (c != this.selectionTail) {
  369.            this.outlinerBoxObject.selection.clearSelection();
  370.            this.selectionHead = c;
  371.          }
  372.          this.outlinerBoxObject.selection.rangedSelect(c, 0, true);
  373.          this.selectionTail = 0;
  374.          this.outlinerBoxObject.ensureRowIsVisible(0);
  375.         ]]>
  376.       </handler>
  377.       <handler event="keypress" keycode="vk_end" modifiers="shift">
  378.         <![CDATA[
  379.          if (this.singleSelection)
  380.            return;
  381.          var c = this.currentIndex;
  382.          var l = this.outlinerBoxObject.view.rowCount - 1;
  383.          if (c == l)
  384.            return;
  385.          if (c != this.selectionTail) {
  386.            this.outlinerBoxObject.selection.clearSelection();
  387.            this.selectionHead = c;
  388.          }
  389.          this.outlinerBoxObject.selection.rangedSelect(c, l, true);
  390.          this.selectionTail = l;
  391.          this.outlinerBoxObject.ensureRowIsVisible(l);
  392.         ]]>
  393.       </handler>
  394.       <handler event="keypress" keycode="vk_home" modifiers="control">
  395.         <![CDATA[
  396.          if (this.currentIndex == 0)
  397.            return;
  398.          this.currentIndex = 0;
  399.          this.outlinerBoxObject.ensureRowIsVisible(0);
  400.         ]]>
  401.       </handler>
  402.       <handler event="keypress" keycode="vk_end" modifiers="control">
  403.         <![CDATA[
  404.          var l = this.outlinerBoxObject.view.rowCount - 1;
  405.          if (this.currentIndex == l)
  406.            return;
  407.          this.currentIndex = l;
  408.          this.outlinerBoxObject.ensureRowIsVisible(l);
  409.         ]]>
  410.       </handler>
  411.       <handler event="keypress">
  412.         <![CDATA[
  413.          if (event.keyCode == ' ') {
  414.            var c = this.currentIndex;
  415.            if (!this.outlinerBoxObject.selection.isSelected(c))
  416.              this.outlinerBoxObject.selection.toggleSelect(c);
  417.          }
  418.          ]]>
  419.       </handler>
  420.     </handlers>    
  421.   </binding>
  422.  
  423.   <binding id="outlinerrows" extends="chrome://global/content/bindings/outliner.xml#outliner-base">
  424.     <resources>
  425.       <stylesheet src="chrome://global/content/bindings/outliner.css"/>
  426.       <stylesheet src="chrome://global/skin/outliner.css"/>
  427.     </resources>
  428.  
  429.     <content>
  430.       <xul:hbox flex="1" class="outliner-bodybox">
  431.         <children/>
  432.       </xul:hbox>
  433.       <xul:scrollbar orient="vertical" class="outliner-scrollbar"/>
  434.     </content>
  435.   </binding>
  436.  
  437.   <binding id="outlinerbody" extends="chrome://global/content/bindings/outliner.xml#outliner-base">
  438.     <implementation>
  439.       <property name="_lastSelectedRow">
  440.         -1
  441.       </property>
  442.     </implementation>
  443.     <handlers>
  444.       <!-- If there is no modifier key, we select on mousedown, not
  445.            click, so that drags work correctly. -->
  446.       <handler event="mousedown">
  447.       <![CDATA[
  448.          if (!event.ctrlKey && !event.shiftKey && !event.metaKey) {
  449.            var row = {};
  450.            var col = {};
  451.            var obj = {};
  452.            var b = this.parentNode.outlinerBoxObject;
  453.            b.getCellAt(event.clientX, event.clientY, row, col, obj);
  454.  
  455.            // save off the last selected row
  456.            this._lastSelectedRow = row.value;
  457.  
  458.            try {
  459.              if (row.value >= b.view.rowCount) return;
  460.            } catch (e) { return; }
  461.             
  462.            if (obj.value != "twisty") {
  463.              var column = document.getElementById(col.value);
  464.              var cycler = column.getAttribute('cycler') == 'true';
  465.  
  466.              if (cycler)
  467.                b.view.cycleCell(row.value, col.value);
  468.              else
  469.                if (!b.selection.isSelected(row.value))
  470.                  b.selection.select(row.value);
  471.            }
  472.          }
  473.       ]]>
  474.       </handler>
  475.  
  476.       <!-- On a click (up+down on the same item), deselect everything
  477.            except this item. -->
  478.       <handler event="click">
  479.       <![CDATA[
  480.          if (event.button != 0) return;
  481.          var row = {};
  482.          var col = {};
  483.          var obj = {};
  484.          var b = this.parentNode.outlinerBoxObject;
  485.          b.getCellAt(event.clientX, event.clientY, row, col, obj);
  486.  
  487.          try {
  488.            if (row.value >= b.view.rowCount) return;
  489.          } catch (e) { return; }
  490.  
  491.          if (obj.value == "twisty") {
  492.            b.view.toggleOpenState(row.value);
  493.            return;
  494.          }
  495.  
  496.          var augment = event.ctrlKey || event.metaKey;
  497.          if (event.shiftKey)
  498.            b.selection.rangedSelect(-1, row.value, augment);
  499.          else if (augment) {
  500.            b.selection.toggleSelect(row.value);
  501.            b.selection.currentIndex = row.value;
  502.          }
  503.          else {
  504.           /* We want to deselect all the selected items except what was
  505.             clicked, UNLESS it was a right-click.  We have to do this
  506.             in click rather than mousedown so that you can drag a
  507.             selected group of items */
  508.  
  509.            var column = document.getElementById(col.value);
  510.            var cycler = column.getAttribute('cycler') == 'true';
  511.  
  512.            // if the last row has changed in between the time we 
  513.            // mousedown and the time we click, don't fire the select handler.
  514.            // see bug #92366
  515.            if (!cycler && this._lastSelectedRow == row.value)
  516.              b.selection.select(row.value);  
  517.          }
  518.       ]]>
  519.       </handler>
  520.  
  521.       <!-- double-click -->
  522.       <handler event="click" clickcount="2">
  523.       <![CDATA[
  524.            var row = {};
  525.            var col = {};
  526.            var obj = {};
  527.            var b = this.parentNode.outlinerBoxObject;
  528.            b.getCellAt(event.clientX, event.clientY, row, col, obj);
  529.  
  530.            try {
  531.              if (row.value >= b.view.rowCount) return;
  532.            } catch (e) { return; }
  533.            var column = document.getElementById(col.value);
  534.            var cycler = column.getAttribute('cycler') == 'true';
  535.  
  536.            if (!cycler && obj.value != "twisty" && b.view.isContainer(row.value))
  537.              b.view.toggleOpenState(row.value);
  538.       ]]>
  539.       </handler>
  540.     </handlers>
  541.   </binding>
  542.  
  543.   <binding id="outlinercol" extends="chrome://global/content/bindings/outliner.xml#outliner-base">
  544.     <content>
  545.       <xul:hbox class="outlinercol-box" flex="1" align="center">
  546.         <xul:image class="outliner-image" inherits="src"/>
  547.         <xul:text class="outlinercol-text" inherits="crop,value=label" flex="1" crop="right"/>
  548.         <xul:image class="outlinercol-sortdirection"/>
  549.       </xul:hbox>
  550.     </content>
  551.     <handlers>
  552.       <handler event="click" button="0" action="if (event.originalTarget == this) { this.parentNode.outlinerBoxObject.view.cycleHeader(this.id, this); }"/>
  553.     </handlers>
  554.   </binding>
  555.  
  556.   <binding id="outlinercol-image" extends="chrome://global/content/bindings/outliner.xml#outliner-base">
  557.     <content>
  558.       <xul:hbox class="outlinercol-image-box" flex="1" align="center">
  559.         <xul:image class="outlinercol-icon" inherits="src"/>
  560.       </xul:hbox>
  561.     </content>
  562.     <handlers>
  563.       <handler event="click" button="0" action="this.parentNode.outlinerBoxObject.view.cycleHeader(this.id, this)"/>
  564.     </handlers>
  565.   </binding>
  566.  
  567.   <binding id="columnpicker" extends="chrome://global/content/bindings/outliner.xml#outliner-base">
  568.     <content>
  569.       <xul:menu class="outliner-colpicker-menu" align="center" allowevents="true">
  570.         <xul:image class="outliner-colpicker-icon"/>
  571.         <xul:menupopup popupanchor="bottomright" popupalign="topright"
  572.                   onpopupshowing="this.parentNode.parentNode.buildPopup(this);"/>
  573.       </xul:menu>
  574.     </content>
  575.     
  576.     <implementation>
  577.        <method name="buildPopup">
  578.          <parameter name="aPopup"/>
  579.          <body>
  580.            <![CDATA[
  581.              var currCol = this.parentNode.parentNode.firstChild;
  582.  
  583.              // we no longer cache the picker content.  
  584.              // remove the old content
  585.              while (aPopup.childNodes.length) {
  586.                aPopup.removeChild(aPopup.childNodes[0]);
  587.              }
  588.  
  589.  
  590.              while (currCol) {
  591.                while (currCol && currCol.localName != "outlinercol")
  592.                  currCol = currCol.nextSibling;
  593.  
  594.                if (currCol && (currCol != this)) {
  595.                  // Construct an entry for each cell in the row, unless
  596.                  // it is not being show
  597.                  if (currCol.getAttribute("ignoreincolumnpicker") != "true") {
  598.                      var columnName = currCol.getAttribute("label");
  599.                      var popupChild = document.createElement("menuitem");
  600.                      popupChild.setAttribute("type", "checkbox");
  601.                      if (columnName == "") {
  602.                        var display = currCol.getAttribute("display");
  603.                        popupChild.setAttribute("label", display);
  604.                      }
  605.                      else {
  606.                        popupChild.setAttribute("label", columnName);
  607.                      }
  608.                      popupChild.setAttribute("colid", currCol.id);
  609.                      popupChild.setAttribute("oncommand",
  610.                                              "this.parentNode.parentNode.parentNode.toggleColumnState(this);");
  611.                      if (currCol.getAttribute("hidden") != "true")
  612.                        popupChild.setAttribute("checked", "true");
  613.                      if (currCol.getAttribute("primary") == "true")
  614.                        popupChild.setAttribute("disabled", "true");
  615.  
  616.  
  617.                      aPopup.appendChild(popupChild);
  618.                  }
  619.               } 
  620.               if (currCol) 
  621.                 currCol = currCol.nextSibling;
  622.             }
  623.            ]]>
  624.         </body>
  625.        </method>
  626.        <method name="toggleColumnState">
  627.          <parameter name="aPopup"/>
  628.          <body>
  629.            <![CDATA[
  630.              var colid = aPopup.getAttribute("colid");
  631.              var colNode = document.getElementById(colid);
  632.              if (colNode) {
  633.                var checkedState = aPopup.getAttribute("checked");
  634.                if (checkedState == "true")
  635.                  colNode.removeAttribute("hidden");
  636.                else
  637.                  colNode.setAttribute("hidden", "true");
  638.              }
  639.            ]]>
  640.          </body>
  641.        </method>         
  642.      </implementation>    
  643.    </binding>
  644. </bindings>
  645.  
  646.