Author: dolander
Date: Wed Feb 9 20:52:59 2005
New Revision: 153154
URL: http://svn.apache.org/viewcvs?view=rev&rev=153154
Log:
Jira 269 -- The tree tags didn't work when runAtClient was on for a dynamically
created tree because they didn't get registered with the NameService. I moved
the registration code so that it works for any tree.
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/dynamicClient.jsp
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java?view=diff&r1=153153&r2=153154
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
Wed Feb 9 20:52:59 2005
@@ -617,24 +617,30 @@
reportErrors();
return;
}
+ }
+
+ // if we are running the tree at the client, then
+ // we need to register the tree with the NameService
+ if (_trs.runAtClient) {
+ // it's currently not legal to have a runAtClient but not be an
instance of INameable which is
+ // implemented by the ITreeRootElement.
+ if (!(treeRoot instanceof INameable)) {
+ String s = Bundle.getString("Tags_TreeRunAtClientRoot", null);
+ registerTagError(s, null);
+ reportErrors();
+ return;
+ }
- // if we are running the tree at the client, then
- // we need to register the tree with the NameService
- if (_trs.runAtClient && treeRoot instanceof INameable) {
+ // name the tree if it hasn't been named already
+ INameable in = (INameable) treeRoot;
+ String o = in.getObjectname();
+ if (o == null) {
NameService ns =
NameService.instance(pageContext.getSession());
- ns.nameObject("Tree", (INameable) treeRoot);
- ns.put((INameable) treeRoot);
+ ns.nameObject("Tree", in);
+ ns.put(in);
}
}
- // it's currently not legal to have a runAtClient but not be an
instance of INameable which is
- // implemented by the ITreeRootElement.
- if (_trs.runAtClient && (!(treeRoot instanceof INameable))) {
- String s = Bundle.getString("Tags_TreeRunAtClientRoot", null);
- registerTagError(s, null);
- reportErrors();
- return;
- }
// prepare to render the tree
HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf?view=diff&r1=153153&r2=153154
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/Controller.jpf
Wed Feb 9 20:52:59 2005
@@ -22,6 +22,7 @@
import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
import org.apache.beehive.netui.tags.tree.TreeElement;
+import org.apache.beehive.netui.tags.tree.TreeRootElement;
import org.apache.beehive.netui.pageflow.FormData;
import org.apache.beehive.netui.pageflow.requeststate.NameService;
@@ -67,6 +68,7 @@
private TreeElement _tree33;
private TreeElement _tree34;
private TreeElement _tree35;
+ private TreeElement _tree36;
private String _expand = " ";
private String _node = " ";
@@ -349,6 +351,14 @@
public void setTree35(TreeElement tn) {
_tree35 = tn;
}
+
+ public TreeElement getTree36() {
+ return _tree36;
+ }
+
+ public void setTree36(TreeElement tn) {
+ _tree36 = tn;
+ }
//************************************************************************
@@ -498,6 +508,21 @@
t1 = new TreeElement("Node: 0.2",true);
_tree21.addChild(t1);
}
+
+ // Build Tree ThirtySix
+ {
+ _tree36 = new TreeRootElement("Tree 0",false);
+ _tree36.setAction("postback");
+ _tree36.setExpandOnServer(true);
+ TreeElement t1 = new TreeElement("Node: 0.0",false);
+ _tree36.addChild(t1);
+ TreeElement t2 = new TreeElement("Node: 0.0.0",false);
+ t1.addChild(t2);
+ t1 = new TreeElement("Node: 1.0",false);
+ _tree36.addChild(t1);
+ t2 = new TreeElement("Node: 1.0.0",false);
+ t1.addChild(t2);
+ }
}
@Jpf.Action(forwards = {
@@ -603,6 +628,7 @@
_tree33 = null;
_tree34 = null;
_tree35 = null;
+ _tree36 = null;
buildTrees();
return forward;
@@ -911,6 +937,17 @@
Forward forward = new Forward("success");
NameService ns = NameService.instance(getRequest().getSession());
ns.debugSetNameIntValue(721);
+ clearExpand();
+ return forward;
+ }
+
+ @Jpf.Action(forwards = {
+ @Jpf.Forward(name = "success", path = "dynamicClient.jsp")
+})
+ protected Forward goDynamicClient() {
+ Forward forward = new Forward("success");
+ NameService ns = NameService.instance(getRequest().getSession());
+ ns.debugSetNameIntValue(319);
clearExpand();
return forward;
}
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/dynamicClient.jsp
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/dynamicClient.jsp?view=auto&rev=153154
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/dynamicClient.jsp
(added)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/dynamicClient.jsp
Wed Feb 9 20:52:59 2005
@@ -0,0 +1,44 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0"
prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0"
prefix="netui-template"%>
+<netui:html idScope="tree">
+ <head>
+ <title>dynamicClient.jsp</title>
+ <link href="style.css" rel="stylesheet" type="text/css">
+ <netui:base/>
+ </head>
+ <netui:body>
+ <h4 class="title"><netui:anchor action="begin"
styleClass="homeAnchor">Home</netui:anchor>dynamicClient.jsp
[goDynamicClient.do] </h4>
+ <!-- Attribute Information -->
+ <div style='float:left;width:300px'>
+ <table cellpadding="2" cellspacing="0" border="1" width="300px">
+ <tr><th>Creation</th><td>dynamic</td></tr>
+ <tr><th>tree</th><td>{pageFlow.tree36}</td></tr>
+ <tr><th>runAtClient</th><td>true</td></tr>
+ <tr><th>action</th><td>postback</td></tr>
+ </table>
+ </div>
+ <!-- Postback information -->
+ <div style='float:right;width:250px;border:solid 1pt gray;margin:2 4;'>
+ <p style="font-weight:bold;text-align:center;margin:
0;padding:0;">Tree Postback Information</p>
+ <table cellpadding='0' cellspacing='2' width="100%">
+ <tr><th style="text-align:right"
width="100pt">Expand:</th><td><netui:content
value="${pageFlow.expand}"/></td></tr>
+ <tr><th style="text-align:right"
width="100pt">Selection:</th><td><netui:content
value="${pageFlow.node}"/></td></tr>
+ </table>
+ </div>
+ <hr style="clear:left">
+ <div class="content">
+ <table width="100%" border="1" cellspacing="0" cellpadding="0">
+ <tr><td widht="50%" valign="top">
+ <netui:scriptContainer generateIdScope="true">
+ <netui:scriptHeader />
+ <netui:tree dataSource="pageFlow.tree36" selectionAction="postback"
+ selectionStyle="color:red" unselectStyle="color:blue"
+ tagId="tree" runAtClient="true" />
+ </netui:scriptContainer>
+ </td></tr>
+ </table>
+ </div>
+ </netui:body>
+</netui:html>
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp?view=diff&r1=153153&r2=153154
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp
(original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/richTree/index.jsp
Wed Feb 9 20:52:59 2005
@@ -90,6 +90,9 @@
<tr><td><netui:anchor
action="goExpandOnServer">RichTreeExpandOnServer</netui:anchor></td>
<td> Base test of expand on
server.</td><td>goExpandOnServer</td><td>expandOnServer.jsp</td>
<td>tree27</td></tr>
+ <tr><td><netui:anchor
action="goDynamicClient">RichTreeDynamicClient</netui:anchor></td>
+ <td>Dynamically created
runAtClient</td><td>goDynamicClient</td><td>dynamicClient.jsp</td>
+ <td>tree36</td></tr>
</table>
<br>
<table width="100%" border='1' cellpadding='1' cellspacing='0'>