struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r522094 - in /struts/struts2/trunk: core/src/site/resources/tags/ajax/ plugins/dojo/src/main/java/org/apache/struts2/dojo/components/ plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/ plugins/dojo/src/main/resources/template/...
Date Sat, 24 Mar 2007 19:10:02 GMT
Author: musachy
Date: Sat Mar 24 12:10:01 2007
New Revision: 522094

URL: http://svn.apache.org/viewvc?view=rev&rev=522094
Log:
WW-1800  
* Add "compressed" and "baseRelativePath" attributes to the head tag on the Dojo plugin
* Ignore inherited tag attributes on head tag

Modified:
    struts/struts2/trunk/core/src/site/resources/tags/ajax/head.html
    struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java
    struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java
    struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/head.ftl
    struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest.java
    struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest-1.txt

Modified: struts/struts2/trunk/core/src/site/resources/tags/ajax/head.html
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/ajax/head.html?view=diff&rev=522094&r1=522093&r2=522094
==============================================================================
--- struts/struts2/trunk/core/src/site/resources/tags/ajax/head.html (original)
+++ struts/struts2/trunk/core/src/site/resources/tags/ajax/head.html Sat Mar 24 12:10:01 2007
@@ -28,28 +28,20 @@
 				<th align="left" valign="top"><h4>Description</h4></th>
 			</tr>
 				<tr>
-					<td align="left" valign="top">accesskey</td>
+					<td align="left" valign="top">baseRelativePath</td>
 					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
+					<td align="left" valign="top">/struts/dojo</td>
 					<td align="left" valign="top">true</td>
 					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html accesskey attribute on rendered html
element</td>
+					<td align="left" valign="top">Context relative path of Dojo distribution folder</td>
 				</tr>
 				<tr>
-					<td align="left" valign="top">cssClass</td>
+					<td align="left" valign="top">compressed</td>
 					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
 					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">The css class to use for element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">cssStyle</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
 					<td align="left" valign="top">true</td>
 					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">The css style definitions for element ro use</td>
+					<td align="left" valign="top">Use compressed version of dojo.js</td>
 				</tr>
 				<tr>
 					<td align="left" valign="top">debug</td>
@@ -58,238 +50,6 @@
 					<td align="left" valign="top">true</td>
 					<td align="left" valign="top">String</td>
 					<td align="left" valign="top">Set to true to enable Dojo debug messages</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">disabled</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html disabled attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">id</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">id for referencing element. For UI and form tags
