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/10/19 17:31:56 UTC
svn commit: r326581 [1/9] - in /beehive/trunk/netui: ant/
src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/ src/jar-assembly/
src/pageflow/org/apache/beehive/netui/pageflow/ src/simple-tags/
src/simple-tags/org/ src/simple-tags/org/apache/ src/...
Author: dolander
Date: Wed Oct 19 08:29:22 2005
New Revision: 326581
URL: http://svn.apache.org/viewcvs?rev=326581&view=rev
Log:
This is a prototype of a new Tag Library called SimpleTags.
The tags support the same features as the core HTML tags. There
is only a limitted set of tags currently implemented:
Anchor, Base, Body, Button, Form, FormatDate, Html, Image, ImageAnchor,
Parameter, ParameterMap, ScriptContainer and TextBox.
These are placed into the tag .jar file and are can be used by including
the following line in your JSP:
<%@ taglib uri="http://beehive.apache.org/netui/simple-tags-0.9" prefix="st"%>
There is also a modification to the core Page Flow code to create a PageFlowContext,
providing a method to get the Request, Response, ServletContext and feature dependent
context objects.
Added:
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContext.java (with props)
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextActivator.java (with props)
beehive/trunk/netui/src/simple-tags/
beehive/trunk/netui/src/simple-tags/build.xml (with props)
beehive/trunk/netui/src/simple-tags/org/
beehive/trunk/netui/src/simple-tags/org/apache/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/Appender.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/ResponseAppender.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/StringBuilderAppender.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBaseBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/BaseBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/BodyBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/ButtonBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/FormBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/HtmlBaseBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/HtmlBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/HtmlDataSourceBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/HtmlDefaultableDataSourceBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/HtmlFocusBaseBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/ImageAnchorBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/ImageBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/ScriptContainerBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/TextBoxBehavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/formatting/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/formatting/DateFormatter.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/formatting/Formatter.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/formatting/FormatterException.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/AbstractPageError.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/Behavior.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/EvalErrorInfo.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/ExpressionHandling.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/IDocumentTypeProducer.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/IErrorCollector.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/IFormattable.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/IHasPopupSupport.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/IUrlParams.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/PopupSupport.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/ReturnActionViewRenderer.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/TagContext.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/TagErrorHandling.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/TagErrorInfo.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/services/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/services/BehaviorStack.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/services/ErrorReporter.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/services/IdScopeStack.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/core/services/ScriptReporter.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/HtmlConstants.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/HtmlUtils.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/IHtmlAccessable.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/IHtmlAttrs.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/IHtmlCore.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/IHtmlEvents.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/html/IHtmlI18n.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/javascript/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/javascript/CoreScriptFeature.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/javascript/ScriptPlacement.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/AbstractSimpleTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Anchor.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/AnchorBase.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Base.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Body.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Button.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Form.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/FormatDate.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/FormatTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Html.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/HtmlBaseTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/HtmlDataSourceTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/HtmlDefaultableDataSourceTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/HtmlFocusBaseTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Image.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/ImageAnchor.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/Parameter.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/ParameterMap.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/ScriptContainer.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/jsptags/TextBox.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/naming/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/naming/FormDataNameInterceptor.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/naming/INameInterceptor.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/naming/IndexedNameInterceptor.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/naming/PrefixNameInterceptor.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/AbstractAttributeState.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/AbstractHtmlControlState.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/AbstractHtmlState.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/AbstractTagState.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/AnchorTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/AreaTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/BaseTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/BodyTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/CaptionTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ConstantRendering.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/DivTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/FormTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/HtmlTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ImageTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/InputBooleanTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/InputFileTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/InputHiddenTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/InputImageTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/InputSubmitTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/InputTextTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/LabelTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/OptionTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ScriptTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/SelectTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/SpanTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TBodyTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TFootTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/THeadTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TableTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TagHtmlBase.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TagRenderingBase.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TdTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TextAreaTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/ThTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/rendering/TrTag.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/ContextUtils.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowAdaptor.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/PageFlowTagUtils.java (with props)
beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/util/RequestUtils.java (with props)
Modified:
beehive/trunk/netui/ant/build.xml
beehive/trunk/netui/ant/javadoc.xml
beehive/trunk/netui/ant/netui.properties
beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt
beehive/trunk/netui/src/jar-assembly/build.xml
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
Modified: beehive/trunk/netui/ant/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/ant/build.xml?rev=326581&r1=326580&r2=326581&view=diff
==============================================================================
--- beehive/trunk/netui/ant/build.xml (original)
+++ beehive/trunk/netui/ant/build.xml Wed Oct 19 08:29:22 2005
@@ -71,6 +71,7 @@
<file name="core"/>
<file name="pageflow"/>
<file name="tomcat-webapp"/>
+ <file name="simple-tags"/>
<file name="tags-html"/>
<file name="tags-databinding"/>
<file name="tags-template"/>
@@ -92,6 +93,7 @@
<file name="core"/>
<file name="pageflow"/>
<file name="tomcat-webapp"/>
+ <file name="simple-tags"/>
<file name="tags-html"/>
<file name="tags-databinding"/>
<file name="tags-template"/>
Modified: beehive/trunk/netui/ant/javadoc.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/ant/javadoc.xml?rev=326581&r1=326580&r2=326581&view=diff
==============================================================================
--- beehive/trunk/netui/ant/javadoc.xml (original)
+++ beehive/trunk/netui/ant/javadoc.xml Wed Oct 19 08:29:22 2005
@@ -112,6 +112,7 @@
<packageset dir="${src.dir}/pageflow"/>
<packageset dir="${src.dir}/scoping"/>
<packageset dir="${src.dir}/tags-databinding"/>
+ <packageset dir="${src.dir}/simple-tags"/>
<packageset dir="${src.dir}/tags-html"/>
<packageset dir="${src.dir}/tags-template"/>
<packageset dir="${src.dir}/util"/>
@@ -166,6 +167,9 @@
<include name="org/apache/beehive/netui/tags/html"/>
<include name="org/apache/beehive/netui/tags/javascript"/>
<include name="org/apache/beehive/netui/tags/tree"/>
+ </packageset>
+ <packageset dir="${src.dir}/simple-tags">
+ <include name="org/apache/beehive/netui/simpletags/jsptags"/>
</packageset>
<packageset dir="${src.dir}/tags-template">
<include name="org/apache/beehive/netui/tags/template"/>
Modified: beehive/trunk/netui/ant/netui.properties
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/ant/netui.properties?rev=326581&r1=326580&r2=326581&view=diff
==============================================================================
--- beehive/trunk/netui/ant/netui.properties (original)
+++ beehive/trunk/netui/ant/netui.properties Wed Oct 19 08:29:22 2005
@@ -63,6 +63,7 @@
netui-tomcat-webapp.5x.jar.name=beehive-netui-tomcat-webapp-5x.jar
# NetUI TLD Names
+netui-tags-simple.tld.name=beehive-netui-tags-simple.tld
netui-tags-html.tld.name=beehive-netui-tags-html.tld
netui-tags-template.tld.name=beehive-netui-tags-template.tld
netui-tags-databinding.tld.name=beehive-netui-tags-databinding.tld
Modified: beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt?rev=326581&r1=326580&r2=326581&view=diff
==============================================================================
--- beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt (original)
+++ beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt Wed Oct 19 08:29:22 2005
@@ -50,6 +50,9 @@
<XDtClass:ifHasClassTag tagName="netui:tag" paramName="body-content" values="JSP,empty,scriptless,tagdependent">
<body-content><XDtClass:classTagValue tagName="netui:tag" paramName="body-content"/></body-content>
</XDtClass:ifHasClassTag>
+ <XDtClass:ifHasClassTag tagName="netui:tag" paramName="dynamic-attributes" values="true">
+ <dynamic-attributes><XDtClass:classTagValue tagName="netui:tag" paramName="dynamic-attributes"/></dynamic-attributes>
+ </XDtClass:ifHasClassTag>
</XDtConfig:ifConfigParamGreaterOrEquals>
<XDtNetUITldGen:forAllAttributes tagName="netui:attribute">
Modified: beehive/trunk/netui/src/jar-assembly/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/jar-assembly/build.xml?rev=326581&r1=326580&r2=326581&view=diff
==============================================================================
--- beehive/trunk/netui/src/jar-assembly/build.xml (original)
+++ beehive/trunk/netui/src/jar-assembly/build.xml Wed Oct 19 08:29:22 2005
@@ -9,10 +9,12 @@
<target name="build">
<jar jarfile="${build.lib.dir}/beehive-netui-tags.jar">
+ <fileset dir="${classes.dir}/simple-tags"/>
<fileset dir="${classes.dir}/tags-html"/>
<fileset dir="${classes.dir}/tags-databinding"/>
<fileset dir="${classes.dir}/tags-template"/>
<zipfileset file="${build.lib.dir}/${netui-tags-html.tld.name}" prefix="META-INF"/>
+ <zipfileset file="${build.lib.dir}/${netui-tags-simple.tld.name}" prefix="META-INF"/>
<zipfileset file="${build.lib.dir}/${netui-tags-databinding.tld.name}" prefix="META-INF"/>
<zipfileset file="${build.lib.dir}/${netui-tags-template.tld.name}" prefix="META-INF"/>
<manifest>
Added: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContext.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContext.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContext.java (added)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContext.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,134 @@
+package org.apache.beehive.netui.pageflow;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This class is a ThreadLocal class that contains the servlet information. In addition,
+ * it supports a Map that allows other aspects of the framework to create place
+ * their own context objects into the thread local context.
+ */
+public class PageFlowContext
+{
+ static ThreadLocal pageflowContext = new PageFlowContextThreadLocal();
+
+ // The context will provide access to the Servlet objects
+ // @todo: do we want to abstract these further to provide an abstraction removing the Servlet API?
+ private HttpServletRequest _request;
+ private HttpServletResponse _response;
+ private ServletContext _servletContext;
+
+ // map containin other context objects
+ private Map _contexts = new HashMap();
+
+ /**
+ * Factory method that will return the <code>PageFlowContext</code> object to the caller.
+ * @return A <code>PageFlowContext</code> that is associated with the tread.
+ */
+ public static PageFlowContext getContext() {
+ PageFlowContext ctxt = (PageFlowContext) pageflowContext.get();
+ if (ctxt == null) {
+ ctxt = new PageFlowContext();
+ pageflowContext.set(ctxt);
+ }
+ return ctxt;
+ }
+
+ /**
+ * Return the request object.
+ * @return The <code>HttpServletRequest</code> object.
+ */
+ public HttpServletRequest getRequest()
+ {
+ return _request;
+ }
+
+ /**
+ * Set the request object.
+ * @param request The <code>HttpServletRequst</code>
+ */
+ public void setRequest(HttpServletRequest request)
+ {
+ _request = request;
+ }
+
+ /**
+ * Return the response object to the caller.
+ * @return The <code>HttpServletResponse</code> object.
+ */
+ public HttpServletResponse getResponse()
+ {
+ return _response;
+ }
+
+ /**
+ * Set the response object on the context.
+ * @param response The <code>HttpServletResponse</code> object.
+ */
+ public void setResponse(HttpServletResponse response)
+ {
+ _response = response;
+ }
+
+ /**
+ * Return the servlet context.
+ * @return The <code>ServletContext</code> object for this request.
+ */
+ public ServletContext getServletContext()
+ {
+ return _servletContext;
+ }
+
+ /**
+ * Set the servlet context for this request.
+ * @param servletContext The <code>ServletContext</code> object.
+ */
+ public void setServletContext(ServletContext servletContext)
+ {
+ _servletContext = servletContext;
+ }
+
+ /**
+ * This method will lookup a named object and return it. The object is
+ * looked up by name. If the object doesn't exist, the activator object is
+ * called to create a new instance of the object before it is returned.
+ * @param name The name of the object to return
+ * @param activator An <code>PageFlowContextActivator</code> that will create the new object if
+ * it doesn't exist.
+ * @return The object stored by the name.
+ */
+ public Object get(String name,PageFlowContextActivator activator)
+ {
+ assert (name != null) : "Parameter 'name' must not be null";
+ assert (activator != null) : "Parameter 'activator' must not be null";
+
+ Object ret = _contexts.get(name);
+ if (ret == null) {
+ ret = activator.activate();
+ _contexts.put(name,ret);
+ }
+ return ret;
+ }
+
+ /**
+ * Place the context into it's initialized state.
+ */
+ public void init() {
+ _request = null;
+ _response = null;
+ _servletContext = null;
+ _contexts.clear();
+ }
+
+ /**
+ * Thread local...
+ */
+ private static class PageFlowContextThreadLocal extends ThreadLocal {
+ protected Object initializeValue() {
+ return new PageFlowContext();
+ }
+ }
+}
Propchange: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextActivator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextActivator.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextActivator.java (added)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextActivator.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,13 @@
+package org.apache.beehive.netui.pageflow;
+
+/**
+ * This interface will create an object that will be put into the PageFlow
+ * context, it it doesn't already exist there.
+ */
+public interface PageFlowContextActivator
+{
+ /**
+ * This method will create the object and return it.
+ */
+ Object activate();
+}
Propchange: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextActivator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java?rev=326581&r1=326580&r2=326581&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java Wed Oct 19 08:29:22 2005
@@ -17,61 +17,48 @@
*/
package org.apache.beehive.netui.pageflow;
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Set;
-import java.util.Map;
-
-import org.apache.struts.util.RequestUtils;
-import org.apache.struts.util.MessageResources;
-import org.apache.struts.action.ActionServlet;
-import org.apache.struts.action.ActionMapping;
+import org.apache.beehive.netui.core.urls.URLRewriterService;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.internal.*;
+import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
+import org.apache.beehive.netui.util.internal.FileUtils;
+import org.apache.beehive.netui.util.internal.ServletUtils;
+import org.apache.beehive.netui.util.logging.Logger;
+import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionServlet;
import org.apache.struts.config.ModuleConfig;
-import org.apache.struts.Globals;
+import org.apache.struts.util.MessageResources;
+import org.apache.struts.util.RequestUtils;
-import org.apache.beehive.netui.core.urls.URLRewriterService;
-import org.apache.beehive.netui.util.logging.Logger;
-import org.apache.beehive.netui.util.internal.FileUtils;
-import org.apache.beehive.netui.util.internal.ServletUtils;
-import org.apache.beehive.netui.pageflow.internal.DefaultURLRewriter;
-import org.apache.beehive.netui.pageflow.internal.JavaControlUtils;
-import org.apache.beehive.netui.pageflow.internal.InternalUtils;
-import org.apache.beehive.netui.pageflow.internal.InternalConstants;
-import org.apache.beehive.netui.pageflow.internal.AdapterManager;
-import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
-import org.apache.beehive.netui.pageflow.internal.PageFlowInitialization;
-import org.apache.beehive.netui.pageflow.handler.Handlers;
-import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
/**
* Base class for Servlet Filters that run before Page Flow page requests.
- */
+ */
public abstract class PageFlowPageFilter implements Filter
{
private ServletContext _servletContext;
private ServletContainerAdapter _servletContainerAdapter;
private FlowControllerFactory _flowControllerFactory;
-
+
private static final Logger _log = Logger.getInstance( PageFlowPageFilter.class );
-
+
private static final String PREVENT_CACHE_ATTR = InternalConstants.ATTR_PREFIX + "preventCache";
-
-
+
+
protected PageFlowPageFilter()
{
}
-
+
PageFlowPageFilter( ServletContext servletContext )
{
_servletContext = servletContext;
@@ -82,18 +69,18 @@
public void init( FilterConfig filterConfig ) throws ServletException
{
_servletContext = filterConfig.getServletContext();
-
+
if ( ! PageFlowInitialization.isInit( _servletContext ) )
{
PageFlowInitialization.performInitializations(_servletContext, null);
}
-
+
_servletContainerAdapter = AdapterManager.getServletContainerAdapter( _servletContext );
_flowControllerFactory = FlowControllerFactory.get( _servletContext );
}
-
+
protected abstract Set getValidFileExtensions();
-
+
public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
throws IOException, ServletException
{
@@ -101,7 +88,7 @@
{
HttpServletRequest httpRequest = ( HttpServletRequest ) request;
HttpServletResponse httpResponse = ( HttpServletResponse ) response;
-
+
//
// Don't do the filter if the request is in error.
//
@@ -112,15 +99,15 @@
{
_log.debug( "Request has error status code " + errStatusCode + ". Skipping filter." );
}
-
+
continueChainNoWrapper( request, response, chain );
- return;
+ return;
}
-
+
String servletPath = InternalUtils.getDecodedServletPath( httpRequest );
String extension = FileUtils.getFileExtension( servletPath );
Set validFileExtensions = getValidFileExtensions();
-
+
if ( validFileExtensions != null && ! validFileExtensions.contains( extension ) )
{
if ( _log.isDebugEnabled() )
@@ -128,25 +115,25 @@
_log.debug( "Path " + servletPath +
" does not have an appropriate file extension. Skipping filter." );
}
-
+
continueChainNoWrapper( request, response, chain );
return;
}
-
+
if ( _log.isDebugEnabled() ) _log.debug( "Filtering request for path " + servletPath );
-
+
//
// If at an earlier stage in the request we determined that we should prevent caching,
// actually write the appropriate headers to the response now.
//
if ( request.getAttribute( PREVENT_CACHE_ATTR ) != null ) ServletUtils.preventCache( httpResponse );
-
+
//
// Initialize the ServletContext in the request. Often, we need access to the ServletContext when we only
// have a ServletRequest.
//
InternalUtils.setServletContext( httpRequest, _servletContext );
-
+
//
// Callback to the server adapter.
//
@@ -155,11 +142,20 @@
RequestContext requestContext = new RequestContext( request, response );
er.beginPageRequest( requestContext );
long startTime = System.currentTimeMillis();
-
+
//
// Initialize the ControlBeanContext in the session.
//
JavaControlUtils.initializeControlContext( httpRequest, httpResponse, _servletContext );
+
+ //
+ // Create the PageFlow Context
+ //
+ PageFlowContext pfCtxt = PageFlowContext.getContext();
+ pfCtxt.init();
+ pfCtxt.setRequest(httpRequest);
+ pfCtxt.setResponse(httpResponse);
+ pfCtxt.setServletContext(_servletContext);
//
// Register the default URLRewriter
Added: beehive/trunk/netui/src/simple-tags/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/build.xml?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/build.xml (added)
+++ beehive/trunk/netui/src/simple-tags/build.xml Wed Oct 19 08:29:22 2005
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+
+<project name="Beehive/NetUI/Simple-Tags" default="build" basedir=".">
+
+ <import file="../../netui-imports.xml"/>
+
+ <property name="module.name" value="simple-tags"/>
+ <property name="module.dir" location="${src.dir}/${module.name}"/>
+ <path id="module.classpath">
+ <path refid="servlet.dependency.path"/>
+ <path refid="xbean.dependency.path"/>
+ <path refid="${struts.dependency.path.ref}"/>
+ <pathelement path="${classes.dir}/util"/>
+ <pathelement path="${classes.dir}/simple-tags"/>
+ <pathelement path="${classes.dir}/pageflow"/>
+ <pathelement path="${classes.dir}/scoping"/>
+ <pathelement path="${classes.dir}/core"/>
+ </path>
+
+ <target name="build">
+ <echo>compile module: ${module.name}</echo>
+ <property name="classpath" refid="module.classpath"/>
+ <echo>module classpath: ${classpath}</echo>
+ <echo>debug: ${compile.debug}</echo>
+
+ <mkdir dir="${classes.dir}/${module.name}"/>
+
+ <javac srcdir="${module.dir}"
+ destdir="${classes.dir}/${module.name}"
+ classpathref="module.classpath"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ source="${compile.source}"
+ target="${compile.target}">
+ <include name="**/*.java"/>
+ </javac>
+
+ <copy todir="${classes.dir}/${module.name}">
+ <fileset dir="${module.dir}" includes="**/*.properties"/>
+ <fileset dir="${module.dir}" includes="**/*.gif"/>
+ </copy>
+
+ <echo>Generate TLD</echo>
+ <taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="webdoclet.dependency.path"/>
+ <webdoclet
+ destdir="${build.lib.dir}"
+ excludedtags="@version,@author,@todo"
+ force="true"
+ verbose="true">
+
+ <fileset dir="${src.dir}/simple-tags">
+ <include name="**/*.java"/>
+ </fileset>
+
+ <netuitldgen
+ xmlencoding="UTF-8"
+ taglibversion="1.0"
+ jspversion="1.2"
+ shortname="netui"
+ uri="http://beehive.apache.org/netui/simple-tags-0.9"
+ description="NetUI Simple Tags."
+ filename="${netui-tags-simple.tld.name}"
+ destdir="${build.lib.dir}"
+ validateXml="true"
+ packageName="org.apache.beehive.netui.simpletags"
+ />
+ </webdoclet>
+
+ </target>
+
+ <target name="clean">
+ <delete dir="${classes.dir}/${module.name}"/>
+ <delete dir="${build.lib.dir}/${netui-tags-simple.tld.name}"/>
+ </target>
+
+</project>
Propchange: beehive/trunk/netui/src/simple-tags/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/Appender.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/Appender.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/Appender.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/Appender.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,38 @@
+/*
+ * 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 org.apache.beehive.netui.simpletags.appender;
+
+/**
+ * This is an abstract base class that represents the appender.
+ * An <code>Appender</code> acts as an output stream. Data is output (appended) to
+ * the output stream.
+ */
+abstract public class Appender
+{
+ /**
+ * Append a <code>String</code> to the output.
+ * @param s The <code>String</code> value to be output.
+ */
+ abstract public void append(String s);
+
+ /**
+ * Append a character to the output.
+ * @param c The character value to be output.
+ */
+ abstract public void append(char c);
+}
Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/Appender.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/ResponseAppender.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/ResponseAppender.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/ResponseAppender.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/ResponseAppender.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,51 @@
+package org.apache.beehive.netui.simpletags.appender;
+
+import org.apache.beehive.netui.util.Bundle;
+import org.apache.beehive.netui.util.logging.Logger;
+
+import javax.servlet.ServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * This Appender will append to a <code>ServletResponse</code>.
+ */
+public class ResponseAppender extends Appender
+{
+ private static final Logger logger = Logger.getInstance(ResponseAppender.class);
+
+ private PrintWriter _writer;
+
+ /**
+ * Create a new <code>Appender</code> that will write to the <code>ServletResponse</code>.
+ * @param response The <code>ServletResponse</code> that will be written to.
+ */
+ public ResponseAppender(ServletResponse response)
+ {
+ try {
+ _writer = response.getWriter();
+ }
+ catch (IOException e) {
+ logger.error(Bundle.getString("Tags_WriteException"), e);
+ }
+ }
+
+ /**
+ * Append a <code>String</code> to the output.
+ * @param s The <code>String</code> value to be output.
+ */
+ public void append(String s)
+ {
+ _writer.print(s);
+ }
+
+ /**
+ * Append a character to the output.
+ * @param c The character value to be output.
+ */
+ public void append(char c)
+ {
+ _writer.print(c);
+ }
+
+}
Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/ResponseAppender.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/StringBuilderAppender.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/StringBuilderAppender.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/StringBuilderAppender.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/StringBuilderAppender.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,62 @@
+/*
+ * 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 org.apache.beehive.netui.simpletags.appender;
+
+import org.apache.beehive.netui.util.internal.InternalStringBuilder;
+
+/**
+ * This is an implementation of {@link org.apache.beehive.netui.simpletags.appender.Appender} which appends
+ * Strings to a {@link InternalStringBuilder}
+ */
+public class StringBuilderAppender
+ extends Appender
+{
+ private InternalStringBuilder _sb;
+
+ public StringBuilderAppender()
+ {
+ }
+
+ public StringBuilderAppender(InternalStringBuilder sb)
+ {
+ _sb = sb;
+ }
+
+ public void setInternalStringBuilder(InternalStringBuilder sb)
+ {
+ _sb = sb;
+ }
+
+ public void append(String s)
+ {
+ assert _sb != null : "Render appender doesn't have a valid string builder";
+ _sb.append(s);
+ }
+
+ public void append(char c)
+ {
+ assert _sb != null : "Render appender doesn't have a valid string builder";
+ _sb.append(c);
+ }
+
+ public String toString()
+ {
+ assert _sb != null : "Render appender doesn't have a valid string builder";
+ return _sb.toString();
+ }
+}
Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/appender/StringBuilderAppender.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBaseBehavior.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBaseBehavior.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBaseBehavior.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBaseBehavior.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,567 @@
+package org.apache.beehive.netui.simpletags.behaviors;
+
+import org.apache.beehive.netui.pageflow.PageFlowContext;
+import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+import org.apache.beehive.netui.simpletags.appender.Appender;
+import org.apache.beehive.netui.simpletags.core.IUrlParams;
+import org.apache.beehive.netui.simpletags.core.PopupSupport;
+import org.apache.beehive.netui.simpletags.core.TagContext;
+import org.apache.beehive.netui.simpletags.util.PageFlowTagUtils;
+import org.apache.beehive.netui.simpletags.core.services.ScriptReporter;
+import org.apache.beehive.netui.simpletags.html.HtmlUtils;
+import org.apache.beehive.netui.simpletags.javascript.CoreScriptFeature;
+import org.apache.beehive.netui.simpletags.rendering.AbstractHtmlState;
+import org.apache.beehive.netui.simpletags.rendering.AnchorTag;
+import org.apache.beehive.netui.simpletags.rendering.TagRenderingBase;
+import org.apache.beehive.netui.simpletags.util.ContextUtils;
+import org.apache.beehive.netui.util.Bundle;
+import org.apache.beehive.netui.util.ParamHelper;
+import org.apache.beehive.netui.util.logging.Logger;
+import org.apache.struts.taglib.html.Constants;
+
+import javax.servlet.http.HttpServletResponse;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+
+abstract public class AnchorBaseBehavior extends HtmlBaseBehavior
+ implements IUrlParams
+{
+ protected static final String REQUIRED_ATTR = "href, action, linkName, clientAction";
+
+ private static final Logger logger = Logger.getInstance(AnchorBaseBehavior.class);
+
+ protected AnchorTag.State _state = new AnchorTag.State();
+ protected String _linkName; // name of the link
+ protected String _clientAction; // The client action (javascript)
+
+ private String _action;
+ private String _href;
+ private String _targetScope; // target page flow scope; see comments on setTargetScope()
+ private String _location; // anchor to be added to the end of the hyperlink.
+ private Map _params; // Parameters
+ private FormBehavior _form; // the nearest form
+ private boolean _formSubmit = false; // should the anchor submit an enclosing form?
+ private PopupSupport _popupSupport = null; // popup support, if the popup attribute is set to true
+ private boolean _disableSecondClick = false; // When clicked, this anchor will disable itself after being clicked.
+
+ /**
+ * Base support for the attribute tag. This is overridden to prevent setting the <code>href</code>
+ * attribute.
+ * @param name The name of the attribute. This value may not be null or the empty string.
+ * @param value The value of the attribute. This may contain an expression.
+ * @param facet The name of a facet to which the attribute will be applied. This is optional.
+ */
+ public void setAttribute(String name, String value, String facet)
+ {
+ if (name != null && name.equals(HREF)) {
+ String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
+ registerTagError(s, null);
+ }
+ super.setAttribute(name, value, facet);
+ }
+
+ /**
+ * Sets <code>shape</code> attribute for the area.
+ * @param shape the window target.
+ * @jsptagref.attributedescription The shape.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_shape</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The shape."
+ */
+ public void setShape(String shape)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, SHAPE, shape);
+ }
+
+ /**
+ * Sets <code>coords</code> attribute for the area.
+ * @param coords the window target.
+ * @jsptagref.attributedescription The coordinates.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_coordinates</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The coordinates."
+ */
+ public void setCoords(String coords)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, COORDS, coords);
+ }
+
+ /**
+ * Set the name of the action for the Area.
+ * @param action the name of the action to set for the Area.
+ * @jsptagref.attributedescription The action method to invoke. The action method must be in the Controller file
+ * of the Page Flow directory.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_action</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The action method to invoke. The action method must be in the Controller file of the Page Flow directory."
+ */
+ public void setAction(String action)
+ {
+ _action = action;
+ }
+
+ /**
+ * Sets the href of the Anchor. This attribute will accept the empty String as a legal value.
+ * @param href the hyperlink URI for the Area.
+ * @jsptagref.attributedescription The URL to go to.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_href</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The URL to go to."
+ * reftype="url"
+ */
+ public void setHref(String href)
+ {
+ _href = href;
+ }
+
+ /**
+ * Sets the anchor to be added to the end of the generated hyperlink.
+ * @param location the name of the location anchor.
+ * @jsptagref.attributedescription Location within the URI to visit.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_location</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="Location within the URI to visit."
+ */
+ public void setLocation(String location)
+ {
+ _location = location;
+ }
+
+ /**
+ * Set the target "scope" for the anchor's action. Multiple active page flows may exist concurrently within named
+ * scopes. This attribute selects which named scope to use. If omitted, the default scope is assumed.
+ * @param targetScope the name of the target scope in which the associated action's page flow resides.
+ * @jsptagref.attributedescription The target scope in which the associated action's page flow resides.
+ * @jsptagref.databindable true
+ * @jsptagref.attributesyntaxvalue <i>string_targetScope</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The target scope in which the associated action's page flow resides"
+ */
+ public void setTargetScope(String targetScope)
+ {
+ _targetScope = targetScope;
+ }
+
+ /**
+ * Sets the formSubmit indicator.
+ * @param formSubmit whether or not the enclosing Form should be submitted.
+ * @jsptagref.attributedescription Boolean. If <code>formSubmit</code> is set to true, and the <netui:anchor> tag
+ * is within a <netui:form> tag,
+ * then the form data will be submitted to the method named in the
+ * <netui:form> tag's <code>action</code> attribute.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>boolean_formSubmit</i>
+ * @netui:attribute required="false" rtexprvalue="true" type="boolean"
+ * description="If formSubmit is set to true, and the <netui:anchor> tag
+ * is within a <netui:form> tag,
+ * then the form data will be submitted to the method named in the
+ * <netui:form> tag's action attribute."
+ */
+ public void setFormSubmit(boolean formSubmit)
+ {
+ _formSubmit = formSubmit;
+ }
+
+ /**
+ * Sets the popup indicator.
+ * @param popup whether or not the anchor should open a popup window.
+ * @jsptagref.attributedescription Boolean. If <code>popup</code> is set to true,
+ * the anchor will open a popup window.
+ * @jsptagref.databindable true
+ * @jsptagref.attributesyntaxvalue <i>boolean_popup</i>
+ * @netui:attribute required="false" rtexprvalue="true" type="boolean"
+ * description="If popup is set to true, the anchor will open a popup window.
+ */
+ public void setPopup(boolean popup)
+ {
+ _popupSupport = (popup ? new PopupSupport() : null);
+ }
+
+
+ /**
+ * When true, this anchor will disable itself after being clicked.
+ * @param disableSecondClick when true, this anchor will disable itself after being clicked.
+ * @jsptagref.attributedescription Boolean. If <code>disableSecondClick</code> is set to true,
+ * the anchor will disable itself after being clicked.
+ * @jsptagref.databindable true
+ * @jsptagref.attributesyntaxvalue <i>boolean_disableSecondClick</i>
+ * @netui:attribute required="false" rtexprvalue="true" type="boolean"
+ * description="When true, this anchor will disable itself after being clicked."
+ */
+ public void setDisableSecondClick(boolean disableSecondClick)
+ {
+ _disableSecondClick = disableSecondClick;
+ }
+
+
+ /**
+ * Sets the tabIndex of the rendered html tag.
+ * @param tabindex the tab index.
+ * @jsptagref.attributedescription The tabIndex of the rendered HTML tag. This attribute determines the position of the
+ * rendered HTML tag in the sequence of tags that the user may advance through by pressing the TAB key.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_tabIndex</i>
+ * @netui:attribute required="false" rtexprvalue="true" type="int"
+ * description="The tabIndex of the rendered HTML tag. This attribute determines the position of the
+ * rendered HTML tag in the sequence of tags that the user may advance through by pressing the TAB key."
+ */
+ public void setTabindex(int tabindex)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TABINDEX, Integer.toString(tabindex));
+ }
+
+
+ /**
+ * Sets the accessKey attribute value. This should key value of the
+ * keyboard navigation key. It is recommended not to use the following
+ * values because there are often used by browsers <code>A, C, E, F, G,
+ * H, V, left arrow, and right arrow</code>.
+ * @param accessKey the accessKey value.
+ * @jsptagref.attributedescription The keyboard navigation key for the element.
+ * The following values are not recommended because they
+ * are often used by browsers: <code>A, C, E, F, G,
+ * H, V, left arrow, and right arrow</code>
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_accessKey</i>
+ * @netui:attribute required="false" rtexprvalue="true" type="char"
+ * description=" The keyboard navigation key for the element.
+ * The following values are not recommended because they
+ * are often used by browsers: A, C, E, F, G,
+ * H, V, left arrow, and right arrow."
+ */
+ public void setAccessKey(char accessKey)
+ {
+ if (accessKey == 0x00)
+ return;
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ACCESSKEY, Character.toString(accessKey));
+ }
+
+ /**
+ * Sets the onBlur javascript event.
+ * @param onblur the onBlur event.
+ * @jsptagref.attributedescription The onBlur JavaScript event.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_onBlur</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The onBlur JavaScript event."
+ */
+ public void setOnBlur(String onblur)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONBLUR, onblur);
+ }
+
+ /**
+ * Sets the onFocus javascript event.
+ * @param onfocus the onFocus event.
+ * @jsptagref.attributedescription The onFocus JavaScript event.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_onFocus</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The onFocus JavaScript event."
+ */
+ public void setOnFocus(String onfocus)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONFOCUS, onfocus);
+ }
+
+ //**************************** Helper Routines *********************************************
+
+ /**
+ * Adds a URL parameter to the generated hyperlink.
+ * @param name the name of the parameter to be added.
+ * @param value the value of the parameter to be added (a String or String[]).
+ * @param facet
+ */
+ public void addParameter(String name, Object value, String facet)
+ {
+ assert(name != null) : "Parameter 'name' must not be null";
+
+ if (_params == null) {
+ _params = new HashMap();
+ }
+ ParamHelper.addParam(_params, name, value);
+ }
+
+ // @todo: this really needs a bit of documentation
+ public PopupSupport getPopupSupport()
+ {
+ return _popupSupport;
+ }
+
+ /**
+ * This method will create the <a> portion of an anchor. It is called by subclasses, for example, the
+ * <code>ImageAnchor</code> relies on this code to generate the <a>.
+ * @return a boolean value indicating if an error occur creating the anchor.
+ */
+ protected final boolean createAnchorBeginTag(TagRenderingBase trb, Appender appender, String requiredAttrs)
+ {
+ int have = 0;
+ String formAction = null;
+ //String idScript = null;
+
+ if (_formSubmit)
+ _form = getNearestForm();
+
+ // check the parameters that the user provided
+ if (_href != null) have++;
+ if (_action != null) have++;
+ if (_clientAction != null) have++;
+ if (_linkName != null) have++;
+
+ String tagId = getTagId();
+
+ // if only the _linkName or _tagId is set then we are creating the name attribute only.
+ if (have == 0 && !_formSubmit && tagId != null) {
+ return createNameAnchor(appender,trb);
+ }
+
+ // if the anchor is submitting a consider this a submit level problem
+ // set the action to the form action.
+ if (_formSubmit) {
+ formAction = getFormAction();
+ if ((formAction != null) && (have == 0)) {
+ have++;
+ }
+ if (_action == null) {
+ _action = formAction;
+ _location = getFormLocation();
+ }
+ }
+
+ // if we have not specified a destination or we've specified too many
+ // then we need to report an error.
+ if (have == 0 || have > 1) {
+ String s = Bundle.getString("Tags_Anchor_InvalidAnchorURI",
+ new Object[]{getTagName(), requiredAttrs});
+ registerTagError(s, null);
+ return false;
+ }
+
+ if (_linkName != null) {
+ return createPageAnchor(appender, trb);
+ }
+
+ if (_action != null) {
+ // report that action is not an action
+ if (!PageFlowTagUtils.isAction(_action)) {
+ String s = null;
+ if (_action.equals("")) {
+ s = Bundle.getString("Tags_NullBadAction", null);
+ }
+ else {
+ s = Bundle.getString("Tags_BadAction", _action);
+ }
+ registerTagError(s, null);
+ }
+ else {
+ //
+ // If the action we're submitting to is checking for double-submits, save a token in the session.
+ // This will be written out as a param (below), and will be checked in PageFlowRequestProcessor.
+ //
+ String token = PageFlowTagUtils.getToken(_action);
+ if (token != null) {
+ addParamInternal(Constants.TOKEN_KEY, token);
+ }
+ }
+ }
+
+ // we assume that tagId will over have override id if both
+ // are defined.
+ if (tagId != null) {
+ _state.id = tagId;
+ renderNameAndId(_state, null);
+ }
+
+ // Special case for name anchors
+ if (_clientAction != null) {
+ _state.href = "";
+ }
+ else {
+ // Add the scope-ID parameter, if the targetScope attribute is present.
+ if (_targetScope != null) {
+ addParamInternal(ScopedServletUtils.SCOPE_ID_PARAM, _targetScope);
+ }
+
+ if (_popupSupport != null)
+ _popupSupport.addParams(this);
+
+ // Generate the opening anchor element
+ String uri = null;
+ try {
+ if (_action != null) {
+ uri = PageFlowTagUtils.rewriteActionURL(_action, _params, _location);
+ }
+ else if (_href != null) {
+ uri = PageFlowTagUtils.rewriteHrefURL(_href, _params, _location);
+ }
+ }
+ catch (URISyntaxException e) {
+ // report the error...
+ logger.error(Bundle.getString("Tags_URISyntaxException"));
+ String s = Bundle.getString("Tags_Anchor_URLException",
+ new Object[]{e.getMessage()});
+ registerTagError(s, e);
+ }
+
+ if (uri == null) {
+ if (hasErrors())
+ return false;
+ }
+ else {
+ PageFlowContext pfCtxt = ContextUtils.getPageFlowContext();
+ HttpServletResponse response = pfCtxt.getResponse();
+ _state.href = response.encodeURL(uri);
+ }
+ }
+
+ // We need to combine the onclick features
+ TagContext tagCtxt = ContextUtils.getTagContext();
+ ScriptReporter sr = tagCtxt.getScriptReporter();
+ if (_clientAction != null && sr.isFeatureWritten(CoreScriptFeature.DYNAMIC_INIT)) {
+ //@todo: we need to support onclick chaining here also...
+ String action = HtmlUtils.escapeEscapes(_clientAction);
+ String entry = ScriptReporter.getString("netuiAction", new Object[]{action});
+ _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, entry);
+ // Jira 299
+ //_state.onClick = entry;
+ }
+
+ // if the user overrides the onclick we will ignore this
+ String onclick = _state.getAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK);
+ if (onclick == null) {
+ if (_formSubmit && formAction != null) {
+ String realFormName = getFormId();
+ String key = (_disableSecondClick ? "anchorDisableAndSubmitFormAction" : "anchorFormSubmitAction");
+ String entry = ScriptReporter.getString(key, new Object[]{realFormName, _state.href});
+ _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, entry);
+ // Jira 299
+ //_state.onClick = ScriptRequestState.getString("anchorFormSubmitAction",
+ // new Object[]{realFormName, _state.href});
+ if (_form != null)
+ _form.insureRealId();
+ }
+ else if (_disableSecondClick) {
+ String entry = ScriptReporter.getString("anchorDisableAction", null);
+ _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, entry);
+ }
+ else if (_popupSupport != null) {
+ _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, _popupSupport.getOnClick(_state.href));
+ // Jira 299
+ //_state.onClick = _popupSupport.getOnClick(_state.href);
+ }
+ }
+
+ if (hasErrors())
+ return false;
+
+ trb.doStartTag(appender, _state);
+
+ // Emit javascript if this anchor needs to sumbit the form or open a popup window
+ if (_formSubmit && formAction != null || _popupSupport != null) {
+ if (_formSubmit && formAction != null)
+ sr.writeFeature(CoreScriptFeature.ANCHOR_SUBMIT, true, false, null);
+ if (_popupSupport != null)
+ _popupSupport.writeScript(sr);
+ }
+ return true;
+ }
+
+ private void addParamInternal(String paramName, String paramVal)
+ {
+ if (_params == null) {
+ _params = new HashMap();
+ }
+ _params.put(paramName, paramVal);
+ }
+
+ /**
+ * @param trb
+ * @return a boolean indicating if an error has occurred or not
+ */
+ private boolean createNameAnchor(Appender writer, TagRenderingBase trb)
+ {
+ assert(_state.id != null) : "tagId must not be nulll";
+
+ // render the id
+ renderNameAndId(_state, null);
+
+ //set the name so legacy browsers can support this.
+ _state.name = _state.id;
+
+ // output the tag.
+ trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG);
+ trb.doStartTag(writer, _state);
+ return !hasErrors();
+ }
+
+ /**
+ * This method will output an anchor with a fragment identifier. This should
+ * be a valid ID within the document. If the name begins with the "#" we will
+ * not qualify the set link name. If the name doesn't begin with #, then we
+ * will qualify it into the current scope container.
+ * @param trb The TagRenderer that will output the link
+ * @return return a boolean indicating if an error occurred or not
+ */
+ private boolean createPageAnchor(Appender writer, TagRenderingBase trb)
+ {
+ // create the fragment identifier. If the _linkName starts with
+ // '#' then we treat it as if it was fully qualified. Otherwise we
+ // need to qualify it before we add the '#'.
+ _linkName = _linkName.trim();
+ if (_linkName.charAt(0) != '#') {
+ _state.href = "#" + getIdForTagId(_linkName);
+ }
+ else {
+ _state.href = _linkName;
+ }
+
+ // if the tagId was set then rewrite it and output it.
+ if (_state.id != null) {
+ //_state.id = getIdForTagId(_state.id);
+ _state.name = _state.id;
+ renderNameAndId(_state,null);
+ }
+
+ // write out the tag.
+ trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG);
+ trb.doStartTag(writer, _state);
+ return !hasErrors();
+ }
+
+ /**
+ * Return the action attribute for the nearest form.
+ * @return The action attribute of the enclosing form
+ */
+ private String getFormAction()
+ {
+ if (_form != null)
+ return _form.getAction();
+ return null;
+ }
+
+ private String getFormLocation()
+ {
+ if (_form != null)
+ return _form.getLocation();
+ return null;
+ }
+
+ /**
+ * This will get the real name of the form. This is set in the
+ * id attribute.
+ * @return The String real name of the containing form.
+ */
+ private String getFormId()
+ {
+ if (_form != null) {
+ return _form.getRealFormId();
+ }
+ return null;
+ }
+}
Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBaseBehavior.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBehavior.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBehavior.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBehavior.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBehavior.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,220 @@
+package org.apache.beehive.netui.simpletags.behaviors;
+
+import org.apache.beehive.netui.simpletags.appender.Appender;
+import org.apache.beehive.netui.simpletags.rendering.AbstractHtmlState;
+import org.apache.beehive.netui.simpletags.rendering.TagRenderingBase;
+
+import javax.servlet.jsp.JspException;
+
+public class AnchorBehavior extends AnchorBaseBehavior
+{
+ private String _text; // The body content of this tag (if any).
+ private String _value;
+
+ /**
+ * Returns the name of the Tag.
+ */
+ public String getTagName()
+ {
+ return "Anchor";
+ }
+
+ /**
+ * This method will return the state associated with the tag. This is used by this
+ * base class to access the individual state objects created by the tags.
+ * @return a subclass of the <code>AbstractHtmlState</code> class.
+ */
+ public AbstractHtmlState getState()
+ {
+ return _state;
+ }
+
+ /**
+ * Sets the onClick javascript event.
+ * @param onclick the onClick event.
+ * @jsptagref.attributedescription The onClick JavaScript event.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_onClick</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The onClick JavaScript event."
+ */
+ public void setOnClick(String onclick)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, onclick);
+ // Jira 299
+ //_state.onClick = setNonEmptyValueAttribute(onclick);
+ }
+
+ /**
+ * Set a client action to run on the client. When set on an anchor, a NetUI JavaScript action
+ * will be run. This attribute may not be set if <code>href</code> or <code>action</code> is set.
+ * @param action an action to run on the client.
+ * @jsptagref.attributedescription The action (NetUI JavaScript) to run on the client.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_clientAction</i>
+ * @netui:attribute required="false" rtexprvalue="true" description="The client action."
+ * description="The action (NetUI JavaScript) to run on the client."
+ */
+ public void setClientAction(String action)
+ throws JspException
+ {
+ _clientAction = action;
+ }
+
+ /**
+ * Sets the link name of the Anchor. The link name is treated as a fragment
+ * identifier and may or may not contain the "#" character. If it does, the
+ * link name will not be qualified into a ScriptContainer. If the link name
+ * does not contain the "#" the normal tagId qualification will take place
+ * to produce the actual fragment identifier.
+ * @param linkName the link name for the Anchor.
+ * @jsptagref.attributedescription An internal place on the page to go to.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_linkName</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="An internal place on the page to go to."
+ */
+ public void setLinkName(String linkName)
+ throws JspException
+ {
+ _linkName = linkName;
+ }
+
+ /**
+ * Sets <code>charset</code> attribute for the anchor.
+ * @param charSet the window target.
+ * @jsptagref.attributedescription The character set.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_charset</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The character set."
+ */
+ public void setCharSet(String charSet)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, CHARSET, charSet);
+ }
+
+ /**
+ * Sets <code>type</code> attribute for the anchor.
+ * @param type the window target.
+ * @jsptagref.attributedescription The type.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_type</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The type."
+ */
+ public void setType(String type)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TYPE, type);
+ }
+
+ /**
+ * Sets <code>hreflang</code> attribute for the anchor.
+ * @param hreflang the window target.
+ * @jsptagref.attributedescription The HREF lang.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_hreflang</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The HREF lang."
+ */
+ public void setHrefLang(String hreflang)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HREFLANG, hreflang);
+ }
+
+ /**
+ * Sets <code>rel</code> attribute for the anchor.
+ * @param rel the window target.
+ * @jsptagref.attributedescription The relationship between the current document and the target Url.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_rel</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The rel."
+ */
+ public void setRel(String rel)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, REL, rel);
+ }
+
+ /**
+ * Sets <code>rev</code> attribute for the anchor.
+ * @param rev the window target.
+ * @jsptagref.attributedescription Describes a reverse link from the anchor specified to the current document.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_rev</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The rev."
+ */
+ public void setRev(String rev)
+ {
+ _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, REV, rev);
+ }
+
+
+ /**
+ * Sets the window target.
+ * @param target the window target.
+ * @jsptagref.attributedescription The window target.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_action</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The window target."
+ */
+ public void setTarget(String target)
+ {
+ _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, overriding the body content.
+ * @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"
+ */
+ public void setValue(String value)
+ {
+ _value = value;
+ }
+
+ /**
+ * Set the text, this represents the body of the anchor tag.
+ * @param text
+ */
+ public void setText(String text) {
+ _text = text;
+ }
+
+ public void renderStart(Appender appender)
+ {
+ }
+
+ public void renderEnd(Appender appender)
+ {
+ if (hasErrors()) {
+ reportErrors(appender);
+ return;
+ }
+
+ if (_value != null) {
+ _text = _value;
+ }
+
+ // build the anchor into the results
+ TagRenderingBase trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG);
+ assert(trb != null) : "The TagRenderingBase returned is null";
+
+ if (!createAnchorBeginTag(trb, appender, REQUIRED_ATTR)) {
+ reportErrors(appender);
+ return;
+ }
+
+ if (_text != null)
+ appender.append(_text);
+
+ trb.doEndTag(appender);
+ }
+}
Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/AnchorBehavior.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/BaseBehavior.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/BaseBehavior.java?rev=326581&view=auto
==============================================================================
--- beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/BaseBehavior.java (added)
+++ beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/BaseBehavior.java Wed Oct 19 08:29:22 2005
@@ -0,0 +1,135 @@
+package org.apache.beehive.netui.simpletags.behaviors;
+
+import org.apache.beehive.netui.simpletags.appender.Appender;
+import org.apache.beehive.netui.simpletags.core.Behavior;
+import org.apache.beehive.netui.simpletags.html.HtmlConstants;
+import org.apache.beehive.netui.simpletags.rendering.AbstractAttributeState;
+import org.apache.beehive.netui.simpletags.rendering.BaseTag;
+import org.apache.beehive.netui.simpletags.rendering.TagRenderingBase;
+import org.apache.beehive.netui.simpletags.util.ContextUtils;
+import org.apache.beehive.netui.util.Bundle;
+import org.apache.beehive.netui.util.internal.InternalStringBuilder;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Provides the base for every URL on this page, by generating the html <base> element which appears in
+ * the HTML header.
+ */
+public class BaseBehavior extends Behavior implements HtmlConstants
+{
+ private BaseTag.State _state = new BaseTag.State();
+
+ /**
+ * Returns the name of the Tag.
+ */
+ public String getTagName()
+ {
+ return "Base";
+ }
+
+ /**
+ * Set the default window target.
+ * @param target the window target.
+ * @jsptagref.attributedescription The default window target.
+ * @jsptagref.databindable false
+ * @jsptagref.attributesyntaxvalue <i>string_windowTarget</i>
+ * @netui:attribute required="false" rtexprvalue="true"
+ * description="The default window target."
+ */
+ public void setTarget(String target)
+ {
+ _state.target = target;
+ }
+
+ /**
+ * Base support for the attribute tag. The <code>href</code> may not bet set.
+ * @param name The name of the attribute. This value may not be null or the empty string.
+ * @param value The value of the attribute. This may contain an expression.
+ * @param facet The name of a facet to which the attribute will be applied. This is optional.
+ */
+ public void setAttribute(String name, String value, String facet)
+ {
+ boolean error = false;
+
+ // validate the name attribute, in the case of an error simply return.
+ if (name == null || name.length() <= 0) {
+ String s = Bundle.getString("Tags_AttributeNameNotSet");
+ registerTagError(s, null);
+ error = true;
+ }
+ if (facet != null) {
+ String s = Bundle.getString("Tags_AttributeFacetNotSupported", new Object[]{facet});
+ registerTagError(s, null);
+ error = true;
+ }
+
+ // it's not legal to set the href attributes this way
+ if (name != null && name.equals(HREF)) {
+ String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
+ registerTagError(s, null);
+ error = true;
+ }
+ if (error)
+ return;
+
+ // set the state variables that will override the tag settings...
+ if (name.equals(TARGET)) {
+ _state.target = value;
+ return;
+ }
+
+ _state.registerAttribute(AbstractAttributeState.ATTR_GENERAL, name, value);
+ }
+
+ /**
+ * Render the HTML <base> element with the href set.
+ * @param appender The <code>Appender</code> to write the markup into.
+ */
+ public void renderStart(Appender appender)
+ {
+ // This tag will use the HttpServlet request to see the scheme and port
+ // that is being used.
+ HttpServletRequest request = ContextUtils.getPageFlowContext().getRequest();
+
+ // calculate the href
+ InternalStringBuilder buf = new InternalStringBuilder(64);
+ buf.append(request.getScheme());
+ buf.append("://");
+ buf.append(request.getServerName());
+
+ String scheme = request.getScheme();
+ int port = request.getServerPort();
+ if ("http".equals(scheme) && (80 == port)) {
+ //Do nothing
+ }
+ else if ("https".equals(scheme) && (443 == port)) {
+ //Do nothing
+ }
+ else {
+ buf.append(":");
+ buf.append(request.getServerPort());
+ }
+ buf.append(request.getRequestURI());
+ _state.href = buf.toString();
+
+ // render the tag.
+ TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.BASE_TAG);
+ br.doStartTag(appender, _state);
+ }
+
+ /**
+ * This really doesn't do anything, but is called in case the HTML base element
+ * may contain content in the future.
+ * @param appender The <code>Appender</code> to write the markup into.
+ */
+ public void renderEnd(Appender appender) {
+ TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.BASE_TAG);
+ br.doEndTag(appender);
+
+ // This will produce invalid HTML/XHTML if there are errors
+ // because we are going to put markup out into the head.
+ if (hasErrors())
+ reportErrors(appender);
+ }
+}
Propchange: beehive/trunk/netui/src/simple-tags/org/apache/beehive/netui/simpletags/behaviors/BaseBehavior.java
------------------------------------------------------------------------------
svn:eol-style = native