You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2005/02/22 18:25:00 UTC
svn commit: r154879 - in incubator/beehive/trunk/netui:
src/tags-html/org/apache/beehive/netui/tags/html/
test/webapps/drt/coreWeb/coretags/anchor/value/
test/webapps/drt/testRecorder/config/ test/webapps/drt/testRecorder/tests/
Author: dolander
Date: Tue Feb 22 09:24:57 2005
New Revision: 154879
URL: http://svn.apache.org/viewcvs?view=rev&rev=154879
Log:
Jira 242 -- Add a value attribute to the anchor so you can set the value through the tag instead of the
body content.
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/Controller.jpf
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/index.jsp
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAnchorValue.xml
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java?view=diff&r1=154878&r2=154879
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java Tue Feb 22 09:24:57 2005
@@ -115,6 +115,7 @@
public class Anchor extends AnchorBase
{
private String _text; // The body content of this tag (if any).
+ private String _value;
/**
* Returns the name of the Tag.
@@ -278,6 +279,21 @@
_state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TARGET, target);
}
+ /**
+ * This will set the text of the anchor. If there is body content, this
+ * will override that value.
+ * @param value - The text of the anchor.
+ * @jsptagref.attributedescription Set the text of the anchor.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_value</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="Set the text of the anchor overriding the body content"
+ * @netui.tldx:attribute category="misc"
+ */
+ public void setValue(String value)
+ {
+ _value = setNonEmptyValueAttribute(value);
+ }
/**
* Prepare the hyperlink for rendering
@@ -296,7 +312,7 @@
*/
public int doAfterBody() throws JspException
{
- if (bodyContent != null) {
+ if (bodyContent != null && _value == null) {
String value = bodyContent.getString().trim();
bodyContent.clearBody();
if (value.length() > 0)
@@ -315,6 +331,10 @@
if (hasErrors())
return reportAndExit(EVAL_PAGE);
+ if (_value != null) {
+ _text = _value;
+ }
+
// build the anchor into the results
ByRef script = new ByRef();
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/Controller.jpf
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/Controller.jpf?view=auto&rev=154879
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/Controller.jpf (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/Controller.jpf Tue Feb 22 09:24:57 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * $Header:$
+ */
+package coretags.anchor.value;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ * This is the default controller for a blank web application.
+ */
+@Jpf.Controller
+public class Controller extends PageFlowController
+{
+ private String _action;
+ public String getAction() {
+ return _action;
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="index", path="index.jsp")
+ }
+ )
+ protected Forward begin()
+ {
+ _action = "begin";
+ return new Forward("index");
+ }
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="index", path="index.jsp")
+ }
+ )
+ protected Forward action()
+ {
+ _action = "action";
+ return new Forward("index");
+ }
+
+
+}
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/index.jsp?view=auto&rev=154879
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/index.jsp (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/anchor/value/index.jsp Tue Feb 22 09:24:57 2005
@@ -0,0 +1,27 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <h4>Anchcor Value</h4>
+ <p style="color:green">Verify that an anchor value is set. The first two
+ should show the value attribute because it is set and overrides the body.
+ The second two, will show the body because the value is not set or is
+ the empty string.
+ </p>
+ <hr>
+ <ul>
+ <li><netui:anchor action="begin" value="No Body" /></li>
+ <li><netui:anchor action="begin" value="Ignore Body">This is the Body</netui:anchor></li>
+ <li><netui:anchor action="begin">This is the Body</netui:anchor></li>
+ <li><netui:anchor action="begin" value="">Empty String in Value</netui:anchor></li>
+ </ul>
+ </netui:body>
+</netui:html>
+
+
+
Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&r1=154878&r2=154879
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Tue Feb 22 09:24:57 2005
@@ -1952,6 +1952,19 @@
</features>
</test>
<test>
+ <name>CtAnchorValue</name>
+ <description>The value attribute can be used to set the text value of the anchor</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>bvt.struts11</category>
+ <category>tags</category>
+ </categories>
+ <features>
+ <feature>Anchor</feature>
+ </features>
+ </test>
+ <test>
<name>CtAreaBase</name>
<description>Base test of the Area tag</description>
<webapp>coreWeb</webapp>
Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAnchorValue.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAnchorValue.xml?view=auto&rev=154879
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAnchorValue.xml (added)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtAnchorValue.xml Tue Feb 22 09:24:57 2005
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session">
+ <ses:sessionName>CtAnchorValue</ses:sessionName>
+ <ses:tester>Daryl</ses:tester>
+ <ses:startDate>22 Feb 2005, 10:08:09.168 AM MST</ses:startDate>
+ <ses:description>Verify the behavior of the value attribute on the anchor tag.</ses:description>
+ <ses:tests>
+ <ses:test>
+ <ses:testNumber>1</ses:testNumber>
+ <ses:request>
+ <ses:protocol>HTTP</ses:protocol>
+ <ses:protocolVersion>1.1</ses:protocolVersion>
+ <ses:host>localhost</ses:host>
+ <ses:port>8080</ses:port>
+ <ses:uri>/coreWeb/coretags/anchor/value/Controller.jpf</ses:uri>
+ <ses:method>GET</ses:method>
+ <ses:parameters/>
+ <ses:cookies>
+ <ses:cookie>
+ <ses:name>JSESSIONID</ses:name>
+ <ses:value>00C8FA14F3BDA48653C5C4FA58C1B77B</ses:value>
+ </ses:cookie>
+ </ses:cookies>
+ <ses:headers>
+ <ses:header>
+ <ses:name>accept</ses:name>
+ <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-charset</ses:name>
+ <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-encoding</ses:name>
+ <ses:value>gzip,deflate</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>accept-language</ses:name>
+ <ses:value>en-us,en;q=0.5</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>connection</ses:name>
+ <ses:value>keep-alive</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>cookie</ses:name>
+ <ses:value>JSESSIONID=00C8FA14F3BDA48653C5C4FA58C1B77B</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>host</ses:name>
+ <ses:value>localhost:8080</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>keep-alive</ses:name>
+ <ses:value>300</ses:value>
+ </ses:header>
+ <ses:header>
+ <ses:name>user-agent</ses:name>
+ <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value>
+ </ses:header>
+ </ses:headers>
+ </ses:request>
+ <ses:response>
+ <ses:statusCode>200</ses:statusCode>
+ <ses:reason/>
+ <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+
+ <head>
+ <base href="http://localhost:8080/coreWeb/coretags/anchor/value/index.jsp">
+ </head>
+ <body>
+ <h4>Anchcor Value</h4>
+ <p style="color:green">Verify that an anchor value is set. The first two
+ should show the value attribute because it is set and overrides the body.
+ The second two, will show the body because the value is not set or is
+ the empty string.
+ </p>
+ <hr>
+ <ul>
+ <li><a href="/coreWeb/coretags/anchor/value/begin.do">No Body</a></li>
+ <li><a href="/coreWeb/coretags/anchor/value/begin.do">Ignore Body</a></li>
+ <li><a href="/coreWeb/coretags/anchor/value/begin.do">This is the Body</a></li>
+ <li><a href="/coreWeb/coretags/anchor/value/begin.do">Empty String in Value</a></li>
+ </ul>
+ </body>
+
+</html>]]></ses:responseBody>
+ </ses:response>
+ </ses:test>
+ </ses:tests>
+ <ses:endDate>22 Feb 2005, 10:08:15.957 AM MST</ses:endDate>
+ <ses:testCount>1</ses:testCount>
+</ses:recorderSession>
\ No newline at end of file