it will be used as HTML id attribute</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">key</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the key (name, value, label) for this particular
component</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">label</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Label expression used for rendering a element specific
label</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">labelposition</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Define label position of form element (top/left)</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">name</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">The name to set for element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onblur</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top"> Set the html onblur attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onchange</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onchange attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onclick</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onclick attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">ondblclick</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html ondblclick attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onfocus</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onfocus attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onkeydown</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onkeydown attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onkeypress</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onkeypress attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onkeyup</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onkeyup attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onmousedown</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onmousedown attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onmousemove</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onmousemove attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onmouseout</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onmouseout attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onmouseover</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onmouseover attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onmouseup</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onmouseup attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">onselect</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html onselect attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">required</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">Boolean</td>
-					<td align="left" valign="top">If set to true, the rendered element will indicate
that input is required</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">requiredposition</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Define required position of required form element
(left|right)</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">tabindex</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html tabindex attribute on rendered html
element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">template</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">The template (other than default) to use for rendering
the element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">templateDir</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">The template directory.</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">title</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the html title attribute on rendered html element</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">tooltip</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the tooltip of this particular component</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">tooltipConfig</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Set the tooltip configuration</td>
-				</tr>
-				<tr>
-					<td align="left" valign="top">value</td>
-					<td align="left" valign="top">false</td>
-					<td align="left" valign="top"></td>
-					<td align="left" valign="top">true</td>
-					<td align="left" valign="top">String</td>
-					<td align="left" valign="top">Preset the value of input element.</td>
 				</tr>
 		</table>
 		<!-- END SNIPPET: tagattributes -->

Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java?view=diff&rev=522094&r1=522093&r2=522094
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java
(original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java
Sat Mar 24 12:10:01 2007
@@ -66,11 +66,14 @@
  */
 @StrutsTag(name="head", tldBodyContent="empty", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.HeadTag",
     description="Render a chunk of HEAD for your HTML file")
+@StrutsTagSkipInheritance
 public class Head extends org.apache.struts2.components.Head {
     public static final String TEMPLATE = "head";
 
-    private boolean debug;
-
+    private String debug;
+    private String compressed;
+    private String baseRelativePath;
+    
     public Head(ValueStack stack, HttpServletRequest request, HttpServletResponse response)
{
         super(stack, request, response);
     }
@@ -81,8 +84,13 @@
 
     public void evaluateParams() {
         super.evaluateParams();
-
-        addParameter("debug", Boolean.valueOf(debug).toString());
+        
+        if(this.debug != null)
+            addParameter("debug", findValue(this.debug, Boolean.class));
+        if(this.compressed != null)
+            addParameter("compressed", findValue(this.compressed, Boolean.class));
+        if(this.baseRelativePath != null)
+            addParameter("baseRelativePath", findString(this.baseRelativePath));
     }
 
     @Override
@@ -97,11 +105,21 @@
     }
     
     public boolean isDebug() {
-        return debug;
+        return debug != null && Boolean.parseBoolean(debug);
     }
 
     @StrutsTagAttribute(description="Set to true to enable Dojo debug messages", defaultValue="false")
-    public void setDebug(boolean debug) {
+    public void setDebug(String debug) {
         this.debug = debug;
+    }
+
+    @StrutsTagAttribute(description="Use compressed version of dojo.js", defaultValue="true")
+    public void setCompressed(String compressed) {
+        this.compressed = compressed;
+    }
+
+    @StrutsTagAttribute(description="Context relative path of Dojo distribution folder",
defaultValue="/struts/dojo")
+    public void setBaseRelativePath(String baseRelativePath) {
+        this.baseRelativePath = baseRelativePath;
     }
 }

Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java?view=diff&rev=522094&r1=522093&r2=522094
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java
(original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java
Sat Mar 24 12:10:01 2007
@@ -37,6 +37,8 @@
     private static final long serialVersionUID = 6876765769175246030L;
 
     private String debug;
+    private String compressed;
+    private String baseRelativePath;
 
     public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse
res) {
         return new Head(stack, req, res);
@@ -44,12 +46,22 @@
 
     protected void populateParams() {
         super.populateParams();
-        if (debug != null) {
-            ((Head) component).setDebug(Boolean.valueOf(debug).booleanValue());
-        }
+        
+        Head head = (Head) component;
+        head.setDebug(debug);
+        head.setCompressed(compressed);
+        head.setBaseRelativePath(baseRelativePath);
     }
 
     public void setDebug(String debug) {
         this.debug = debug;
+    }
+
+    public void setBaseRelativePath(String baseRelativePath) {
+        this.baseRelativePath = baseRelativePath;
+    }
+
+    public void setCompressed(String compressed) {
+        this.compressed = compressed;
     }
 }

Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/head.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/head.ftl?view=diff&rev=522094&r1=522093&r2=522094
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/head.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/head.ftl Sat Mar 24
12:10:01 2007
@@ -1,14 +1,26 @@
 <script language="JavaScript" type="text/javascript">
     // Dojo configuration
     djConfig = {
-        baseRelativePath: "<@s.url includeParams='none' value='/struts/dojo' includeParams="none"
encode='false'/>",
         isDebug: ${parameters.debug?default(false)?string},
         bindEncoding: "${parameters.encoding}",
         debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with
the includes
     };
 </script>
-<script language="JavaScript" type="text/javascript"
-        src="<@s.url value='/struts/dojo/dojo.js' includeParams='none' encode='false'
 />"></script>
+
+<#if parameters.compressed?default(true)>
+  <#assign dojoFile="dojo.js">
+<#else>
+  <#assign dojoFile="dojo.js.uncompressed.js">
+</#if>        
+
+<#if parameters.baseRelativePath?if_exists != "">
+  <script language="JavaScript" type="text/javascript"
+        src="<@s.url value='${parameters.baseRelativePath}/${dojoFile}' includeParams='none'
encode='false'  />"></script>
+<#else>
+  <script language="JavaScript" type="text/javascript"
+        src="<@s.url value='/struts/dojo/${dojoFile}' includeParams='none' encode='false'
 />"></script>
+</#if>  
+
 <script language="JavaScript" type="text/javascript"
         src="<@s.url value='/struts/ajax/dojoRequire.js' includeParams='none' encode='false'
 />"></script>
 <script language="JavaScript" type="text/javascript"

Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest.java?view=diff&rev=522094&r1=522093&r2=522094
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest.java
(original)
+++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest.java
Sat Mar 24 12:10:01 2007
@@ -34,6 +34,9 @@
         HeadTag tag = new HeadTag();
         tag.setPageContext(pageContext);
         
+        tag.setDebug("true");
+        tag.setCompressed("false");
+        tag.setBaseRelativePath("/path");
         tag.doStartTag();
         tag.doEndTag();
 

Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest-1.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest-1.txt?view=diff&rev=522094&r1=522093&r2=522094
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest-1.txt
(original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest-1.txt
Sat Mar 24 12:10:01 2007
@@ -1,14 +1,13 @@
 <script language="JavaScript" type="text/javascript">
 	// Dojo configuration
 	djConfig={
-		baseRelativePath: "/struts/dojo",
-		isDebug: false,
+		isDebug: true,
 		bindEncoding: "ISO-8859-1",
 		debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
 		};
 </script>
 
-<script language="JavaScript" type="text/javascript" src="/struts/dojo/dojo.js">
+<script language="JavaScript" type="text/javascript" src="/path/dojo.js.uncompressed.js">
 </script>
 
 <script language="JavaScript" type="text/javascript" src="/struts/ajax/dojoRequire.js">



Mime
View raw message