click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r769048 - in /incubator/click/trunk/click/examples: src/org/apache/click/examples/page/form/FormProperties.java webapp/form-head.htm
Date Mon, 27 Apr 2009 16:26:23 GMT
Author: sabob
Date: Mon Apr 27 16:26:23 2009
New Revision: 769048

URL: http://svn.apache.org/viewvc?rev=769048&view=rev
Log:
fixed show border demonstration

Modified:
    incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/FormProperties.java
    incubator/click/trunk/click/examples/webapp/form-head.htm

Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/FormProperties.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/FormProperties.java?rev=769048&r1=769047&r2=769048&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/FormProperties.java
(original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/FormProperties.java
Mon Apr 27 16:26:23 2009
@@ -20,18 +20,22 @@
 
 import java.io.Serializable;
 
+import java.util.HashMap;
+import org.apache.click.Context;
 import org.apache.click.control.Checkbox;
 import org.apache.click.control.FieldSet;
 import org.apache.click.control.Form;
 import org.apache.click.control.Select;
 import org.apache.click.control.Submit;
 import org.apache.click.control.TextField;
+import org.apache.click.element.JsScript;
 import org.apache.click.examples.control.InvestmentSelect;
 import org.apache.click.examples.page.BorderPage;
 import org.apache.click.examples.page.HomePage;
 import org.apache.click.extras.control.DateField;
 import org.apache.click.extras.control.EmailField;
 import org.apache.click.extras.control.PageSubmit;
+import org.apache.click.util.HtmlStringBuffer;
 
 /**
  * Provides a example Page to demonstrate Form properties and layout options.
@@ -217,10 +221,14 @@
 
         addControl(optionsForm);
 
-        // Setup showBorders checkbox Javascript using HTML head include and
-        // setting the body onload function.
-        addModel("headInclude", "form-head.htm");
-        addModel("addLoadEvent", "function() { toggleBorders(document.optionsForm.showBorders)
}");
+        // Setup showBorders checkbox Javascript using a JsScript HEAD element
+
+        // First create a JsScript instance for the JavaScript template
+        // '/form-head.htm'
+        JsScript jsScript = new JsScript("/form-head.htm", new HashMap());
+
+        // Then add a JsScript element to the Page HEAD elements
+        getHeadElements().add(jsScript);
     }
 
     // ---------------------------------------------------------- Event Handlers

Modified: incubator/click/trunk/click/examples/webapp/form-head.htm
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/webapp/form-head.htm?rev=769048&r1=769047&r2=769048&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/webapp/form-head.htm (original)
+++ incubator/click/trunk/click/examples/webapp/form-head.htm Mon Apr 27 16:26:23 2009
@@ -17,7 +17,6 @@
    under the License.*#
 -->
 
-<script type="text/javascript">
 function toggleBorders(checkbox) {
   var formTable = document.getElementById("form-form");
   var fieldsTable = document.getElementById("form-fields");
@@ -41,4 +40,5 @@
   }
   document.optionsForm.showBorders.value = checkbox.checked;
 }
-</script>
+
+toggleBorders(document.optionsForm.showBorders);
\ No newline at end of file



Mime
View raw message