diff --git a/core/src/site/resources/tags/ajax/head.html b/core/src/site/resources/tags/ajax/head.html index 366ad918f..5a21396c8 100644 --- a/core/src/site/resources/tags/ajax/head.html +++ b/core/src/site/resources/tags/ajax/head.html @@ -28,28 +28,20 @@ Please do not edit it directly.

Description

- accesskey + baseRelativePath false - + /struts/dojo true String - Set the html accesskey attribute on rendered html element + Context relative path of Dojo distribution folder - cssClass + compressed false - + true true String - The css class to use for element - - - cssStyle - false - - true - String - The css style definitions for element ro use + Use compressed version of dojo.js debug @@ -59,238 +51,6 @@ Please do not edit it directly. String Set to true to enable Dojo debug messages - - disabled - false - - true - String - Set the html disabled attribute on rendered html element - - - id - false - - true - String - id for referencing element. For UI and form tags it will be used as HTML id attribute - - - key - false - - true - String - Set the key (name, value, label) for this particular component - - - label - false - - true - String - Label expression used for rendering a element specific label - - - labelposition - false - - true - String - Define label position of form element (top/left) - - - name - false - - true - String - The name to set for element - - - onblur - false - - true - String - Set the html onblur attribute on rendered html element - - - onchange - false - - true - String - Set the html onchange attribute on rendered html element - - - onclick - false - - true - String - Set the html onclick attribute on rendered html element - - - ondblclick - false - - true - String - Set the html ondblclick attribute on rendered html element - - - onfocus - false - - true - String - Set the html onfocus attribute on rendered html element - - - onkeydown - false - - true - String - Set the html onkeydown attribute on rendered html element - - - onkeypress - false - - true - String - Set the html onkeypress attribute on rendered html element - - - onkeyup - false - - true - String - Set the html onkeyup attribute on rendered html element - - - onmousedown - false - - true - String - Set the html onmousedown attribute on rendered html element - - - onmousemove - false - - true - String - Set the html onmousemove attribute on rendered html element - - - onmouseout - false - - true - String - Set the html onmouseout attribute on rendered html element - - - onmouseover - false - - true - String - Set the html onmouseover attribute on rendered html element - - - onmouseup - false - - true - String - Set the html onmouseup attribute on rendered html element - - - onselect - false - - true - String - Set the html onselect attribute on rendered html element - - - required - false - false - true - Boolean - If set to true, the rendered element will indicate that input is required - - - requiredposition - false - - true - String - Define required position of required form element (left|right) - - - tabindex - false - - true - String - Set the html tabindex attribute on rendered html element - - - template - false - - true - String - The template (other than default) to use for rendering the element - - - templateDir - false - - true - String - The template directory. - - - title - false - - true - String - Set the html title attribute on rendered html element - - - tooltip - false - - true - String - Set the tooltip of this particular component - - - tooltipConfig - false - - true - String - Set the tooltip configuration - - - value - false - - true - String - Preset the value of input element. - diff --git a/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java index c4162b32f..a8e499660 100644 --- a/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java +++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java @@ -66,11 +66,14 @@ import com.opensymphony.xwork2.util.ValueStack; */ @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 class Head extends org.apache.struts2.components.Head { 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 class Head extends org.apache.struts2.components.Head { } 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; + } } diff --git a/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java index b273cc3a0..ded6b6145 100644 --- a/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java +++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java @@ -37,6 +37,8 @@ public class HeadTag extends AbstractUITag { 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 @@ public class HeadTag extends AbstractUITag { 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; + } } diff --git a/plugins/dojo/src/main/resources/template/ajax/head.ftl b/plugins/dojo/src/main/resources/template/ajax/head.ftl index aa17e231f..0587a140e 100644 --- a/plugins/dojo/src/main/resources/template/ajax/head.ftl +++ b/plugins/dojo/src/main/resources/template/ajax/head.ftl @@ -1,14 +1,26 @@ - + +<#if parameters.compressed?default(true)> + <#assign dojoFile="dojo.js"> +<#else> + <#assign dojoFile="dojo.js.uncompressed.js"> + + +<#if parameters.baseRelativePath?if_exists != ""> + +<#else> + + + -