diff chrome/content/options/subpane.xml @ 2:472a16863ecc

expanded nightly.jar
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 02 Dec 2008 20:38:20 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/chrome/content/options/subpane.xml	Tue Dec 02 20:38:20 2008 +0900
@@ -0,0 +1,107 @@
+<?xml version="1.0"?>
+
+<bindings id="SubPaneBindings" xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <binding id="subpane" name="subpane">
+
+    <content preference-editable="true" orient="vertical">
+    </content>
+
+    <implementation>
+    
+      <property name="action">
+        <getter>
+          return this.getAttribute("action");
+        </getter>
+      </property>
+      
+      <property name="_attribute">
+        <getter>
+          if (this.action == "hide")
+          {
+            return "hidden";
+          }
+          else if (this.action == "disable")
+          {
+            return "disabled";
+          }
+          return "";
+        </getter>
+      </property>
+      
+      <property name="_invert">
+        <getter>
+        <![CDATA[
+          var invert = false;
+          
+          if (this.action == "hide")
+          {
+            invert=true;
+          }
+          else if (this.action == "disable")
+          {
+            invert=true;
+          }
+          
+          if (this.hasAttribute("invert") && this.getAttribute("invert") == "true")
+            invert=!invert;
+            
+          return invert;
+        ]]>
+        </getter>
+      </property>
+      
+      <field name="_value"/>
+      <property name="value">
+        <setter>
+          if (val == this._value)
+            return val;
+
+          this._value = val;
+          this._updateElements(val);
+          
+          return val;
+        </setter>
+        <getter>
+          return this._value;
+        </getter>
+      </property>
+      
+      <method name="_setElementState">
+        <parameter name="element"/>
+        <parameter name="state"/>
+        <body>
+          var attribute = this._attribute;
+          state = this._invert ? !state : state;
+
+          if (attribute in element) 
+            element[attribute] = state;
+          else
+            element.setAttribute(attribute, state);
+        </body>
+      </method>
+      
+      <method name="_updateElements">
+        <parameter name="state"/>
+        <body>
+          if (this.action=="hide")
+          {
+            this.hidden = this._invert ? !state : state;
+          }
+          else
+          {
+            var element = this.firstChild;
+            while (element)
+            {
+              this._setElementState(element,state);
+              element = element.nextSibling;
+            }
+          }
+        </body>
+      </method>
+      
+    </implementation>
+    
+  </binding>
+
+</bindings>
\ No newline at end of file