[Zope-CVS] CVS: Packages/Moztop/moztop/content/Content - ContentBindings.xml:1.2

Paul Everitt paul@zope.com
Thu, 20 Feb 2003 12:07:09 -0500


Update of /cvs-repository/Packages/Moztop/moztop/content/Content
In directory cvs.zope.org:/tmp/cvs-serv2301/d/Content

Modified Files:
	ContentBindings.xml 
Log Message:
XBL refactored.  We now have a composite widget with child widgets.  
The child widget for listing folder contents has a constructor that 
knows how to attach a datasource and display the folder contents.  Also, 
the composite widget knows how to grab the tabbox parent and add a 
tab.

Next: create some more widgets for edit, preview, properties, security, 
etc.


=== Packages/Moztop/moztop/content/Content/ContentBindings.xml 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/Content/ContentBindings.xml:1.1	Sat Feb 15 05:41:53 2003
+++ Packages/Moztop/moztop/content/Content/ContentBindings.xml	Thu Feb 20 12:06:38 2003
@@ -1,55 +1,119 @@
 <?xml version="1.0" encoding="iso-latin-1"?>
 <bindings xmlns="http://www.mozilla.org/xbl"
 	  xmlns:xbl="http://www.mozilla.org/xbl"
+	  xmlns:html="http://www.w3.org/1999/xhtml"
           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <binding id="sitetabpanel"
-	   extends="xul:tabpanel">
+
+
+
+  <binding id="folderviewerbinding" extends="xul:tabpanel">
     <content>
       <xul:tabbox flex="1">
-	<xul:tabpanels>
-	  <xul:tabpanel flex="1">
 
-	      <iframe src="chrome://moztop/content/Content/getstarted.html" 
-                      flex="1"/>
-	  </xul:tabpanel>
-	  <xul:tabpanel />
-	  <xul:tabpanel />
-	  <xul:tabpanel />
+	<xul:tabs>
+	  <xul:tab label="Contents"/>
+	  <xul:tab oncommand="alert('clicked preview');" label="Preview"/>
+        </xul:tabs>
+
+	<xul:tabpanels>
+	  <xul:foldercontentspanel ref="urn:moztop:sites" flex="1"/>
+	  <xul:foldercontentspanel/>
         </xul:tabpanels>
 
-	<xul:tabs>
-	  <xul:tab label="Contents" />
-	  <xul:tab label="Preview" />
-	  <xul:tab label="Properties" />
-	  <xul:tab label="Manage" />
-	</xul:tabs>
       </xul:tabbox>
+
     </content>
+    <implementation>
+      <field name="urn"/>
+      <field name="resourcetitle"/>
+      <constructor>
+
+	/* Grab the tabbox and add a tab */
+	var folderviewer = document.getAnonymousNodes(this)[0].parentNode;
+	var parent = folderviewer.parentNode.parentNode;
+	var tabs = parent.getElementsByTagName("tabs")[0];
+	var rt = this.getAttribute("resourcetitle");
+
+	var thistab = document.createElement("tab");
+	thistab.setAttribute("label",rt);
+	thistab.setAttribute("id",rt + "-tab");
+	tabs.appendChild(thistab);
+      </constructor>
+    </implementation>
+  </binding>
 
+
+  <binding id="foldercontentspanelbinding" extends="xul:tabpanel">
+    <content>
+      <xul:vbox flex="10">
+<xul:tree flex="10" 
+	  style="width: 20em; height: 10em"
+	  id="foldercontentstree" ref="urn:moztop:sites"
+	  datasources="rdf:null"
+    
+    ondblclick="sitesmanager.openSelectedResource();"
+    containment="http://home.netscape.com/NC-rdf#subitems">
+
+  <xul:treecols>
+    <xul:treecol id="ResourceNameColumn" label="Name" primary="true" flex="1"/>
+    <xul:splitter class="tree-splitter"/>
+    <xul:treecol id="TypeColumn" label="Type" flex="1"/>
+  </xul:treecols>
+
+   <xul:template>
+      <xul:rule>
+        <xul:conditions>
+          <xul:content uri="?uri" />
+          <xul:triple subject="?uri"
+                  predicate="http://home.netscape.com/NC-rdf#subitems"
+                  object="?subitems" />
+          <xul:member container="?subitems" child="?subitem" />
+       </xul:conditions>
+
+        <xul:bindings>
+          <xul:binding subject="?subitem"
+                   predicate="http://www.zope.org/rdf#resourcetype"
+                   object="?resourcetype" />
+          <xul:binding subject="?subitem"
+                   predicate="http://www.purl.org/dc/1.1#title"
+                   object="?name" />
+          <xul:binding subject="?resourcetype"
+                   predicate="http://www.purl.org/dc/1.1#title"
+                   object="?resourcetypetitle"/>
+          <xul:binding subject="?resourcetype"
+                   predicate="http://www.zope.org/rdf#styleid"
+                   object="?styleid"/>
+        </xul:bindings>
+
+        <xul:action>
+            <xul:treechildren flex="1">
+                <xul:treeitem uri="?subitem">
+                    <xul:treerow>
+                        <xul:treecell properties="zope-?styleid" label="?name"/>
+			<xul:treecell label="?resourcetypetitle"/>
+                    </xul:treerow>
+                </xul:treeitem>
+            </xul:treechildren>
+        </xul:action>
+      </xul:rule>
+
+    </xul:template>
+</xul:tree>
+</xul:vbox>
+
+
+
+    </content>
     <implementation>
-      <field name="urn">"No URN"</field>
-      <field name="resourcetitle">"Blank"</field>
-      <property name="tabtitle">
-	<setter>
-   	  // We need to create a tab element first
-	  var thistab = document.createElement("tab");
-	  thistab.setAttribute("label",val);
-	  thistab.setAttribute("id",val + "-tab");
-	  var outter = document.getElementById("active-contents-tabs");
-	  outter.appendChild(thistab);
-
-	  return this.setAttribute("resourcetitle",val);
-        </setter>
-	<getter>
-	  dump("in getter");
-	  return this.resourcetitle;
-	</getter>
-      </property>
-       <constructor>
-	 /* Quite a trick here.  resourcetitle must be set first. */
-	 this.tabtitle = this.getAttribute("resourcetitle");
-       </constructor>
+      <constructor>
+  var tree = document.getAnonymousNodes(this)[0].childNodes[0];
+  dump("\n tree name is " + tree.tagName);
+  tree.database.AddDataSource(sitesmanager.ds.getRawDataSource());
+  tree.database.AddDataSource(sitesmanager.commontypesds.getRawDataSource());
+  tree.builder.rebuild();
+      </constructor>
     </implementation>
+
   </binding>
 
 </bindings>