Commit 0d72a506 authored by cmanske%netscape.com's avatar cmanske%netscape.com
Browse files

Changes to <tree> usage for lists to conform to new XUL requiring...

Changes to <tree> usage for lists to conform to new XUL requiring <treecolgroup>. b=30511, r=bryner. Table editing xul/js work for bug 20973, r=jfrancis
parent 9436731b
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -87,15 +87,17 @@
            class="AttributesTree inset" 
            flex="1" 
            context="attlistPopup">
            <treecol width="35%"/>
            <treecol width="65%" style="min-width: 30%"/>
            <treecols>
              <treecol flex="35" width="0"/>
              <treecol flex="65" width="0"/>
            </treecols>
            <treehead>
              <treerow>
                <treecell class="treecell-outset-header" value="&tree.attributeHeader.label;"/>
                <treecell class="treecell-outset-header" value="&tree.valueHeader.label;"/>
              </treerow>
            </treehead>
            <treechildren id="HTMLAList"/>
            <treechildren id="HTMLAList" flex="1"/>
          </tree>
          <box orient="vertical">
            <spring class="spacer"/>
@@ -116,15 +118,17 @@
      <!-- ============================================================== -->
        <box flex="1" orient="vertical">
          <tree id="CSSATree" class="AttributesTree inset" flex="1" context="attlistPopup">
            <treecol width="35%"/>
            <treecol width="65%" style="min-width: 30%"/>
            <treecolgroup>
              <treecol flex="35" width="0"/>
              <treecol flex="65" width="0"/>
            </treecolgroup>
            <treehead>
              <treerow>
                <treecell class="treecell-outset-header" value="&tree.attributeHeader.label;"/>
                <treecell class="treecell-outset-header" value="&tree.valueHeader.label;"/>
              </treerow>
            </treehead>
            <treechildren id="CSSAList"/>
            <treechildren id="CSSAList" flex="1"/>
          </tree>
          <box orient="vertical">
            <spring class="spacer"/>
@@ -145,15 +149,17 @@
      <!-- ============================================================== -->
        <box flex="1" orient="vertical">
          <tree id="JSEATree" class="AttributesTree inset" flex="1" context="attlistPopup">
            <treecol width="35%"/>
            <treecol width="65%" style="min-width: 30%"/>
            <treecolgroup>
              <treecol flex="35" width="0"/>
              <treecol flex="65" wdith="0"/>
            </treecolgroup>
            <treehead>
              <treerow>
                <treecell class="treecell-outset-header" value="&tree.attributeHeader.label;"/>
                <treecell class="treecell-outset-header" value="&tree.valueHeader.label;"/>
              </treerow>
            </treehead>
            <treechildren id="JSEAList"/>
            <treechildren id="JSEAList" flex="1"/>
          </tree>
          <box orient="vertical">
            <spring class="spacer"/>
+29 −6
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ function InitPixelOrPercentMenulist(elementForAtt, elementInDoc, attribute, menu
  ClearMenulist(menulist);
  pixelItem = AppendStringToMenulist(menulist, GetString("Pixels"));
  percentItem = AppendStringToMenulist(menulist, GetAppropriatePercentString(elementForAtt, elementInDoc));

//dump("**** InitPixelOrPercentMenulist: pixelItem="+pixelItem+", percentItem="+percentItem+", menulistID="+menulistID+"\n");
  // Search for a "%" character
  percentIndex = size.search(/%/);
  if (percentIndex > 0)
@@ -411,6 +411,7 @@ function ClearMenulist(menulist)
/* These help using a <tree> for simple lists
  Assumes this simple structure:
  <tree>
    <treecolgroup><treecol flex="1"/></treecolgroup>
    <treechildren>
      <treeitem>
        <treerow>
@@ -424,14 +425,23 @@ function AppendStringToTreelistById(tree, stringID)

function AppendStringToTreelist(tree, string)
{
dump("AppendStringToTreelist: string="+string+"\n");
  if (tree)
  {
    var treechildren = tree.firstChild;
    var treecols = tree.firstChild;
    if (!treecols)
    {
      dump("Bad XUL: Must have <treecolgroup> as first child\n");
    }
    var treechildren = treecols.nextSibling;
    if (!treechildren)
    {
      treechildren = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "treechildren");
      if (treechildren)
      {
        treechildren.setAttribute("flex","1");
        tree.appendChild(treechildren);
      }
      else
      {
        dump("Failed to create <treechildren>\n");
@@ -461,9 +471,17 @@ function ClearTreelist(tree)
  if (tree)
  {
    tree.clearItemSelection();
    while (tree.firstChild)
      tree.removeChild(tree.firstChild);
    
    // Skip over the first <treecolgroup> child
    if (tree.firstChild)
    {
      nextChild = tree.firstChild.nextSibling;
      while (nextChild)
      {
        var nextTmp = nextChild.nextSibling;
        tree.removeChild(nextChild);
        nextChild = nextTmp;
      }
    }    
    // Count list items
    tree.setAttribute("length", 0);
  }
@@ -471,8 +489,13 @@ function ClearTreelist(tree)

function GetSelectedTreelistAttribute(tree, attr)
{
  if (tree)
  if (tree && tree.selectedItems && 
      tree.selectedItems[0] && 
      tree.selectedItems[0].firstChild &&
      tree.selectedItems[0].firstChild.firstChild)
  {
    return tree.selectedItems[0].firstChild.firstChild.getAttribute(attr);
  }

  return "";
}
+3 −1
Original line number Diff line number Diff line
@@ -52,7 +52,9 @@
        <spring/>
      </row>
      <row>
        <tree rows="8" class="list" id="DictionaryList" flex="1"/>
        <tree rows="8" class="list" id="DictionaryList" flex="1">
          <treecolgroup><treecol flex="1"/></treecolgroup>
        </tree>
        <box orient="vertical" flex="1">
          <button class="dialog"  id="ReplaceWord" oncommand="ReplaceWord()" value="&ReplaceButton.label;"/>
          <spring class="spacer"/>
+6 −2
Original line number Diff line number Diff line
@@ -70,10 +70,14 @@
      <box id="MoreSection" orient="vertical">
        <spring class="bigspacer"/>
        <text class="label" align="left" value="&NamedAnchorMsg.label;"/>
        <tree rows="4" class="list" id="NamedAnchorList" onselect="SelectNamedAnchor()" onclick="SelectNamedAnchor()"/>
        <tree rows="4" class="list" id="NamedAnchorList" onselect="SelectNamedAnchor()" onclick="SelectNamedAnchor()">
          <treecolgroup><treecol flex="1"/></treecolgroup>
        </tree>
        <spring class="spacer"/>
        <text class="label" align="left" value="&HeadingMsg.label;"/>
        <tree rows="4" class="list" id="HeadingsList" onselect="SelectHeading()" onclick="SelectHeading()"/>
        <tree rows="4" class="list" id="HeadingsList" onselect="SelectHeading()" onclick="SelectHeading()">
          <treecolgroup><treecol flex="1"/></treecolgroup>
        </tree>
        <text class="label" flex="1" value="&HeadingMsg2.label;"/>
      </box>
    </titledbox>
+1 −0
Original line number Diff line number Diff line
@@ -284,6 +284,7 @@ function AddToDictionary()
  if (MisspelledWord != "") {
    spellChecker.AddWordToDictionary(MisspelledWord);
  }
  NextWord();
}

function EditDictionary()
Loading