Author: dolander
Date: Fri Feb 11 08:55:33 2005
New Revision: 153420
URL: http://svn.apache.org/viewcvs?view=rev&rev=153420
Log:
Add the ServletRequest to the onExpand method so a tree element can get back to
the Session
Update the attribute names in error message for the beanXxxx attribute on the
form
A bit more cleanup in the Form
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeCRI.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHelpers.java
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/jpfScopedForms/test49/Jpf1.jpf
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtFormNullBinding.xml
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java?view=diff&r1=153419&r2=153420
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
Fri Feb 11 08:55:33 2005
@@ -199,13 +199,6 @@
public class Form extends HtmlBaseTag
implements IUrlParams
{
- /**
- * This is the name of the counter stored in the request used to genereate
the
- * next autogenerated id. This is used by the IHtmlIdWriter.getNextId()
method implemented
- * by the form.
- */
- public final String ID_REQUEST_ATTRIBUTE = "netuiIdGenerator";
-
private static final Logger logger = Logger.getInstance(Form.class);
// unique name of the form
@@ -220,13 +213,11 @@
private String _focus = null; // The name of the field to
receive focus, if any.
// @todo: did we support location in 8.1? How?
private String _location = null; // The location hash to
append to the url.
- private String _scope = null; // The scope (request or
session) under which our associated bean is stored
private String _text = null; // The body content of this
tag (if any).
- private String _name = null;
private String _beanName = null; // The name of the form
bean to (create and) use.
+ private String _type = null;
private String _beanType = null; // The type of the form
bean to (create and) use.
private String _beanScope = null; // The scope of the form
bean to (create and) use.
- private String _type = null; // The Java class name of
the bean to be created, if necessary.
private String _realName = null;
private String _id = null;
private String _formId = null;
@@ -241,8 +232,6 @@
private boolean _formSubmit = false;
private Map _params;
- private int _nextId;
-
/**
* Return the name of the Tag.
*/
@@ -405,9 +394,8 @@
public void setBeanName(String name)
throws JspException
{
- _name = setRequiredValueAttribute(name, "name");
// @todo: we need to verify what happens if this is null and type is
set.
- //_state.name =
+ _beanName = setRequiredValueAttribute(name, "beanName");
}
/**
@@ -476,7 +464,7 @@
public void setBeanScope(String scope)
throws JspException
{
- _scope = setRequiredValueAttribute(scope, "scope");
+ _beanScope = setRequiredValueAttribute(scope, "beanScope");
}
/**
@@ -510,7 +498,7 @@
public void setBeanType(String type)
throws JspException
{
- _type = setRequiredValueAttribute(type, "type");
+ _type = setRequiredValueAttribute(type, "beanType");
}
/**
@@ -576,16 +564,12 @@
HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
ServletContext servletContext = pageContext.getServletContext();
- lookup(request, servletContext);
+ // find the beanName, beanType and beanScope
+ lookupBeanScopeAndName(request, servletContext);
if (hasErrors())
return SKIP_BODY;
// Create an appropriate "form" element based on our parameters
- Integer nextId = (Integer) request.getAttribute(ID_REQUEST_ATTRIBUTE);
- if (nextId == null)
- nextId = new Integer(0);
- _nextId = nextId.intValue();
-
// Generate the form id and save it in addition save any value
// that was set for tagId.
_formId = FORM_ID + getNextId(request);
@@ -657,7 +641,6 @@
}
if (bean != null) {
pageContext.setAttribute(Constants.BEAN_KEY, bean,
PageContext.REQUEST_SCOPE);
-
ImplicitObjectUtil.loadActionForm(pageContext, bean);
}
@@ -696,8 +679,6 @@
HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
ServletContext servletContext = pageContext.getServletContext();
- request.setAttribute(ID_REQUEST_ATTRIBUTE, new Integer(_nextId));
-
_state.name = _beanName;
if (_beanName == null) {
_setRealName = true;
@@ -942,13 +923,11 @@
_focus = null;
_location = null;
_targetScope = null;
- _scope = null;
_text = null;
_mapping = null;
_beanName = null;
_beanType = null;
_beanScope = null;
- _type = null;
_realName = null;
_id = null;
_formId = null;
@@ -967,7 +946,7 @@
* <code>type</code> properties if necessary.
* @throws JspException if a required value cannot be looked up
*/
- private void lookup(HttpServletRequest request, ServletContext
servletContext)
+ private void lookupBeanScopeAndName(HttpServletRequest request,
ServletContext servletContext)
throws JspException
{
// Look up the application module configuration information we need
@@ -996,17 +975,17 @@
_flowController = mac.controller;
_mapping = mac.mapping;
+ assert (_mapping != null) : "Mapping not found for controller";
_appConfig = _mapping.getModuleConfig();
- assert _mapping != null;
// Were the required values already specified?
- if (_name != null) {
+ if (_beanName != null) {
if (_type == null) {
registerTagError(Bundle.getString("Tags_FormNameNoType"),
null);
return;
}
- _beanName = _name;
- _beanScope = (_scope == null ? "session" : _scope);
+ if (_beanScope == null)
+ _beanScope = "session";
_beanType = _type;
return;
}
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java?view=diff&r1=153419&r2=153420
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/javascript/ScriptHeader.java
Fri Feb 11 08:55:33 2005
@@ -28,7 +28,7 @@
/**
* ScriptHeader will write the <script> and JavaScript includes into the
HTML <head> tag.
* @jsptagref.tagdescription ScriptHeader will write the <script> and
JavaScript includes into the HTML <head> tag.
- * @netui:tag name="scriptHeader" description="ScriptHeader will write the
<script> and JavaScript includes into the HTML <head> tag."
+ * @netui:tag name="scriptHeader" body-content="empty"
description="ScriptHeader will write the <script> and JavaScript includes
into the HTML <head> tag."
* @netui.tldx:tag
renderer="workshop.netui.jspdesigner.tldx.ScriptHeaderRenderer"
whitespace="indent"
*/
public class ScriptHeader extends AbstractClassicTag
@@ -58,7 +58,7 @@
// write out the include
ScriptTag.State state = new ScriptTag.State();
TagRenderingBase br =
TagRenderingBase.Factory.getRendering(TagRenderingBase.SCRIPT_TAG,
pageContext.getRequest());
- ;
+
state.src = req.getContextPath() +
"/resources/beehive/version1/javascript/netui-tree.js";
br.doStartTag(writer, state);
br.doEndTag(writer);
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeCRI.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeCRI.java?view=diff&r1=153419&r2=153420
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeCRI.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeCRI.java
Fri Feb 11 08:55:33 2005
@@ -103,7 +103,7 @@
System.err.println("Element '" + node + "' not found in the tree");
return;
}
- elem.onExpand();
+ elem.onExpand(req);
elem.setExpanded(expand);
if (expandSvr != null) {
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java?view=diff&r1=153419&r2=153420
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeElement.java
Fri Feb 11 08:55:33 2005
@@ -17,6 +17,7 @@
*/
package org.apache.beehive.netui.tags.tree;
+import javax.servlet.ServletRequest;
import java.io.Serializable;
import java.util.ArrayList;
@@ -511,7 +512,7 @@
/**
* Code that runs when the node is expanded.
*/
- public void onExpand()
+ public void onExpand(ServletRequest request)
{
//do nothing
}
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHelpers.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHelpers.java?view=diff&r1=153419&r2=153420
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHelpers.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/TreeHelpers.java
Fri Feb 11 08:55:33 2005
@@ -61,7 +61,7 @@
if (expandNode != null) {
TreeElement n = treeRoot.findNode(expandNode);
if (n != null) {
- n.onExpand();
+ n.onExpand(request);
n.setExpanded(!n.isExpanded());
}
}
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/jpfScopedForms/test49/Jpf1.jpf
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/jpfScopedForms/test49/Jpf1.jpf?view=diff&r1=153419&r2=153420
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/jpfScopedForms/test49/Jpf1.jpf
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/jpfScopedForms/test49/Jpf1.jpf
Fri Feb 11 08:55:33 2005
@@ -88,15 +88,15 @@
//System.out.println("\t>>> inForm: " + inForm.toString());
if (inForm != _form1)
{
- //System.out.println("\t>>> inForm & _form1 are not the same
instance and should be.");
+ System.out.println("\t>>> inForm & _form1 are not the same
instance and should be.");
return new Forward("gotoError");
}
if ((inForm.getString1().equals(_STR1) == true)
||
(inForm.getString2().equals(_STR2) == true))
{
- //System.out.println("\t>>> inForm.String1: (" +
inForm.getString1() + ").");
- //System.out.println("\t>>> inForm.String2: (" +
inForm.getString2() + ").");
+ System.out.println("\t>>> inForm.String1: (" +
inForm.getString1() + ").");
+ System.out.println("\t>>> inForm.String2: (" +
inForm.getString2() + ").");
return new Forward("gotoError");
}
_form1.setString1(_STR1); // Set the values to a specific string
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtFormNullBinding.xml
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtFormNullBinding.xml?view=diff&r1=153419&r2=153420
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtFormNullBinding.xml
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtFormNullBinding.xml
Fri Feb 11 08:55:33 2005
@@ -2,7 +2,7 @@
<ses:recorderSession
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
<ses:sessionName>CtFormNullBinding</ses:sessionName>
<ses:tester>Daryl</ses:tester>
- <ses:startDate>18 Jan 2005, 06:45:45.375 PM MST</ses:startDate>
+ <ses:startDate>10 Feb 2005, 08:56:07.568 PM MST</ses:startDate>
<ses:description>Daryl</ses:description>
<ses:tests>
<ses:test>
@@ -18,7 +18,7 @@
<ses:cookies>
<ses:cookie>
<ses:name>JSESSIONID</ses:name>
- <ses:value>401BA83031A94CBDA416B26EB0A88FB5</ses:value>
+ <ses:value>D8E35F6757012164E9E10EECB7012EFF</ses:value>
</ses:cookie>
</ses:cookies>
<ses:headers>
@@ -40,7 +40,7 @@
</ses:header>
<ses:header>
<ses:name>cookie</ses:name>
- <ses:value>$Version=0;
JSESSIONID=401BA83031A94CBDA416B26EB0A88FB5; $Path=/coreWeb</ses:value>
+ <ses:value>$Version=0;
JSESSIONID=D8E35F6757012164E9E10EECB7012EFF; $Path=/coreWeb</ses:value>
</ses:header>
<ses:header>
<ses:name>host</ses:name>
@@ -48,7 +48,7 @@
</ses:header>
<ses:header>
<ses:name>testrecorder.playback.testid</ses:name>
- <ses:value>-54834ffa:101889e165b:-7dd4</ses:value>
+ <ses:value>-18998ab2:101ff872491:-7db7</ses:value>
</ses:header>
<ses:header>
<ses:name>user-agent</ses:name>
@@ -102,11 +102,11 @@
<tr><th colspan="6">Page Errors</th></tr>
<tr><th>Error Number</th><th>Tag Type</th><th colspan="4">Error</th></tr>
<tr><th>1</th><th>Form</th><th>Message</th><td>The type of a button must be
one of submit, button or reset, found ''.</td></tr>
-<tr><th>2</th><th>Form</th><th>Message</th><td>Attribute 'scope' is required
to have a value. The value "" is illegal. This is often cause by binding to
an object with a null value.</td></tr>
+<tr><th>2</th><th>Form</th><th>Message</th><td>Attribute 'beanScope' is
required to have a value. The value "" is illegal. This is often cause by
binding to an object with a null value.</td></tr>
<tr><th>3</th><th>Form</th><th>Message</th><td>Attribute 'action' is required
to have a value. The value "" is illegal. This is often cause by binding to
an object with a null value.</td></tr>
<tr><th>4</th><th>Form</th><th>Message</th><td>Attribute 'tagId' is required
to have a value. The value "" is illegal. This is often cause by binding to
an object with a null value.</td></tr>
-<tr><th>5</th><th>Form</th><th>Message</th><td>Attribute 'type' is required to
have a value. The value "" is illegal. This is often cause by binding to an
object with a null value.</td></tr>
-<tr><th>6</th><th>Form</th><th>Message</th><td>Attribute 'name' is required to
have a value. The value "" is illegal. This is often cause by binding to an
object with a null value.</td></tr>
+<tr><th>5</th><th>Form</th><th>Message</th><td>Attribute 'beanType' is
required to have a value. The value "" is illegal. This is often cause by
binding to an object with a null value.</td></tr>
+<tr><th>6</th><th>Form</th><th>Message</th><td>Attribute 'beanName' is
required to have a value. The value "" is illegal. This is often cause by
binding to an object with a null value.</td></tr>
</table></div>
</body>
@@ -117,7 +117,7 @@
</ses:testResults>
</ses:test>
</ses:tests>
- <ses:endDate>18 Jan 2005, 06:45:46.437 PM MST</ses:endDate>
+ <ses:endDate>10 Feb 2005, 08:56:09.221 PM MST</ses:endDate>
<ses:sessionStatus>fail</ses:sessionStatus>
<ses:testCount>1</ses:testCount>
<ses:passedCount>0</ses:passedCount>