You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/08/26 21:18:17 UTC
svn commit: r569863 [3/4] - in /struts/struts2/trunk/plugins/dojo/src:
main/java/org/apache/struts2/dojo/components/
main/java/org/apache/struts2/dojo/views/jsp/ui/
main/resources/template/ajax/ profile/
test/java/org/apache/struts2/dojo/views/jsp/ui/ ...
Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java Sun Aug 26 12:18:15 2007
@@ -1,214 +1,223 @@
-/*
- * $Id: TabbedPanel.java 508575 2007-02-16 20:46:49Z musachy $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.dojo.components;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.struts2.components.ClosingUIBean;
-import org.apache.struts2.views.annotations.StrutsTag;
-import org.apache.struts2.views.annotations.StrutsTagAttribute;
-import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
-
-import com.opensymphony.xwork2.util.ValueStack;
-
-/**
- * <!-- START SNIPPET: javadoc -->
- * The tabbedpanel widget is primarily an AJAX component, where each tab can either be local content or remote
- * content (refreshed each time the user selects that tab).</p>
- * If the useSelectedTabCookie attribute is set to true, the id of the selected tab is saved in a cookie on activation.
- * When coming back to this view, the cookie is read and the tab will be activated again, unless an actual value for the
- * selectedTab attribute is specified.</p>
- * If you want to use the cookie feature, please be sure that you provide a unique id for your tabbedpanel component,
- * since this will also be the identifying name component of the stored cookie.</p>
- * <!-- END SNIPPET: javadoc -->
- *
- * <p/> <b>Examples</b>
- * <p/>
- * <!-- START SNIPPET: exdesc -->
- * The following is an example of a tabbedpanel and panel tag utilizing local and remote content.<p/>
- * <!-- END SNIPPET: exdesc -->
- *
- * <!-- START SNIPPET: example -->
- * <pre>
- * <s:tabbedpanel id="test" >
- * <s:div id="one" label="one" theme="ajax" labelposition="top" >
- * This is the first pane<br/>
- * <s:form>
- * <s:textfield name="tt" label="Test Text"/> <br/>
- * <s:textfield name="tt2" label="Test Text2"/>
- * </s:form>
- * </s:div>
- * <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action" >
- * This is the remote tab
- * </s:div>
- * </s:tabbedpanel>
- * </pre>
- * <!-- END SNIPPET: example -->
- *
- * <!-- START SNIPPET: example2 -->
- * <p>Use notify topics to prevent a tab from being selected</p>
- * <pre>
- * <script type="text/javascript">
- * dojo.event.topic.subscribe("/beforeSelect", function(event, tab, tabContainer){
- * event.cancel = true;
- * });
- * </script>
- *
- * <s:tabbedpanel id="test" beforeSelectTabNotifyTopics="/beforeSelect">
- * <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action" >
- * One Tab
- * </s:div>
- * <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action" >
- * Another tab
- * </s:div>
- * </s:tabbedpanel>
- * </pre>
- * <!-- END SNIPPET: example2 -->
- */
-@StrutsTag(name="tabbedpanel", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TabbedPanelTag", description="Render a tabbedPanel widget.")
-public class TabbedPanel extends ClosingUIBean {
- public static final String TEMPLATE = "tabbedpanel";
- public static final String TEMPLATE_CLOSE = "tabbedpanel-close";
- final private static String COMPONENT_NAME = TabbedPanel.class.getName();
-
- protected String selectedTab;
- protected String closeButton;
- protected String doLayout ;
- protected String templateCssPath;
- protected String beforeSelectTabNotifyTopics;
- protected String afterSelectTabNotifyTopics;
- protected String disabledTabCssClass;
- protected String useSelectedTabCookie;
-
- public TabbedPanel(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
- super(stack, request, response);
- }
-
-
- protected void evaluateExtraParams() {
- super.evaluateExtraParams();
-
- if (selectedTab != null)
- addParameter("selectedTab", findString(selectedTab));
- if (closeButton != null)
- addParameter("closeButton", findString(closeButton));
- addParameter("doLayout", doLayout != null ? findValue(doLayout, Boolean.class) : Boolean.FALSE);
- if (labelPosition != null) {
- //dojo has some weird name for label positions
- if(labelPosition.equalsIgnoreCase("left"))
- labelPosition = "left-h";
- if(labelPosition.equalsIgnoreCase("right"))
- labelPosition = "right-h";
- addParameter("labelPosition", null);
- addParameter("labelPosition", labelPosition);
- }
- if (templateCssPath != null)
- addParameter("templateCssPath", findString(templateCssPath));
- if (beforeSelectTabNotifyTopics!= null)
- addParameter("beforeSelectTabNotifyTopics", findString(beforeSelectTabNotifyTopics));
- if (afterSelectTabNotifyTopics!= null)
- addParameter("afterSelectTabNotifyTopics", findString(afterSelectTabNotifyTopics));
- if (disabledTabCssClass!= null)
- addParameter("disabledTabCssClass", findString(disabledTabCssClass));
- if(useSelectedTabCookie != null) {
- addParameter("useSelectedTabCookie", findString(useSelectedTabCookie));
- }
-
- }
-
- @Override
- @StrutsTagSkipInheritance
- public void setTheme(String theme) {
- super.setTheme(theme);
- }
-
- @Override
- public String getTheme() {
- return "ajax";
- }
-
- public String getDefaultOpenTemplate() {
- return TEMPLATE;
- }
-
- protected String getDefaultTemplate() {
- return TEMPLATE_CLOSE;
- }
-
- public String getComponentName() {
- return COMPONENT_NAME;
- }
-
- @StrutsTagAttribute(description="The id to assign to the component.", required=true)
- public void setId(String id) {
- // This is required to override tld generation attributes to required=true
- super.setId(id);
- }
-
-
- @StrutsTagAttribute(description=" The id of the tab that will be selected by default")
- public void setSelectedTab(String selectedTab) {
- this.selectedTab = selectedTab;
- }
-
- @StrutsTagAttribute(description="Deprecated. Use 'closable' on each div(tab)")
- public void setCloseButton(String closeButton) {
- this.closeButton = closeButton;
- }
-
- @StrutsTagAttribute(description="If doLayout is false, the tab container's height equals the height of the currently selected tab", type="Boolean", defaultValue="false")
- public void setDoLayout(String doLayout) {
- this.doLayout = doLayout;
- }
-
- @StrutsTagAttribute(description="Template css path")
- public void setTemplateCssPath(String templateCssPath) {
- this.templateCssPath = templateCssPath;
- }
-
-
- @StrutsTagAttribute(description="Comma separated list of topics to be published when a tab is clicked on (before it is selected)" +
- "The tab container widget will be passed as the first argument to the topic. The second parameter is the tab widget." +
- "The event can be cancelled setting to 'true' the 'cancel' property " +
- "of the third parameter passed to the topics.")
- public void setBeforeSelectTabNotifyTopics(String selectedTabNotifyTopics) {
- this.beforeSelectTabNotifyTopics = selectedTabNotifyTopics;
- }
-
- @StrutsTagAttribute(description="Comma separated list of topics to be published when a tab is clicked on (after it is selected)." +
- "The tab container widget will be passed as the first argument to the topic. The second parameter is the tab widget.")
- public void setAfterSelectTabNotifyTopics(String afterSelectTabNotifyTopics) {
- this.afterSelectTabNotifyTopics = afterSelectTabNotifyTopics;
- }
-
- @StrutsTagAttribute(description="Css class to be applied to the tab button of disabled tabs", defaultValue="strutsDisabledTab")
- public void setDisabledTabCssClass(String disabledTabCssClass) {
- this.disabledTabCssClass = disabledTabCssClass;
- }
-
- @StrutsTagAttribute(required = false, defaultValue = "false", description = "If set to true, the id of the last selected " +
- "tab will be stored in cookie. If the view is rendered, it will be tried to read this cookie and activate " +
- "the corresponding tab on success, unless overridden by the selectedTab attribute. The cookie name is \"Struts2TabbedPanel_selectedTab_\"+id.")
- public void setUseSelectedTabCookie( String useSelectedTabCookie ) {
- this.useSelectedTabCookie = useSelectedTabCookie;
- }
-}
+/*
+ * $Id: TabbedPanel.java 508575 2007-02-16 20:46:49Z musachy $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dojo.components;
+
+import java.util.Random;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.ClosingUIBean;
+import org.apache.struts2.views.annotations.StrutsTag;
+import org.apache.struts2.views.annotations.StrutsTagAttribute;
+import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * <!-- START SNIPPET: javadoc -->
+ * The tabbedpanel widget is primarily an AJAX component, where each tab can either be local content or remote
+ * content (refreshed each time the user selects that tab).</p>
+ * If the useSelectedTabCookie attribute is set to true, the id of the selected tab is saved in a cookie on activation.
+ * When coming back to this view, the cookie is read and the tab will be activated again, unless an actual value for the
+ * selectedTab attribute is specified.</p>
+ * If you want to use the cookie feature, please be sure that you provide a unique id for your tabbedpanel component,
+ * since this will also be the identifying name component of the stored cookie.</p>
+ * <!-- END SNIPPET: javadoc -->
+ *
+ * <p/> <b>Examples</b>
+ * <p/>
+ * <!-- START SNIPPET: exdesc -->
+ * The following is an example of a tabbedpanel and panel tag utilizing local and remote content.<p/>
+ * <!-- END SNIPPET: exdesc -->
+ *
+ * <!-- START SNIPPET: example -->
+ * <pre>
+ * <s:tabbedpanel id="test" >
+ * <s:div id="one" label="one" theme="ajax" labelposition="top" >
+ * This is the first pane<br/>
+ * <s:form>
+ * <s:textfield name="tt" label="Test Text"/> <br/>
+ * <s:textfield name="tt2" label="Test Text2"/>
+ * </s:form>
+ * </s:div>
+ * <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action" >
+ * This is the remote tab
+ * </s:div>
+ * </s:tabbedpanel>
+ * </pre>
+ * <!-- END SNIPPET: example -->
+ *
+ * <!-- START SNIPPET: example2 -->
+ * <p>Use notify topics to prevent a tab from being selected</p>
+ * <pre>
+ * <script type="text/javascript">
+ * dojo.event.topic.subscribe("/beforeSelect", function(event, tab, tabContainer){
+ * event.cancel = true;
+ * });
+ * </script>
+ *
+ * <s:tabbedpanel id="test" beforeSelectTabNotifyTopics="/beforeSelect">
+ * <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action" >
+ * One Tab
+ * </s:div>
+ * <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action" >
+ * Another tab
+ * </s:div>
+ * </s:tabbedpanel>
+ * </pre>
+ * <!-- END SNIPPET: example2 -->
+ */
+@StrutsTag(name="tabbedpanel", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TabbedPanelTag", description="Render a tabbedPanel widget.")
+public class TabbedPanel extends ClosingUIBean {
+ public static final String TEMPLATE = "tabbedpanel";
+ public static final String TEMPLATE_CLOSE = "tabbedpanel-close";
+ final private static String COMPONENT_NAME = TabbedPanel.class.getName();
+
+ protected String selectedTab;
+ protected String closeButton;
+ protected String doLayout ;
+ protected String templateCssPath;
+ protected String beforeSelectTabNotifyTopics;
+ protected String afterSelectTabNotifyTopics;
+ protected String disabledTabCssClass;
+ protected String useSelectedTabCookie;
+
+ public TabbedPanel(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
+ super(stack, request, response);
+ }
+
+
+ protected void evaluateExtraParams() {
+ super.evaluateExtraParams();
+
+ if (selectedTab != null)
+ addParameter("selectedTab", findString(selectedTab));
+ if (closeButton != null)
+ addParameter("closeButton", findString(closeButton));
+ addParameter("doLayout", doLayout != null ? findValue(doLayout, Boolean.class) : Boolean.FALSE);
+ if (labelPosition != null) {
+ //dojo has some weird name for label positions
+ if(labelPosition.equalsIgnoreCase("left"))
+ labelPosition = "left-h";
+ if(labelPosition.equalsIgnoreCase("right"))
+ labelPosition = "right-h";
+ addParameter("labelPosition", null);
+ addParameter("labelPosition", labelPosition);
+ }
+ if (templateCssPath != null)
+ addParameter("templateCssPath", findString(templateCssPath));
+ if (beforeSelectTabNotifyTopics!= null)
+ addParameter("beforeSelectTabNotifyTopics", findString(beforeSelectTabNotifyTopics));
+ if (afterSelectTabNotifyTopics!= null)
+ addParameter("afterSelectTabNotifyTopics", findString(afterSelectTabNotifyTopics));
+ if (disabledTabCssClass!= null)
+ addParameter("disabledTabCssClass", findString(disabledTabCssClass));
+ if(useSelectedTabCookie != null) {
+ addParameter("useSelectedTabCookie", findString(useSelectedTabCookie));
+ }
+
+ boolean generateId = !(Boolean)stack.getContext().get(Head.PARSE_CONTENT);
+ addParameter("pushId", generateId);
+ if ((this.id == null || this.id.length() == 0) && generateId) {
+ Random random = new Random();
+ this.id = "widget_" + Math.abs(random.nextInt());
+ addParameter("id", this.id);
+ }
+ }
+
+ @Override
+ @StrutsTagSkipInheritance
+ public void setTheme(String theme) {
+ super.setTheme(theme);
+ }
+
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
+ public String getDefaultOpenTemplate() {
+ return TEMPLATE;
+ }
+
+ protected String getDefaultTemplate() {
+ return TEMPLATE_CLOSE;
+ }
+
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
+
+ @StrutsTagAttribute(description="The id to assign to the component.", required=true)
+ public void setId(String id) {
+ // This is required to override tld generation attributes to required=true
+ super.setId(id);
+ }
+
+
+ @StrutsTagAttribute(description=" The id of the tab that will be selected by default")
+ public void setSelectedTab(String selectedTab) {
+ this.selectedTab = selectedTab;
+ }
+
+ @StrutsTagAttribute(description="Deprecated. Use 'closable' on each div(tab)")
+ public void setCloseButton(String closeButton) {
+ this.closeButton = closeButton;
+ }
+
+ @StrutsTagAttribute(description="If doLayout is false, the tab container's height equals the height of the currently selected tab", type="Boolean", defaultValue="false")
+ public void setDoLayout(String doLayout) {
+ this.doLayout = doLayout;
+ }
+
+ @StrutsTagAttribute(description="Template css path")
+ public void setTemplateCssPath(String templateCssPath) {
+ this.templateCssPath = templateCssPath;
+ }
+
+
+ @StrutsTagAttribute(description="Comma separated list of topics to be published when a tab is clicked on (before it is selected)" +
+ "The tab container widget will be passed as the first argument to the topic. The second parameter is the tab widget." +
+ "The event can be cancelled setting to 'true' the 'cancel' property " +
+ "of the third parameter passed to the topics.")
+ public void setBeforeSelectTabNotifyTopics(String selectedTabNotifyTopics) {
+ this.beforeSelectTabNotifyTopics = selectedTabNotifyTopics;
+ }
+
+ @StrutsTagAttribute(description="Comma separated list of topics to be published when a tab is clicked on (after it is selected)." +
+ "The tab container widget will be passed as the first argument to the topic. The second parameter is the tab widget.")
+ public void setAfterSelectTabNotifyTopics(String afterSelectTabNotifyTopics) {
+ this.afterSelectTabNotifyTopics = afterSelectTabNotifyTopics;
+ }
+
+ @StrutsTagAttribute(description="Css class to be applied to the tab button of disabled tabs", defaultValue="strutsDisabledTab")
+ public void setDisabledTabCssClass(String disabledTabCssClass) {
+ this.disabledTabCssClass = disabledTabCssClass;
+ }
+
+ @StrutsTagAttribute(required = false, defaultValue = "false", description = "If set to true, the id of the last selected " +
+ "tab will be stored in cookie. If the view is rendered, it will be tried to read this cookie and activate " +
+ "the corresponding tab on success, unless overridden by the selectedTab attribute. The cookie name is \"Struts2TabbedPanel_selectedTab_\"+id.")
+ public void setUseSelectedTabCookie( String useSelectedTabCookie ) {
+ this.useSelectedTabCookie = useSelectedTabCookie;
+ }
+}
Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java Sun Aug 26 12:18:15 2007
@@ -1,535 +1,556 @@
-/*
- * $Id: Tree.java 497654 2007-01-19 00:21:57Z rgielen $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.dojo.components;
-
-import java.io.Writer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.struts2.components.ClosingUIBean;
-import org.apache.struts2.views.annotations.StrutsTag;
-import org.apache.struts2.views.annotations.StrutsTagAttribute;
-import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
-
-import com.opensymphony.xwork2.util.ValueStack;
-
-/**
- * <!-- START SNIPPET: javadoc -->
- *
- * Renders a tree widget with AJAX support.<p/>
- *
- * The "id "attribute is normally specified(recommended), such that it could be looked up using
- * javascript if necessary. The "id" attribute is required if the "selectedNotifyTopic" or the
- * "href" attributes are going to be used.<p/>
- *
- * <!-- END SNIPPET: javadoc -->
- *
- * <!-- START SNIPPET: example1 -->
- * <pre>
- * <p>Tree loaded statically</p>
- * <s:tree id="..." label="...">
- * <s:treenode id="..." label="..." />
- * <s:treenode id="..." label="...">
- * <s:treenode id="..." label="..." />
- * <s:treenode id="..." label="..." />
- * &;lt;/s:treenode>
- * <s:treenode id="..." label="..." />
- * </s:tree>
- * </pre>
- * <!-- END SNIPPET: example1 -->
- *
- * <!-- END SNIPPET: example2 -->
- * <p>Tree loaded dynamically</p>
- * <pre>
- * <s:tree
- * id="..."
- * rootNode="..."
- * nodeIdProperty="..."
- * nodeTitleProperty="..."
- * childCollectionProperty="..." />
- * </pre>
- * <!-- END SNIPPET: example2 -->
- *
- * <!-- END SNIPPET: example3 -->
- * <p>Tree loaded dynamically using AJAX</p>
- * <pre>
- * <s:url id="nodesUrl" namespace="/nodecorate" action="getNodes" />
- * <div style="float:left; margin-right: 50px;">
- * <sx:tree id="tree" href="%{#nodesUrl}" />
- * </div>
- * </pre>
- *
- * <p>On this example the url specified on the "href" attibute will be called to load
- * the elements on the root. The response is expected to be a JSON array of objects like:
- * </p>
- * <pre>
- * [
- * {
- * label: "Node 1",
- * hasChildren: false,
- * id: "Node1"
- * },
- * {
- * label: "Node 2",
- * hasChildren: true,
- * id: "Node2"
- * },
- * ]
- * </pre>
- *
- * <p>"label" is the text that will be displayed for the node. "hasChildren" marks the node has
- * having children or not (if true, a plus icon will be assigned to the node so it can be
- * expanded). The "id" attribute will be used to load the children of the node, when the node
- * is expanded. When a node is expanded a request will be made to the url in the "href" attribute
- * and the node's "id" will be passed in the parameter "nodeId".</p>
- *
- * <p>The children collection for a node will be loaded only once, to reload the children of a
- * node, use the "reload()" function of the treenode widget. To reload the children nodes of "Node1"
- * from the example above use the following javascript:
- *
- * <pre>
- * dojo.widget.byId("Node1").reload();
- * </pre>
- * <!-- END SNIPPET: example3 -->
- */
-@StrutsTag(name="tree", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeTag", description="Render a tree widget.")
-public class Tree extends ClosingUIBean {
-
- private static final String TEMPLATE = "tree-close";
- private static final String OPEN_TEMPLATE = "tree";
-
- protected String toggle;
- protected String selectedNotifyTopics;
- protected String expandedNotifyTopics;
- protected String collapsedNotifyTopics;
- protected String rootNodeAttr;
- protected String childCollectionProperty;
- protected String nodeTitleProperty;
- protected String nodeIdProperty;
- protected String showRootGrid;
-
- protected String showGrid;
- protected String blankIconSrc;
- protected String gridIconSrcL;
- protected String gridIconSrcV;
- protected String gridIconSrcP;
- protected String gridIconSrcC;
- protected String gridIconSrcX;
- protected String gridIconSrcY;
- protected String expandIconSrcPlus;
- protected String expandIconSrcMinus;
- protected String iconWidth;
- protected String iconHeight;
- protected String toggleDuration;
- protected String templateCssPath;
- protected String href;
- protected String errorNotifyTopics;
-
- public Tree(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
- super(stack, request, response);
- }
-
- public boolean start(Writer writer) {
- boolean result = super.start(writer);
-
- if (this.label == null && (href == null)) {
- if ((rootNodeAttr == null)
- || (childCollectionProperty == null)
- || (nodeTitleProperty == null)
- || (nodeIdProperty == null)) {
- fieldError("label","The TreeTag requires either a value for 'label' or 'href' or ALL of 'rootNode', " +
- "'childCollectionProperty', 'nodeTitleProperty', and 'nodeIdProperty'", null);
- }
- }
- return result;
- }
-
- protected void evaluateExtraParams() {
- super.evaluateExtraParams();
-
- if (toggle != null) {
- addParameter("toggle", findString(toggle));
- } else {
- addParameter("toggle", "fade");
- }
-
- if (selectedNotifyTopics != null) {
- addParameter("selectedNotifyTopics", findString(selectedNotifyTopics));
- }
-
- if (expandedNotifyTopics != null) {
- addParameter("expandedNotifyTopics", findString(expandedNotifyTopics));
- }
-
- if (collapsedNotifyTopics != null) {
- addParameter("collapsedNotifyTopics", findString(collapsedNotifyTopics));
- }
-
- if (rootNodeAttr != null) {
- addParameter("rootNode", findValue(rootNodeAttr));
- }
-
- if (childCollectionProperty != null) {
- addParameter("childCollectionProperty", findString(childCollectionProperty));
- }
-
- if (nodeTitleProperty != null) {
- addParameter("nodeTitleProperty", findString(nodeTitleProperty));
- }
-
- if (nodeIdProperty != null) {
- addParameter("nodeIdProperty", findString(nodeIdProperty));
- }
-
- if (showRootGrid != null) {
- addParameter("showRootGrid", findValue(showRootGrid, Boolean.class));
- }
-
-
- if (showGrid != null) {
- addParameter("showGrid", findValue(showGrid, Boolean.class));
- }
-
- if (blankIconSrc != null) {
- addParameter("blankIconSrc", findString(blankIconSrc));
- }
-
- if (gridIconSrcL != null) {
- addParameter("gridIconSrcL", findString(gridIconSrcL));
- }
-
- if (gridIconSrcV != null) {
- addParameter("gridIconSrcV", findString(gridIconSrcV));
- }
-
- if (gridIconSrcP != null) {
- addParameter("gridIconSrcP", findString(gridIconSrcP));
- }
-
- if (gridIconSrcC != null) {
- addParameter("gridIconSrcC", findString(gridIconSrcC));
- }
-
- if (gridIconSrcX != null) {
- addParameter("gridIconSrcX", findString(gridIconSrcX));
- }
-
- if (gridIconSrcY != null) {
- addParameter("gridIconSrcY", findString(gridIconSrcY));
- }
-
- if (expandIconSrcPlus != null) {
- addParameter("expandIconSrcPlus", findString(expandIconSrcPlus));
- }
-
- if (expandIconSrcMinus != null) {
- addParameter("expandIconSrcMinus", findString(expandIconSrcMinus));
- }
-
- if (iconWidth != null) {
- addParameter("iconWidth", findValue(iconWidth, Integer.class));
- }
- if (iconHeight != null) {
- addParameter("iconHeight", findValue(iconHeight, Integer.class));
- }
- if (toggleDuration != null) {
- addParameter("toggleDuration", findValue(toggleDuration, Integer.class));
- }
- if (templateCssPath != null) {
- addParameter("templateCssPath", findString(templateCssPath));
- }
- if (href != null)
- addParameter("href", findString(href));
- if (errorNotifyTopics != null)
- addParameter("errorNotifyTopics", findString(errorNotifyTopics));
-
- }
-
- @Override
- @StrutsTagSkipInheritance
- public void setTheme(String theme) {
- super.setTheme(theme);
- }
-
- @Override
- public String getTheme() {
- return "ajax";
- }
-
- public String getDefaultOpenTemplate() {
- return OPEN_TEMPLATE;
- }
-
- protected String getDefaultTemplate() {
- return TEMPLATE;
- }
-
- public String getToggle() {
- return toggle;
- }
-
- @StrutsTagAttribute(description="The toggle property (either 'explode' or 'fade')", defaultValue="fade")
- public void setToggle(String toggle) {
- this.toggle = toggle;
- }
-
- @StrutsTagAttribute(description="Deprecated. Use 'selectedNotifyTopics' instead.")
- public void setTreeSelectedTopic(String selectedNotifyTopic) {
- this.selectedNotifyTopics = selectedNotifyTopic;
- }
-
- @StrutsTagAttribute(description="Deprecated. Use 'expandedNotifyTopics' instead.")
- public void setTreeExpandedTopics(String expandedNotifyTopic) {
- this.expandedNotifyTopics = expandedNotifyTopic;
- }
-
- @StrutsTagAttribute(description="Deprecated. Use 'collapsedNotifyTopics' instead.")
- public void setTreeCollapsedTopics(String collapsedNotifyTopic) {
- this.collapsedNotifyTopics = collapsedNotifyTopic;
- }
-
- public String getRootNode() {
- return rootNodeAttr;
- }
-
- @StrutsTagAttribute(description="The rootNode property.")
- public void setRootNode(String rootNode) {
- this.rootNodeAttr = rootNode;
- }
-
- public String getChildCollectionProperty() {
- return childCollectionProperty;
- }
-
- @StrutsTagAttribute(description="The childCollectionProperty property.")
- public void setChildCollectionProperty(String childCollectionProperty) {
- this.childCollectionProperty = childCollectionProperty;
- }
-
- public String getNodeTitleProperty() {
- return nodeTitleProperty;
- }
-
- @StrutsTagAttribute(description="The nodeTitleProperty property.")
- public void setNodeTitleProperty(String nodeTitleProperty) {
- this.nodeTitleProperty = nodeTitleProperty;
- }
-
- public String getNodeIdProperty() {
- return nodeIdProperty;
- }
-
- @StrutsTagAttribute(description="The nodeIdProperty property.")
- public void setNodeIdProperty(String nodeIdProperty) {
- this.nodeIdProperty = nodeIdProperty;
- }
-
- @StrutsTagAttribute(description="The showRootGrid property (default true).")
- public void setShowRootGrid(String showRootGrid) {
- this.showRootGrid = showRootGrid;
- }
-
- public String getShowRootGrid() {
- return showRootGrid;
- }
-
- public String getBlankIconSrc() {
- return blankIconSrc;
- }
-
- @StrutsTagAttribute(description="Blank icon image source.")
- public void setBlankIconSrc(String blankIconSrc) {
- this.blankIconSrc = blankIconSrc;
- }
-
- public String getExpandIconSrcMinus() {
- return expandIconSrcMinus;
- }
-
- @StrutsTagAttribute(description="Expand icon (-) image source.")
- public void setExpandIconSrcMinus(String expandIconSrcMinus) {
- this.expandIconSrcMinus = expandIconSrcMinus;
- }
-
- public String getExpandIconSrcPlus() {
- return expandIconSrcPlus;
- }
-
- @StrutsTagAttribute(description="Expand Icon (+) image source.")
- public void setExpandIconSrcPlus(String expandIconSrcPlus) {
- this.expandIconSrcPlus = expandIconSrcPlus;
- }
-
- public String getGridIconSrcC() {
- return gridIconSrcC;
- }
-
- @StrutsTagAttribute(description="Image source for under child item child icons.")
- public void setGridIconSrcC(String gridIconSrcC) {
- this.gridIconSrcC = gridIconSrcC;
- }
-
- public String getGridIconSrcL() {
- return gridIconSrcL;
- }
-
-
- @StrutsTagAttribute(description=" Image source for last child grid.")
- public void setGridIconSrcL(String gridIconSrcL) {
- this.gridIconSrcL = gridIconSrcL;
- }
-
- public String getGridIconSrcP() {
- return gridIconSrcP;
- }
-
- @StrutsTagAttribute(description="Image source for under parent item child icons.")
- public void setGridIconSrcP(String gridIconSrcP) {
- this.gridIconSrcP = gridIconSrcP;
- }
-
- public String getGridIconSrcV() {
- return gridIconSrcV;
- }
-
- @StrutsTagAttribute(description="Image source for vertical line.")
- public void setGridIconSrcV(String gridIconSrcV) {
- this.gridIconSrcV = gridIconSrcV;
- }
-
- public String getGridIconSrcX() {
- return gridIconSrcX;
- }
-
- @StrutsTagAttribute(description="Image source for grid for sole root item.")
- public void setGridIconSrcX(String gridIconSrcX) {
- this.gridIconSrcX = gridIconSrcX;
- }
-
- public String getGridIconSrcY() {
- return gridIconSrcY;
- }
-
- @StrutsTagAttribute(description="Image source for grid for last root item.")
- public void setGridIconSrcY(String gridIconSrcY) {
- this.gridIconSrcY = gridIconSrcY;
- }
-
- public String getIconHeight() {
- return iconHeight;
- }
-
-
- @StrutsTagAttribute(description="Icon height", defaultValue="18px")
- public void setIconHeight(String iconHeight) {
- this.iconHeight = iconHeight;
- }
-
- public String getIconWidth() {
- return iconWidth;
- }
-
- @StrutsTagAttribute(description="Icon width", defaultValue="19px")
- public void setIconWidth(String iconWidth) {
- this.iconWidth = iconWidth;
- }
-
-
-
- public String getTemplateCssPath() {
- return templateCssPath;
- }
-
- @StrutsTagAttribute(description="Template css path", defaultValue="{contextPath}/struts/tree.css.")
- public void setTemplateCssPath(String templateCssPath) {
- this.templateCssPath = templateCssPath;
- }
-
- public String getToggleDuration() {
- return toggleDuration;
- }
-
- @StrutsTagAttribute(description="Toggle duration in milliseconds", defaultValue="150")
- public void setToggleDuration(String toggleDuration) {
- this.toggleDuration = toggleDuration;
- }
-
- public String getShowGrid() {
- return showGrid;
- }
-
- @StrutsTagAttribute(description="Show grid", type="Boolean", defaultValue="true")
- public void setShowGrid(String showGrid) {
- this.showGrid = showGrid;
- }
-
- @StrutsTagAttribute(description="The css class to use for element")
- public void setCssClass(String cssClass) {
- super.setCssClass(cssClass);
- }
-
- @StrutsTagAttribute(description="The css style to use for element")
- public void setCssStyle(String cssStyle) {
- super.setCssStyle(cssStyle);
- }
-
- @StrutsTagAttribute(description="The id to use for the element")
- public void setId(String id) {
- super.setId(id);
- }
-
- @StrutsTagAttribute(description="The name to set for element")
- public void setName(String name) {
- super.setName(name);
- }
-
- @StrutsTagAttribute(description="Comma separated lis of topics to be published when a node" +
- " is collapsed. An object with a 'node' property will be passed as parameter to the topics.")
- public void setCollapsedNotifyTopics(String collapsedNotifyTopics) {
- this.collapsedNotifyTopics = collapsedNotifyTopics;
- }
-
- @StrutsTagAttribute(description="Comma separated lis of topics to be published when a node" +
- " is expanded. An object with a 'node' property will be passed as parameter to the topics.")
- public void setExpandedNotifyTopics(String expandedNotifyTopics) {
- this.expandedNotifyTopics= expandedNotifyTopics;
- }
-
- @StrutsTagAttribute(description="Comma separated lis of topics to be published when a node" +
- " is selected. An object with a 'node' property will be passed as parameter to the topics.")
- public void setSelectedNotifyTopics(String selectedNotifyTopics) {
- this.selectedNotifyTopics = selectedNotifyTopics;
- }
-
- @StrutsTagAttribute(description="Url used to load the list of children nodes for an specific node, whose id will be " +
- "passed as a parameter named 'nodeId' (empty for root)")
- public void setHref(String href) {
- this.href = href;
- }
-
- @StrutsTagAttribute(description="Comma delimmited list of topics that will published after the request(if the request fails)." +
- "Only valid if 'href' is set")
- public void setErrorNotifyTopics(String errorNotifyTopics) {
- this.errorNotifyTopics = errorNotifyTopics;
- }
-}
-
+/*
+ * $Id: Tree.java 497654 2007-01-19 00:21:57Z rgielen $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dojo.components;
+
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.ClosingUIBean;
+import org.apache.struts2.views.annotations.StrutsTag;
+import org.apache.struts2.views.annotations.StrutsTagAttribute;
+import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * <!-- START SNIPPET: javadoc -->
+ *
+ * Renders a tree widget with AJAX support.<p/>
+ *
+ * The "id "attribute is normally specified(recommended), such that it could be looked up using
+ * javascript if necessary. The "id" attribute is required if the "selectedNotifyTopic" or the
+ * "href" attributes are going to be used.<p/>
+ *
+ * <!-- END SNIPPET: javadoc -->
+ *
+ * <!-- START SNIPPET: example1 -->
+ * <pre>
+ * <p>Tree loaded statically</p>
+ * <s:tree id="..." label="...">
+ * <s:treenode id="..." label="..." />
+ * <s:treenode id="..." label="...">
+ * <s:treenode id="..." label="..." />
+ * <s:treenode id="..." label="..." />
+ * &;lt;/s:treenode>
+ * <s:treenode id="..." label="..." />
+ * </s:tree>
+ * </pre>
+ * <!-- END SNIPPET: example1 -->
+ *
+ * <!-- END SNIPPET: example2 -->
+ * <p>Tree loaded dynamically</p>
+ * <pre>
+ * <s:tree
+ * id="..."
+ * rootNode="..."
+ * nodeIdProperty="..."
+ * nodeTitleProperty="..."
+ * childCollectionProperty="..." />
+ * </pre>
+ * <!-- END SNIPPET: example2 -->
+ *
+ * <!-- END SNIPPET: example3 -->
+ * <p>Tree loaded dynamically using AJAX</p>
+ * <pre>
+ * <s:url id="nodesUrl" namespace="/nodecorate" action="getNodes" />
+ * <div style="float:left; margin-right: 50px;">
+ * <sx:tree id="tree" href="%{#nodesUrl}" />
+ * </div>
+ * </pre>
+ *
+ * <p>On this example the url specified on the "href" attibute will be called to load
+ * the elements on the root. The response is expected to be a JSON array of objects like:
+ * </p>
+ * <pre>
+ * [
+ * {
+ * label: "Node 1",
+ * hasChildren: false,
+ * id: "Node1"
+ * },
+ * {
+ * label: "Node 2",
+ * hasChildren: true,
+ * id: "Node2"
+ * },
+ * ]
+ * </pre>
+ *
+ * <p>"label" is the text that will be displayed for the node. "hasChildren" marks the node has
+ * having children or not (if true, a plus icon will be assigned to the node so it can be
+ * expanded). The "id" attribute will be used to load the children of the node, when the node
+ * is expanded. When a node is expanded a request will be made to the url in the "href" attribute
+ * and the node's "id" will be passed in the parameter "nodeId".</p>
+ *
+ * <p>The children collection for a node will be loaded only once, to reload the children of a
+ * node, use the "reload()" function of the treenode widget. To reload the children nodes of "Node1"
+ * from the example above use the following javascript:
+ *
+ * <pre>
+ * dojo.widget.byId("Node1").reload();
+ * </pre>
+ * <!-- END SNIPPET: example3 -->
+ */
+@StrutsTag(name="tree", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeTag", description="Render a tree widget.")
+public class Tree extends ClosingUIBean {
+
+ private static final String TEMPLATE = "tree-close";
+ private static final String OPEN_TEMPLATE = "tree";
+
+ protected String toggle;
+ protected String selectedNotifyTopics;
+ protected String expandedNotifyTopics;
+ protected String collapsedNotifyTopics;
+ protected String rootNodeAttr;
+ protected String childCollectionProperty;
+ protected String nodeTitleProperty;
+ protected String nodeIdProperty;
+ protected String showRootGrid;
+
+ protected String showGrid;
+ protected String blankIconSrc;
+ protected String gridIconSrcL;
+ protected String gridIconSrcV;
+ protected String gridIconSrcP;
+ protected String gridIconSrcC;
+ protected String gridIconSrcX;
+ protected String gridIconSrcY;
+ protected String expandIconSrcPlus;
+ protected String expandIconSrcMinus;
+ protected String iconWidth;
+ protected String iconHeight;
+ protected String toggleDuration;
+ protected String templateCssPath;
+ protected String href;
+ protected String errorNotifyTopics;
+
+ private List<String> childrenIds;
+
+ public Tree(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
+ super(stack, request, response);
+ }
+
+ public boolean start(Writer writer) {
+ boolean result = super.start(writer);
+
+ if (this.label == null && (href == null)) {
+ if ((rootNodeAttr == null)
+ || (childCollectionProperty == null)
+ || (nodeTitleProperty == null)
+ || (nodeIdProperty == null)) {
+ fieldError("label","The TreeTag requires either a value for 'label' or 'href' or ALL of 'rootNode', " +
+ "'childCollectionProperty', 'nodeTitleProperty', and 'nodeIdProperty'", null);
+ }
+ }
+ return result;
+ }
+
+ protected void evaluateExtraParams() {
+ super.evaluateExtraParams();
+
+ if (toggle != null) {
+ addParameter("toggle", findString(toggle));
+ } else {
+ addParameter("toggle", "fade");
+ }
+
+ if (selectedNotifyTopics != null) {
+ addParameter("selectedNotifyTopics", findString(selectedNotifyTopics));
+ }
+
+ if (expandedNotifyTopics != null) {
+ addParameter("expandedNotifyTopics", findString(expandedNotifyTopics));
+ }
+
+ if (collapsedNotifyTopics != null) {
+ addParameter("collapsedNotifyTopics", findString(collapsedNotifyTopics));
+ }
+
+ if (rootNodeAttr != null) {
+ addParameter("rootNode", findValue(rootNodeAttr));
+ }
+
+ if (childCollectionProperty != null) {
+ addParameter("childCollectionProperty", findString(childCollectionProperty));
+ }
+
+ if (nodeTitleProperty != null) {
+ addParameter("nodeTitleProperty", findString(nodeTitleProperty));
+ }
+
+ if (nodeIdProperty != null) {
+ addParameter("nodeIdProperty", findString(nodeIdProperty));
+ }
+
+ if (showRootGrid != null) {
+ addParameter("showRootGrid", findValue(showRootGrid, Boolean.class));
+ }
+
+
+ if (showGrid != null) {
+ addParameter("showGrid", findValue(showGrid, Boolean.class));
+ }
+
+ if (blankIconSrc != null) {
+ addParameter("blankIconSrc", findString(blankIconSrc));
+ }
+
+ if (gridIconSrcL != null) {
+ addParameter("gridIconSrcL", findString(gridIconSrcL));
+ }
+
+ if (gridIconSrcV != null) {
+ addParameter("gridIconSrcV", findString(gridIconSrcV));
+ }
+
+ if (gridIconSrcP != null) {
+ addParameter("gridIconSrcP", findString(gridIconSrcP));
+ }
+
+ if (gridIconSrcC != null) {
+ addParameter("gridIconSrcC", findString(gridIconSrcC));
+ }
+
+ if (gridIconSrcX != null) {
+ addParameter("gridIconSrcX", findString(gridIconSrcX));
+ }
+
+ if (gridIconSrcY != null) {
+ addParameter("gridIconSrcY", findString(gridIconSrcY));
+ }
+
+ if (expandIconSrcPlus != null) {
+ addParameter("expandIconSrcPlus", findString(expandIconSrcPlus));
+ }
+
+ if (expandIconSrcMinus != null) {
+ addParameter("expandIconSrcMinus", findString(expandIconSrcMinus));
+ }
+
+ if (iconWidth != null) {
+ addParameter("iconWidth", findValue(iconWidth, Integer.class));
+ }
+ if (iconHeight != null) {
+ addParameter("iconHeight", findValue(iconHeight, Integer.class));
+ }
+ if (toggleDuration != null) {
+ addParameter("toggleDuration", findValue(toggleDuration, Integer.class));
+ }
+ if (templateCssPath != null) {
+ addParameter("templateCssPath", findString(templateCssPath));
+ }
+ if (href != null)
+ addParameter("href", findString(href));
+ if (errorNotifyTopics != null)
+ addParameter("errorNotifyTopics", findString(errorNotifyTopics));
+
+ boolean generateId = !(Boolean)stack.getContext().get(Head.PARSE_CONTENT);
+ addParameter("pushId", generateId);
+ if ((this.id == null || this.id.length() == 0) && generateId) {
+ Random random = new Random();
+ this.id = "widget_" + Math.abs(random.nextInt());
+ addParameter("id", this.id);
+ }
+
+ if (this.childrenIds != null)
+ addParameter("childrenIds", this.childrenIds);
+ }
+
+ public void addChildrenId(String id) {
+ if (this.childrenIds == null)
+ this.childrenIds = new ArrayList<String>();
+ this.childrenIds.add(id);
+ }
+
+ @Override
+ @StrutsTagSkipInheritance
+ public void setTheme(String theme) {
+ super.setTheme(theme);
+ }
+
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
+ public String getDefaultOpenTemplate() {
+ return OPEN_TEMPLATE;
+ }
+
+ protected String getDefaultTemplate() {
+ return TEMPLATE;
+ }
+
+ public String getToggle() {
+ return toggle;
+ }
+
+ @StrutsTagAttribute(description="The toggle property (either 'explode' or 'fade')", defaultValue="fade")
+ public void setToggle(String toggle) {
+ this.toggle = toggle;
+ }
+
+ @StrutsTagAttribute(description="Deprecated. Use 'selectedNotifyTopics' instead.")
+ public void setTreeSelectedTopic(String selectedNotifyTopic) {
+ this.selectedNotifyTopics = selectedNotifyTopic;
+ }
+
+ @StrutsTagAttribute(description="Deprecated. Use 'expandedNotifyTopics' instead.")
+ public void setTreeExpandedTopics(String expandedNotifyTopic) {
+ this.expandedNotifyTopics = expandedNotifyTopic;
+ }
+
+ @StrutsTagAttribute(description="Deprecated. Use 'collapsedNotifyTopics' instead.")
+ public void setTreeCollapsedTopics(String collapsedNotifyTopic) {
+ this.collapsedNotifyTopics = collapsedNotifyTopic;
+ }
+
+ public String getRootNode() {
+ return rootNodeAttr;
+ }
+
+ @StrutsTagAttribute(description="The rootNode property.")
+ public void setRootNode(String rootNode) {
+ this.rootNodeAttr = rootNode;
+ }
+
+ public String getChildCollectionProperty() {
+ return childCollectionProperty;
+ }
+
+ @StrutsTagAttribute(description="The childCollectionProperty property.")
+ public void setChildCollectionProperty(String childCollectionProperty) {
+ this.childCollectionProperty = childCollectionProperty;
+ }
+
+ public String getNodeTitleProperty() {
+ return nodeTitleProperty;
+ }
+
+ @StrutsTagAttribute(description="The nodeTitleProperty property.")
+ public void setNodeTitleProperty(String nodeTitleProperty) {
+ this.nodeTitleProperty = nodeTitleProperty;
+ }
+
+ public String getNodeIdProperty() {
+ return nodeIdProperty;
+ }
+
+ @StrutsTagAttribute(description="The nodeIdProperty property.")
+ public void setNodeIdProperty(String nodeIdProperty) {
+ this.nodeIdProperty = nodeIdProperty;
+ }
+
+ @StrutsTagAttribute(description="The showRootGrid property (default true).")
+ public void setShowRootGrid(String showRootGrid) {
+ this.showRootGrid = showRootGrid;
+ }
+
+ public String getShowRootGrid() {
+ return showRootGrid;
+ }
+
+ public String getBlankIconSrc() {
+ return blankIconSrc;
+ }
+
+ @StrutsTagAttribute(description="Blank icon image source.")
+ public void setBlankIconSrc(String blankIconSrc) {
+ this.blankIconSrc = blankIconSrc;
+ }
+
+ public String getExpandIconSrcMinus() {
+ return expandIconSrcMinus;
+ }
+
+ @StrutsTagAttribute(description="Expand icon (-) image source.")
+ public void setExpandIconSrcMinus(String expandIconSrcMinus) {
+ this.expandIconSrcMinus = expandIconSrcMinus;
+ }
+
+ public String getExpandIconSrcPlus() {
+ return expandIconSrcPlus;
+ }
+
+ @StrutsTagAttribute(description="Expand Icon (+) image source.")
+ public void setExpandIconSrcPlus(String expandIconSrcPlus) {
+ this.expandIconSrcPlus = expandIconSrcPlus;
+ }
+
+ public String getGridIconSrcC() {
+ return gridIconSrcC;
+ }
+
+ @StrutsTagAttribute(description="Image source for under child item child icons.")
+ public void setGridIconSrcC(String gridIconSrcC) {
+ this.gridIconSrcC = gridIconSrcC;
+ }
+
+ public String getGridIconSrcL() {
+ return gridIconSrcL;
+ }
+
+
+ @StrutsTagAttribute(description=" Image source for last child grid.")
+ public void setGridIconSrcL(String gridIconSrcL) {
+ this.gridIconSrcL = gridIconSrcL;
+ }
+
+ public String getGridIconSrcP() {
+ return gridIconSrcP;
+ }
+
+ @StrutsTagAttribute(description="Image source for under parent item child icons.")
+ public void setGridIconSrcP(String gridIconSrcP) {
+ this.gridIconSrcP = gridIconSrcP;
+ }
+
+ public String getGridIconSrcV() {
+ return gridIconSrcV;
+ }
+
+ @StrutsTagAttribute(description="Image source for vertical line.")
+ public void setGridIconSrcV(String gridIconSrcV) {
+ this.gridIconSrcV = gridIconSrcV;
+ }
+
+ public String getGridIconSrcX() {
+ return gridIconSrcX;
+ }
+
+ @StrutsTagAttribute(description="Image source for grid for sole root item.")
+ public void setGridIconSrcX(String gridIconSrcX) {
+ this.gridIconSrcX = gridIconSrcX;
+ }
+
+ public String getGridIconSrcY() {
+ return gridIconSrcY;
+ }
+
+ @StrutsTagAttribute(description="Image source for grid for last root item.")
+ public void setGridIconSrcY(String gridIconSrcY) {
+ this.gridIconSrcY = gridIconSrcY;
+ }
+
+ public String getIconHeight() {
+ return iconHeight;
+ }
+
+
+ @StrutsTagAttribute(description="Icon height", defaultValue="18px")
+ public void setIconHeight(String iconHeight) {
+ this.iconHeight = iconHeight;
+ }
+
+ public String getIconWidth() {
+ return iconWidth;
+ }
+
+ @StrutsTagAttribute(description="Icon width", defaultValue="19px")
+ public void setIconWidth(String iconWidth) {
+ this.iconWidth = iconWidth;
+ }
+
+
+
+ public String getTemplateCssPath() {
+ return templateCssPath;
+ }
+
+ @StrutsTagAttribute(description="Template css path", defaultValue="{contextPath}/struts/tree.css.")
+ public void setTemplateCssPath(String templateCssPath) {
+ this.templateCssPath = templateCssPath;
+ }
+
+ public String getToggleDuration() {
+ return toggleDuration;
+ }
+
+ @StrutsTagAttribute(description="Toggle duration in milliseconds", defaultValue="150")
+ public void setToggleDuration(String toggleDuration) {
+ this.toggleDuration = toggleDuration;
+ }
+
+ public String getShowGrid() {
+ return showGrid;
+ }
+
+ @StrutsTagAttribute(description="Show grid", type="Boolean", defaultValue="true")
+ public void setShowGrid(String showGrid) {
+ this.showGrid = showGrid;
+ }
+
+ @StrutsTagAttribute(description="The css class to use for element")
+ public void setCssClass(String cssClass) {
+ super.setCssClass(cssClass);
+ }
+
+ @StrutsTagAttribute(description="The css style to use for element")
+ public void setCssStyle(String cssStyle) {
+ super.setCssStyle(cssStyle);
+ }
+
+ @StrutsTagAttribute(description="The id to use for the element")
+ public void setId(String id) {
+ super.setId(id);
+ }
+
+ @StrutsTagAttribute(description="The name to set for element")
+ public void setName(String name) {
+ super.setName(name);
+ }
+
+ @StrutsTagAttribute(description="Comma separated lis of topics to be published when a node" +
+ " is collapsed. An object with a 'node' property will be passed as parameter to the topics.")
+ public void setCollapsedNotifyTopics(String collapsedNotifyTopics) {
+ this.collapsedNotifyTopics = collapsedNotifyTopics;
+ }
+
+ @StrutsTagAttribute(description="Comma separated lis of topics to be published when a node" +
+ " is expanded. An object with a 'node' property will be passed as parameter to the topics.")
+ public void setExpandedNotifyTopics(String expandedNotifyTopics) {
+ this.expandedNotifyTopics= expandedNotifyTopics;
+ }
+
+ @StrutsTagAttribute(description="Comma separated lis of topics to be published when a node" +
+ " is selected. An object with a 'node' property will be passed as parameter to the topics.")
+ public void setSelectedNotifyTopics(String selectedNotifyTopics) {
+ this.selectedNotifyTopics = selectedNotifyTopics;
+ }
+
+ @StrutsTagAttribute(description="Url used to load the list of children nodes for an specific node, whose id will be " +
+ "passed as a parameter named 'nodeId' (empty for root)")
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ @StrutsTagAttribute(description="Comma delimmited list of topics that will published after the request(if the request fails)." +
+ "Only valid if 'href' is set")
+ public void setErrorNotifyTopics(String errorNotifyTopics) {
+ this.errorNotifyTopics = errorNotifyTopics;
+ }
+}
+
Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java Sun Aug 26 12:18:15 2007
@@ -1,136 +1,153 @@
-/*
- * $Id: TreeNode.java 497654 2007-01-19 00:21:57Z rgielen $
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.dojo.components;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.struts2.components.ClosingUIBean;
-import org.apache.struts2.views.annotations.StrutsTag;
-import org.apache.struts2.views.annotations.StrutsTagAttribute;
-import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
-
-import com.opensymphony.xwork2.util.ValueStack;
-
-/**
- * <!-- START SNIPPET: javadoc -->
- *
- * Renders a tree node within a tree widget with AJAX support.<p/>
- *
- * Either of the following combinations should be used depending on if the tree
- * is to be constrcted dynamically or statically. <p/>
- *
- * <b>Dynamically</b>
- * <ul>
- * <li>id - id of this tree node</li>
- * <li>title - label to be displayed for this tree node</li>
- * </ul>
- *
- * <b>Statically</b>
- * <ul>
- * <li>rootNode - the parent node of which this tree is derived from</li>
- * <li>nodeIdProperty - property to obtained this current tree node's id</li>
- * <li>nodeTitleProperty - property to obtained this current tree node's title</li>
- * <li>childCollectionProperty - property that returnds this current tree node's children</li>
- * </ul>
- *
- * <!-- END SNIPPET: javadoc -->
- *
- * <p/> <b>Examples</b>
- *
- * <pre>
- * <!-- START SNIPPET: example -->
- *
- * <-- statically -->
- * <s:tree id="..." label="...">
- * <s:treenode id="..." label="..." />
- * <s:treenode id="..." label="...">
- * <s:treenode id="..." label="..." />
- * <s:treenode id="..." label="..." />
- * &;lt;/s:treenode>
- * <s:treenode id="..." label="..." />
- * </s:tree>
- *
- * <-- dynamically -->
- * <s:tree
- * id="..."
- * rootNode="..."
- * nodeIdProperty="..."
- * nodeTitleProperty="..."
- * childCollectionProperty="..." />
- *
- * <!-- END SNIPPET: example -->
- * </pre>
- *
- */
-@StrutsTag(name="treenode", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeNodeTag", description="Render a tree node within a tree widget.")
-public class TreeNode extends ClosingUIBean {
- private static final String TEMPLATE = "treenode-close";
- private static final String OPEN_TEMPLATE = "treenode";
-
- public TreeNode(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
- super(stack, request, response);
- }
-
- @Override
- @StrutsTagSkipInheritance
- public void setTheme(String theme) {
- super.setTheme(theme);
- }
-
- @Override
- public String getTheme() {
- return "ajax";
- }
-
- public String getDefaultOpenTemplate() {
- return OPEN_TEMPLATE;
- }
-
- protected String getDefaultTemplate() {
- return TEMPLATE;
- }
-
- @StrutsTagAttribute(description="Label expression used for rendering tree node label.", required=true)
- public void setLabel(String label) {
- super.setLabel(label);
- }
-
- @StrutsTagAttribute(description="The css class to use for element")
- public void setCssClass(String cssClass) {
- super.setCssClass(cssClass);
- }
-
- @StrutsTagAttribute(description="The css style to use for element")
- public void setCssStyle(String cssStyle) {
- super.setCssStyle(cssStyle);
- }
-
- @StrutsTagAttribute(description="The id to use for the element")
- public void setId(String id) {
- super.setId(id);
- }
-
- @StrutsTagAttribute(description="The name to set for element")
- public void setName(String name) {
- super.setName(name);
- }
-}
+/*
+ * $Id: TreeNode.java 497654 2007-01-19 00:21:57Z rgielen $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.dojo.components;
+
+import java.util.Random;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.ClosingUIBean;
+import org.apache.struts2.views.annotations.StrutsTag;
+import org.apache.struts2.views.annotations.StrutsTagAttribute;
+import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * <!-- START SNIPPET: javadoc -->
+ *
+ * Renders a tree node within a tree widget with AJAX support.<p/>
+ *
+ * Either of the following combinations should be used depending on if the tree
+ * is to be constrcted dynamically or statically. <p/>
+ *
+ * <b>Dynamically</b>
+ * <ul>
+ * <li>id - id of this tree node</li>
+ * <li>title - label to be displayed for this tree node</li>
+ * </ul>
+ *
+ * <b>Statically</b>
+ * <ul>
+ * <li>rootNode - the parent node of which this tree is derived from</li>
+ * <li>nodeIdProperty - property to obtained this current tree node's id</li>
+ * <li>nodeTitleProperty - property to obtained this current tree node's title</li>
+ * <li>childCollectionProperty - property that returnds this current tree node's children</li>
+ * </ul>
+ *
+ * <!-- END SNIPPET: javadoc -->
+ *
+ * <p/> <b>Examples</b>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ *
+ * <-- statically -->
+ * <s:tree id="..." label="...">
+ * <s:treenode id="..." label="..." />
+ * <s:treenode id="..." label="...">
+ * <s:treenode id="..." label="..." />
+ * <s:treenode id="..." label="..." />
+ * &;lt;/s:treenode>
+ * <s:treenode id="..." label="..." />
+ * </s:tree>
+ *
+ * <-- dynamically -->
+ * <s:tree
+ * id="..."
+ * rootNode="..."
+ * nodeIdProperty="..."
+ * nodeTitleProperty="..."
+ * childCollectionProperty="..." />
+ *
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ */
+@StrutsTag(name="treenode", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeNodeTag", description="Render a tree node within a tree widget.")
+public class TreeNode extends ClosingUIBean {
+ private static final String TEMPLATE = "treenode-close";
+ private static final String OPEN_TEMPLATE = "treenode";
+
+ public TreeNode(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
+ super(stack, request, response);
+ }
+
+ @Override
+ @StrutsTagSkipInheritance
+ public void setTheme(String theme) {
+ super.setTheme(theme);
+ }
+
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
+ public String getDefaultOpenTemplate() {
+ return OPEN_TEMPLATE;
+ }
+
+ protected String getDefaultTemplate() {
+ return TEMPLATE;
+ }
+
+ protected void evaluateExtraParams() {
+ super.evaluateExtraParams();
+
+ boolean generateId = !(Boolean)stack.getContext().get(Head.PARSE_CONTENT);
+ addParameter("pushId", generateId);
+ if ((this.id == null || this.id.length() == 0) && generateId) {
+ Random random = new Random();
+ this.id = "widget_" + Math.abs(random.nextInt());
+ addParameter("id", this.id);
+ }
+
+ Tree parentTree = (Tree) findAncestor(Tree.class);
+ parentTree.addChildrenId(this.id);
+ }
+
+ @StrutsTagAttribute(description="Label expression used for rendering tree node label.", required=true)
+ public void setLabel(String label) {
+ super.setLabel(label);
+ }
+
+ @StrutsTagAttribute(description="The css class to use for element")
+ public void setCssClass(String cssClass) {
+ super.setCssClass(cssClass);
+ }
+
+ @StrutsTagAttribute(description="The css style to use for element")
+ public void setCssStyle(String cssStyle) {
+ super.setCssStyle(cssStyle);
+ }
+
+ @StrutsTagAttribute(description="The id to use for the element")
+ public void setId(String id) {
+ super.setId(id);
+ }
+
+ @StrutsTagAttribute(description="The name to set for element")
+ public void setName(String name) {
+ super.setName(name);
+ }
+}
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?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- 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 Sun Aug 26 12:18:15 2007
@@ -42,6 +42,7 @@
private String extraLocales;
private String locale;
private String cache;
+ private String parseContent;
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new Head(stack, req, res);
@@ -57,6 +58,7 @@
head.setExtraLocales(extraLocales);
head.setLocale(locale);
head.setCache(cache);
+ head.setParseContent(parseContent);
}
public void setDebug(String debug) {
@@ -81,5 +83,9 @@
public void setCache(String cache) {
this.cache = cache;
+ }
+
+ public void setParseContent(String parseContent) {
+ this.parseContent = parseContent;
}
}
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/a-close.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/a-close.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/a-close.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/a-close.ftl Sun Aug 26 12:18:15 2007
@@ -21,3 +21,6 @@
*/
-->
</a>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/autocompleter.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/autocompleter.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/autocompleter.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/autocompleter.ftl Sun Aug 26 12:18:15 2007
@@ -173,5 +173,8 @@
<#if parameters.label?if_exists != "">
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" />
</#if>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind-close.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind-close.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind-close.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind-close.ftl Sun Aug 26 12:18:15 2007
@@ -20,3 +20,6 @@
* under the License.
*/
-->
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/datetimepicker.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/datetimepicker.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/datetimepicker.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/datetimepicker.ftl Sun Aug 26 12:18:15 2007
@@ -97,3 +97,6 @@
<#if parameters.label?if_exists != "">
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" />
</#if>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div-close.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div-close.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div-close.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/div-close.ftl Sun Aug 26 12:18:15 2007
@@ -21,3 +21,6 @@
*/
-->
</div>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
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?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- 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 Sun Aug 26 12:18:15 2007
@@ -42,6 +42,8 @@
</#list>
]
</#if>
+ ,parseWidgets : ${parameters.parseContent?string}
+
};
</script>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl Sun Aug 26 12:18:15 2007
@@ -93,4 +93,7 @@
<#else>
</span> <#t/>
</#if>
+</#if>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tab-close.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tab-close.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tab-close.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tab-close.ftl Sun Aug 26 12:18:15 2007
@@ -21,3 +21,6 @@
*/
-->
</div>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tabbedpanel-close.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tabbedpanel-close.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tabbedpanel-close.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tabbedpanel-close.ftl Sun Aug 26 12:18:15 2007
@@ -21,3 +21,6 @@
*/
-->
</div>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("${parameters.id?html}");</script>
+</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree-close.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree-close.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree-close.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree-close.ftl Sun Aug 26 12:18:15 2007
@@ -21,3 +21,16 @@
*/
-->
<#if parameters.label?exists></div></#if></div>
+<#if parameters.pushId>
+<script language="JavaScript" type="text/javascript">
+ djConfig.searchIds.push("treeSelector_${parameters.id?default("")?html}");
+ djConfig.searchIds.push("${parameters.id?html}");
+ <#if parameters.childrenIds?exists>
+ djConfig.searchIds.push(<#rt>
+ <#list parameters.childrenIds as childId>
+ "${childId?html}"<#if childId_has_next>,</#if><#t>
+ </#list>
+ );<#t>
+ </#if>
+</script>
+</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl Sun Aug 26 12:18:15 2007
@@ -30,7 +30,9 @@
</script>
<#if parameters.selectedNotifyTopics?exists || parameters.expandedNotifyTopics?exists
|| parameters.collapsedNotifyTopics?exists>
- <struts:StrutsTreeSelector widgetId="treeSelector_${parameters.id?default("")}"
+ <struts:StrutsTreeSelector
+ id="treeSelector_${parameters.id?default("")}"
+ widgetId="treeSelector_${parameters.id?default("")}"
<#if parameters.selectedNotifyTopics?exists>
selectedNotifyTopics="${parameters.selectedNotifyTopics?html}"
</#if>
Modified: struts/struts2/trunk/plugins/dojo/src/profile/README
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/profile/README?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/profile/README (original)
+++ struts/struts2/trunk/plugins/dojo/src/profile/README Sun Aug 26 12:18:15 2007
@@ -1,8 +1,8 @@
To build the Struts Dojo profile:
-1. Checkout Dojo from svn (${dojo} refers to root dir)
+1. Checkout Dojo from svn (${dojo} refers to dojo's root dir) (make sure that ${dojo} is on the same folder as ${struts})
-2. Copy struts.profile.js tp ${dojo}/buildscripts/profiles
+2. Copy struts.profile.js to ${dojo}/buildscripts/profiles
3. Copy /plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/ComboBox.css to
${dojo}/struts (Dojo build system doesn't resolve the relative paths that well in 0.4.2)
Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AbstractTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AbstractTagTest.java?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AbstractTagTest.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AbstractTagTest.java Sun Aug 26 12:18:15 2007
@@ -35,6 +35,7 @@
import org.apache.struts2.dispatcher.RequestMap;
import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.dojo.TestAction;
+import org.apache.struts2.dojo.components.Head;
import com.mockobjects.dynamic.Mock;
import com.opensymphony.xwork2.Action;
@@ -85,6 +86,7 @@
stack = ValueStackFactory.getFactory().createValueStack();
context = stack.getContext();
stack.push(action);
+ context.put(Head.PARSE_CONTENT, false);
request = new StrutsMockHttpServletRequest();
request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AutocompleterTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AutocompleterTest.java?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AutocompleterTest.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AutocompleterTest.java Sun Aug 26 12:18:15 2007
@@ -38,6 +38,7 @@
tag.setSearchType("b");
tag.setDisabled("c");
tag.setName("f");
+ tag.setId("f");
tag.setValue("g");
tag.setIndicator("h");
tag.setKeyName("i");
@@ -70,6 +71,7 @@
tag.setSearchType("b");
tag.setDisabled("c");
tag.setName("f");
+ tag.setId("f");
tag.setIconPath("i");
tag.setTemplateCssPath("j");
tag.setValueNotifyTopics("k");
Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java Sun Aug 26 12:18:15 2007
@@ -21,6 +21,7 @@
package org.apache.struts2.dojo.views.jsp.ui;
import org.apache.struts2.dojo.TestAction;
+import org.apache.struts2.dojo.components.Head;
/**
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?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- 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 Sun Aug 26 12:18:15 2007
@@ -40,6 +40,7 @@
tag.setBaseRelativePath("/path");
tag.setLocale("es");
tag.setCache("true");
+ tag.setParseContent("true");
tag.doStartTag();
tag.doEndTag();
Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/TabbedPanelTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/TabbedPanelTagTest.java?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/TabbedPanelTagTest.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/TabbedPanelTagTest.java Sun Aug 26 12:18:15 2007
@@ -28,7 +28,7 @@
public void testSimple() throws Exception {
TabbedPanelTag tag = new TabbedPanelTag();
tag.setPageContext(pageContext);
-
+ tag.setId("a");
tag.doStartTag();
tag.doEndTag();
Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-1.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-1.txt?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-1.txt (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-1.txt Sun Aug 26 12:18:15 2007
@@ -23,3 +23,4 @@
transport="m"
preload="true"
/>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("f");</script>
Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-2.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-2.txt?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-2.txt (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Autocompleter-2.txt Sun Aug 26 12:18:15 2007
@@ -18,3 +18,4 @@
<option value="d">d</option>
<option value="e">e</option>
</select>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("f");</script>
Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt Sun Aug 26 12:18:15 2007
@@ -25,4 +25,5 @@
"parseContent" : false
});
});
-</script>
\ No newline at end of file
+</script>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("a");</script>
\ No newline at end of file
Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/DateTimePickerTagTest-1.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/DateTimePickerTagTest-1.txt?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/DateTimePickerTagTest-1.txt (original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/DateTimePickerTagTest-1.txt Sun Aug 26 12:18:15 2007
@@ -14,4 +14,5 @@
valueNotifyTopics="k"
saveFormat="rfc">
</div>
+<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("id");</script>
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?rev=569863&r1=569862&r2=569863&view=diff
==============================================================================
--- 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 Sun Aug 26 12:18:15 2007
@@ -10,7 +10,8 @@
"a",
"b",
"c"
- ]
+ ],
+ parseWidgets: true
};
</script>