You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2006/10/17 06:39:12 UTC

svn commit: r464802 - in /beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript: ScriptContainer.java ScriptHeader.java javaScript.properties

Author: crogers
Date: Mon Oct 16 21:39:10 2006
New Revision: 464802

URL: http://svn.apache.org/viewvc?view=rev&rev=464802
Log:
Minor clean up...
- removed some javascript properties that are obsolete.
- modified the ScriptHeader tag to ensure it writes out the script include before the netUI.webAppName initialization to avoid warnings that the netUI object has not been created.
- added more detail and cleaned up some javadoc.

Tests: NetUI server BVT (WinXP pass)


Modified:
    beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptContainer.java
    beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java
    beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties

Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptContainer.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptContainer.java?view=diff&rev=464802&r1=464801&r2=464802
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptContainer.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptContainer.java Mon Oct 16 21:39:10 2006
@@ -66,7 +66,7 @@
  * enclose those <netui:...> tags that you want included in the script container.
  * The first <netui:scriptContainer> tag should appear after the JSP's <body> tag.
  * The closing </netui:scriptContainer> tag should appear before the JSP's </body> tag.
- * @example The <netui:scriptContainer> ... </netui:scriptContainer tag set simply
+ * @example The <netui:scriptContainer> ... </netui:scriptContainer> tag set simply
  * encloses other NetUI tags that you want to belong to that script container.
  * The first <netui:scriptContainer> tag should appear after the JSP's <body> tag.
  * The closing </netui:scriptContainer> tag should appear before the JSP's </body> tag.

Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java?view=diff&rev=464802&r1=464801&r2=464802
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java Mon Oct 16 21:39:10 2006
@@ -27,14 +27,45 @@
 import javax.servlet.jsp.JspException;
 
 /**
- * ScriptHeader will write the <script> and JavaScript includes into the HTML <head> tag.
- * @jsptagref.tagdescription ScriptHeader will write the <script> and JavaScript includes into
- * the HTML <head> tag.
+ * ScriptHeader will write the <script> and JavaScript includes into the HTML
+ * <head> tag. It can also be used to write the <script> and JavaScript
+ * includes in the body given a JSP fragment that uses the {@link ScriptContainer}.
+ * @jsptagref.tagdescription ScriptHeader will write the <script> and JavaScript
+ * includes into the HTML <head> tag. It can also be used to write the
+ * <script> and JavaScript includes in the body given a JSP fragment that
+ * uses the {@link ScriptContainer}.
  *
- * <p>This tag is required to be empty. It is also required when using the &lt;netui:tree> element
- * with the attribute runAtClient="true".
+ * <p>This tag is required to be empty. It is also required when using the
+ * &lt;netui:tree> element with the attribute runAtClient="true".
+ *
+ * <p>The &lt;scriptHeader> tag should have a parent &lt;netui:html> or
+ * &lt;netui:scriptContainer> tag.
+ *
+ * @example In this example the &lt;netui:scriptHeader/> tag has a parent
+ * &lt;netui:html> tag.
+ * <pre>    &lt;netui:html>
+ *        &lt;head>
+ *            &lt;title>Page Title&lt;/title>
+ *            &lt;netui:scriptHeader/>
+ *        &lt;/head>
+ *        &lt;netui:body>
+ *            ...
+ * </pre>
+ *
+ * <p>In this example the &lt;netui:scriptHeader/> tag is enclosed in the
+ * &lt;netui:scriptContainer> tag.
+ * <pre>    &lt;netui:body>
+ *        &lt;netui:scriptContainer>
+ *            &lt;netui:scriptHeader/>
+ *            &lt;netui:tree runAtClient="true"
+ *                        dataSource="pageFlow.root"
+ *                        selectionAction="postback"
+ *                        tagId="testTree"/>
+ *            ...
+ *        &lt;/netui:scriptContainer>
+ *    &lt;/netui:body></pre>
  * @netui:tag name="scriptHeader" body-content="empty"
- * description="ScriptHeader will write the &lt;script> and JavaScript includes into the HTML &lt;head> tag."
+ * description="ScriptHeader will write the &lt;script> and JavaScript includes."
  */
 public class ScriptHeader extends AbstractClassicTag
 {
@@ -54,11 +85,7 @@
     {
         IScriptReporter sr = getScriptReporter();
         HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
-
-        // write out the dynamic content
         WriteRenderAppender writer = new WriteRenderAppender(pageContext);
-        ScriptRequestState srs = ScriptRequestState.getScriptRequestState(req);
-        srs.writeFeature(sr, writer, CoreScriptFeature.DYNAMIC_INIT, true, false, new Object[]{req.getContextPath()});
 
         // write out the include
         ScriptTag.State state = new ScriptTag.State();
@@ -67,6 +94,10 @@
         state.src = req.getContextPath() + "/resources/beehive/version1/javascript/netui-tree.js";
         br.doStartTag(writer, state);
         br.doEndTag(writer);
+
+        // write out the dynamic content
+        ScriptRequestState srs = ScriptRequestState.getScriptRequestState(req);
+        srs.writeFeature(sr, writer, CoreScriptFeature.DYNAMIC_INIT, true, false, new Object[]{req.getContextPath()});
 
         return EVAL_BODY_INCLUDE;
     }

Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties?view=diff&rev=464802&r1=464801&r2=464802
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/javaScript.properties Mon Oct 16 21:39:10 2006
@@ -306,44 +306,10 @@
 \   var netui_tagIdNameMap = new Object();\n\
 netui_tagIdNameMap.{0}="{1}"\n
 
-# Define the base NetUI variable for scoping all our JavaScript into it
-defineNetUI=\
-// define the constructor for the NetUI object\n\
-function NetUI() {\n\
-\   this.members = new Object();    // the named object\n\
-}\n\
-\n\
-// create the variable, it will be empty\n\
-var netUI = new NetUI();\n\n
-
-# Script that will create the NetUI variable and put the webApp inside it
-# in addition, we create the initialization code and run it.
-createNetUI=\
-// Create the NetUI variable and put the webapp name into it\n\
-netUI.webAppName = "{0}";\n\
-\n\
-// This method will init the\n\
-NetUI.prototype.init = function()\n\
-'{'\n\
-{1}\n\
-}\n\
-\n\
-netUI.init();\n\n
-
-#create the initialization lines
-createNetUIInitLine=\
-\     // create the {0} object and initialize it.\n\
-\     this.{0} = new {1}();\n\
-\     this.{0}.init();\n\n
-
 #This method will invoke the NetUICommand infrastructure
 netuiAction=\
 return netUI.action(this, ''{0}'');
 
-legacyNetuiAction=\
-return netUI.action(this, "{0}");
-
-
 #initialization code for the tree
 initTree=\
 if (netUI.netUITree == null) '{\n\
@@ -378,7 +344,3 @@
 writeWebAppName=\
 // write out the webapp name\n\
 netUI.webAppName = "{0}";\n
-
-
-
-