Author: dolander
Date: Sat Nov 13 08:55:28 2004
New Revision: 57579

Added:
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Area.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java
Modified:
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlConstants.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
Log:
Add an HTML area tag.  This required adding a base class to the Anchor tag to 
share the common features.
Added an Area renderer to create the area tag.



Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Anchor.java
==============================================================================
--- 
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
  Sat Nov 13 08:55:28 2004
@@ -17,27 +17,13 @@
  */
 package org.apache.beehive.netui.tags.html;
 
-import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
-import org.apache.beehive.netui.pageflow.util.PageflowTagUtils;
-import org.apache.beehive.netui.pageflow.util.URLRewriter;
-import org.apache.beehive.netui.pageflow.util.URLRewriterService;
-import org.apache.beehive.netui.tags.HtmlUtils;
-import org.apache.beehive.netui.tags.IScriptReporter;
 import org.apache.beehive.netui.tags.ByRef;
-import org.apache.beehive.netui.tags.rendering.*;
-import org.apache.beehive.netui.util.Bundle;
-import org.apache.beehive.netui.util.FileUtils;
-import org.apache.beehive.netui.util.ParamHelper;
-import org.apache.beehive.netui.util.logging.Logger;
+import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
+import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
+import org.apache.beehive.netui.tags.rendering.WriteRenderAppender;
 
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import javax.servlet.jsp.JspException;
-import java.net.MalformedURLException;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * <p>
@@ -126,33 +112,10 @@
  * @see Attribute
  * @see java.lang.String
  */
-public class Anchor extends HtmlBaseTag
-        implements URLParams
+public class Anchor extends AnchorBase
 {
-    private static final String REQUIRED_ATTR = "href, action, linkName, 
clientAction";
-
-    /**
-     * NOTES: It looks like the location can only be used with href.  We need 
to make sure that there
-     * is an error if this is not true.  Location cannot be used at the moment 
with a target of an
-     * action.
-     */
-    private static final Logger logger = Logger.getInstance(Anchor.class);
-
-    // rendering state
-    protected AnchorTag.State _state = new AnchorTag.State();
-
     private String _text;         // The body content of this tag (if any).
 
-    private String _action;       // name of the action
-    private String _href;         // hyperlink URI.
-    private String _linkName;     // name of the link
-    private String _location;     // anchor to be added to the end of the 
hyperlink.
-    private String _scope;        // target scope; see comments on setScope()
-    private String _clientAction; // The client action (javascript)
-    private Form _form;         // the nearest form
-
-    private Map _params;                 // Parameters
-    private boolean _formSubmit = false; // should the anchor submit an 
enclosing form?
 
     /**
      * Returns the name of the Tag.
@@ -173,77 +136,6 @@
     }
 
     /**
-     * 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.
-     * @throws JspException A JspException may be thrown if there is an error 
setting the attribute.
-     */
-    public void setAttribute(String name, String value, String facet)
-            throws JspException
-    {
-        if (name != null && name.equals(HREF)) {
-            String s = Bundle.getString("Tags_AttributeMayNotBeSet", new 
Object[]{name});
-            registerTagError(s, null);
-        }
-        super.setAttribute(name, value, facet);
-    }
-
-    /**
-     * Set the name of the action for the Anchor.
-     * @param action - the name of the action to set for the Anchor.  Action 
requires a value.
-     * @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."
-     * @netui.tldx:attribute reftype="netui-action-url" category="general"
-     */
-    public void setAction(String action)
-            throws JspException
-    {
-        _action = setRequiredValueAttribute(action, "action");
-    }
-
-    /**
-     * Set the name of the action for the Anchor.
-     * @param scope - the name of the action to set for the Anchor
-     * @jsptagref.attributedescription The scope
-     * @jsptagref.databindable false
-     * @jsptagref.attributesyntaxvalue <i>string_scope</i>
-     * @netui:attribute required="false" rtexprvalue="true"
-     * description="The scope"
-     * @netui.tldx:attribute category="general"
-     */
-    public void setScope(String scope)
-    {
-        _scope = setNonEmptyValueAttribute(scope);
-    }
-
-    /**
-     * 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 &lt;netui:anchor> tag
-     * is within a &lt;netui:form> tag,
-     * then the form data will be submitted to the method named in the
-     * &lt;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."
-     * @netui.tldx:attribute
-     */
-    public void setFormSubmit(boolean formSubmit)
-    {
-        _formSubmit = formSubmit;
-    }
-
-    /**
      * Sets the onClick javascript event.
      * @param onclick - the onClick event.
      * @jsptagref.attributedescription The onClick JavaScript event.
@@ -259,40 +151,6 @@
     }
 
     /**
-     * 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."
-     * @netui.tldx:attribute category="misc"
-     */
-    public void setTabindex(int tabindex)
-    {
-        _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TABINDEX, 
Integer.toString(tabindex));
-    }
-
-    /**
-     * Sets the href of the Anchor. This attribute will accept the empty 
String as a legal value.
-     * @param href - the hyperlink URI for the Anchor.
-     * @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."
-     * @netui.tldx:attribute 
propertyclass="workshop.jspdesigner.properties.URIPropertyClass"
-     * reftype="url"
-     */
-    public void setHref(String href)
-            throws JspException
-    {
-        _href = href;
-    }
-
-    /**
      * 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.
@@ -325,21 +183,6 @@
     }
 
     /**
-     * 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."
-     * @netui.tldx:attribute
-     */
-    public void setLocation(String location)
-    {
-        _location = setNonEmptyValueAttribute(location);
-    }
-
-    /**
      * Sets <code>charset</code> attribute for the anchor.
      * @param charSet - the window target.
      * @jsptagref.attributedescription The character set.
@@ -415,36 +258,6 @@
     }
 
     /**
-     * Sets <code>shape</code> attribute for the anchor.
-     * @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."
-     * @netui.tldx:attribute category="misc"
-     */
-    public void setShape(String shape)
-    {
-        _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, SHAPE, shape);
-    }
-
-    /**
-     * Sets <code>coords</code> attribute for the anchor.
-     * @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."
-     * @netui.tldx:attribute category="misc"
-     */
-    public void setCoords(String coords)
-    {
-        _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, COORDS, 
coords);
-    }
-
-    /**
      * Sets the window target.
      * @param target - the window target.
      * @jsptagref.attributedescription The window target.
@@ -460,21 +273,6 @@
     }
 
 
-    //**************************** 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[]).
-     */
-    public void addParameter(String name, Object value) throws JspException
-    {
-        if (_params == null) {
-            _params = new HashMap();
-        }
-        ParamHelper.addParam(_params, name, value);
-    }
-
     /**
      * Prepare the hyperlink for rendering
      * @throws JspException if a JSP exception has occurred
@@ -538,358 +336,4 @@
         return EVAL_PAGE;
     }
 
-    /**
-     * This method will create the &lt;a> portion of an anchor.  It is called 
by subclasses, for example, the
-     * <code>ImageAnchor</code> relies on this code to generate the  &lt;a>.
-     * @param scriptRef a <code>ByRef&lt;String></code> that will contain any 
JavaScript that may need to be added
-     *               to the generated HTML response.
-     * @return a boolean value indicating if an error occur creating the 
anchor.
-     * @throws JspException
-     */
-    protected final boolean createAnchorBeginTag(HttpServletRequest request, 
ByRef scriptRef,
-                                                 TagRenderingBase trb, 
AbstractRenderAppender writer)
-            throws JspException
-    {
-        int have = 0;
-        String formAction = null;
-        String idScript = null;
-
-        if (_formSubmit)
-            _form = getNearestForm();
-
-        HttpServletResponse response = (HttpServletResponse) 
pageContext.getResponse();
-        ServletContext ctxt = pageContext.getServletContext();
-        JavaScriptUtils jsu = getJavaScriptUtils(request);
-
-        // 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 && tagId != null) {
-            return createNameAnchor(request, tagId, trb);
-        }
-
-        // if the anchor is submitting a consider this a submit level problem
-        // set the action to the form action.
-        if (_formSubmit == true) {
-            formAction = getFormAction();
-            if ((formAction != null) && (have == 0)) {
-                have++;
-            }
-            if (_action == null)
-                _action = formAction;
-        }
-
-        // 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[]{REQUIRED_ATTR});
-            registerTagError(s, null);
-            return false;
-        }
-
-        if (_linkName != null) {
-            return createPageAnchor(request, trb);
-        }
-
-        // report that action is not an action
-        if ((_action != null) && (!PageflowTagUtils.isAction(request, 
response, ctxt, _action))) {
-            String s = null;
-            if (_action.equals("")) {
-                s = Bundle.getString("Tags_NullBadAction", null);
-            }
-            else {
-                s = Bundle.getString("Tags_BadAction", _action);
-            }
-            registerTagError(s, null);
-        }
-
-        String internalHref = _state.href;
-        boolean absoluteUrl = false;
-
-        // we assume that tagId will over have override id if both
-        // are defined.
-        if (tagId != null) {
-            idScript = renderTagId(_state, null, true, false);
-        }
-        else {
-            _state.id = id;
-        }
-
-        // Special case for name anchors
-        if (_clientAction != null) {
-            _state.href = "";
-        }
-        else {
-            // Generate the opening anchor element
-            String type = URLRewriter.ACTION_UNSECURE;
-
-            if (_action != null) {
-                // simply set this to the result of mangling the action
-                String qualifiedAction = 
PageflowTagUtils.qualifiedAction(ctxt, _action);
-                String actionUrl = PageflowTagUtils.createActionPath(request, 
qualifiedAction);
-                if (URLRewriterService.needsSecure(request, ctxt, actionUrl, 
false))
-                    type = URLRewriter.ACTION_SECURE;
-                internalHref = PageflowTagUtils.createActionURL(request, 
qualifiedAction);
-            }
-            else if (_href != null) {
-                internalHref = _href;
-                if (FileUtils.isAbsoluteURI(internalHref)) {
-                    absoluteUrl = true;
-                }
-                else if (!internalHref.startsWith("/")) {
-                    // for internal hrefs, we need to see if we need to secure 
the request
-                    if (!_href.equals("")) {
-                        String reqUri = request.getRequestURI();
-                        String path = reqUri.substring(0, 
reqUri.lastIndexOf("/") + 1);
-                        internalHref = path + internalHref;
-
-                        // is this a secure operation?
-                        if ((!absoluteUrl) && 
(URLRewriterService.needsSecure(request, ctxt, internalHref, true)))
-                            type = URLRewriter.ACTION_SECURE;
-                    }
-                }
-            }
-
-            // Add the jpfScopeID parameter, if the scope attribute is present.
-            if (_scope != null) {
-                if (_params == null) {
-                    _params = new HashMap();
-                }
-                _params.put(ScopedServletUtils.SCOPE_ID_PARAM, _scope);
-            }
-
-            if (!absoluteUrl) {
-                internalHref = calculateURL(internalHref, _location);
-            }
-            else {
-                if ((_params != null) && (_params.size() > 0)) {
-                    StringBuilder sb = new StringBuilder(internalHref);
-                    String encoding = response.getCharacterEncoding();
-                    PageflowTagUtils.addParameters(sb, encoding, false, 
_params);
-                    internalHref = sb.toString();
-                }
-            }
-
-            if (internalHref == null) {
-                if (hasErrors()) {
-                    return false;
-                }
-            }
-
-            if (!absoluteUrl) {
-                internalHref = URLRewriterService.rewriteURL(ctxt, request, 
response, internalHref, type);
-                internalHref = qualifyUrlToContext(internalHref);
-            }
-            _state.href = internalHref;
-        }
-
-        // We need to combine the onclick features
-        IScriptReporter sr = getScriptReporter();
-        if (sr != null && sr.isRunAtClient()) {
-            if (_clientAction == null) {
-                if (_state.onClick == null) {
-                    _state.onClick = "NetUIAnchorRewriter(this);";
-                }
-                else {
-                    String click = HtmlUtils.escapeEscapes(_state.onClick);
-                    String entry = 
JavaScriptUtils.getString("createAnchorRewriterOnClickExists",
-                            new Object[]{click});
-                    _state.onClick = entry;
-                }
-            }
-            else {
-                //@todo: we need to support onclick chaining here also...
-                String action = HtmlUtils.escapeEscapes(_clientAction);
-                String entry = JavaScriptUtils.getString("netuiAction",
-                        new Object[]{action});
-                _state.onClick = entry;
-            }
-        }
-
-        // if the user override the onclick we will ignor this
-        if (_state.onClick == null && _formSubmit && formAction != null) {
-            String realFormName = getRealFormName();
-            _state.onClick = jsu.writeAnchorFormSubmitAction(realFormName, 
internalHref);
-            if (_form != null)
-                _form.generateRealName();
-        }
-
-        if (hasErrors())
-            return false;
-
-        trb.doStartTag(writer, _state);
-
-        //Emit javascript if this anchor needs to sumbit the form
-        if (_formSubmit && formAction != null || idScript != null) {
-            StringBuilder script = new StringBuilder(32);
-            StringBuilderRenderAppender scriptWriter = new 
StringBuilderRenderAppender(script);
-
-            if (_formSubmit && formAction != null)
-                jsu.writeAnchorFormSubmit(getScriptReporter(),scriptWriter);
-            if (idScript != null)
-                scriptWriter.append(idScript);
-            scriptRef.setRef(script.toString());
-        }
-
-        // create the javaScript
-        return true;
-    }
-
-    /**
-     * @param tagId
-     * @return
-     */
-    private boolean createNameAnchor(ServletRequest req, String tagId, 
TagRenderingBase trb)
-    {
-        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
-        _state.name = tagId;
-        trb = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req);
-        trb.doStartTag(writer, _state);
-        return !hasErrors();
-    }
-
-    private boolean createPageAnchor(ServletRequest req, TagRenderingBase trb)
-    {
-        _linkName = _linkName.trim();
-        if (_linkName.charAt(0) != '#') {
-            _state.href = "#" + _linkName;
-        }
-        else
-            _state.href = _linkName;
-
-        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
-        trb = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req);
-        trb.doStartTag(writer, _state);
-        return !hasErrors();
-    }
-
-    /**
-     * Release any acquired resources.
-     */
-    protected void localRelease()
-    {
-        super.localRelease();
-
-        _state.clear();
-
-        _text = null;
-        _action = null;
-        _href = null;
-        _linkName = null;
-        _location = null;
-        _scope = null;
-        _clientAction = null;
-        _params = null;
-        _formSubmit = false;
-    }
-
-    /**
-     * Return the complete URL to which this hyperlink will direct the user.
-     * @param href
-     * @param location
-     * @return
-     * @throws JspException
-     */
-    private String calculateURL(String href, String location) throws 
JspException
-    {
-        String url = null;
-        try {
-            url = PageflowTagUtils.computeURL(pageContext, null, href, null, 
null, _params, location, true);
-        }
-        catch (MalformedURLException e) {
-            // report the error...
-            logger.error(Bundle.getString("Tags_MalformedURLException"));
-            String s = null;
-            s = Bundle.getString("Tags_Anchor_URLException",
-                    new Object[]{e.getMessage()});
-            registerTagError(s, e);
-        }
-        return url;
-    }
-
-    /**
-     * 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;
-    }
-
-    /**
-     * 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 getRealFormName()
-    {
-        if (_form != null) {
-            return _form.getRealName();
-        }
-        return null;
-    }
-
-    /**
-     * 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."
-     * @netui.tldx:attribute category="misc"
-     */
-    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."
-     * @netui.tldx:attribute 
propertyclass="workshop.jspdesigner.properties.EventPropertyClass" 
category="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."
-     * @netui.tldx:attribute 
propertyclass="workshop.jspdesigner.properties.EventPropertyClass" 
category="event"
-     */
-    public void setOnFocus(String onfocus)
-    {
-        _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONFOCUS, 
onfocus);
-    }
 }

Added: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java
      Sat Nov 13 08:55:28 2004
@@ -0,0 +1,572 @@
+package org.apache.beehive.netui.tags.html;
+
+import org.apache.beehive.netui.tags.rendering.*;
+import org.apache.beehive.netui.tags.ByRef;
+import org.apache.beehive.netui.tags.IScriptReporter;
+import org.apache.beehive.netui.tags.HtmlUtils;
+import org.apache.beehive.netui.util.Bundle;
+import org.apache.beehive.netui.util.ParamHelper;
+import org.apache.beehive.netui.util.FileUtils;
+import org.apache.beehive.netui.util.logging.Logger;
+import org.apache.beehive.netui.pageflow.util.PageflowTagUtils;
+import org.apache.beehive.netui.pageflow.util.URLRewriter;
+import org.apache.beehive.netui.pageflow.util.URLRewriterService;
+import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+import java.net.MalformedURLException;
+
+/**
+ * This is the base class that provides most of the features necessary to 
create an anchor and an area. The Anchor
+ * and Area tags are created as subclasses of this tag.  The Area tag is 
really a subset of the features, so certain
+ * attributes are not defined here, even though the backing fields are defined 
here and the utility code knows them.
+ * This may not be the best OO design, but the design is optimized for 
performance of rendering anchor elements.
+ */
+abstract public class AnchorBase extends HtmlBaseTag
+        implements URLParams
+{
+    private static final String REQUIRED_ATTR = "href, action, linkName, 
clientAction";
+    private static final Logger logger = Logger.getInstance(AnchorBase.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 _scope;        // target scope; see comments on setScope()
+    private String _location;     // anchor to be added to the end of the 
hyperlink.
+    private Map _params;                 // Parameters
+    private Form _form;         // the nearest form
+    private boolean _formSubmit = false; // should the anchor submit an 
enclosing form?
+
+    /**
+     * 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.
+     * @throws JspException A JspException may be thrown if there is an error 
setting the attribute.
+     */
+    public void setAttribute(String name, String value, String facet)
+            throws JspException
+    {
+        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."
+     * @netui.tldx:attribute category="misc"
+     */
+    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."
+     * @netui.tldx:attribute category="misc"
+     */
+    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."
+     * @netui.tldx:attribute reftype="netui-action-url" category="general"
+     */
+    public void setAction(String action)
+            throws JspException
+    {
+        _action = setRequiredValueAttribute(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."
+     * @netui.tldx:attribute 
propertyclass="workshop.jspdesigner.properties.URIPropertyClass"
+     * reftype="url"
+     */
+    public void setHref(String href)
+            throws JspException
+    {
+        _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."
+     * @netui.tldx:attribute
+     */
+    public void setLocation(String location)
+    {
+        _location = setNonEmptyValueAttribute(location);
+    }
+
+    /**
+     * Set the name of the action for the Anchor.
+     * @param scope - the name of the action to set for the Anchor
+     * @jsptagref.attributedescription The scope
+     * @jsptagref.databindable false
+     * @jsptagref.attributesyntaxvalue <i>string_scope</i>
+     * @netui:attribute required="false" rtexprvalue="true"
+     * description="The scope"
+     * @netui.tldx:attribute category="general"
+     */
+    public void setScope(String scope)
+    {
+        _scope = setNonEmptyValueAttribute(scope);
+    }
+
+
+    /**
+     * 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 &lt;netui:anchor> tag
+     * is within a &lt;netui:form> tag,
+     * then the form data will be submitted to the method named in the
+     * &lt;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."
+     * @netui.tldx:attribute
+     */
+    public void setFormSubmit(boolean formSubmit)
+    {
+        _formSubmit = formSubmit;
+    }
+
+
+    /**
+     * 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."
+     * @netui.tldx:attribute category="misc"
+     */
+    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."
+     * @netui.tldx:attribute category="misc"
+     */
+    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."
+     * @netui.tldx:attribute 
propertyclass="workshop.jspdesigner.properties.EventPropertyClass" 
category="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."
+     * @netui.tldx:attribute 
propertyclass="workshop.jspdesigner.properties.EventPropertyClass" 
category="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[]).
+     */
+    public void addParameter(String name, Object value) throws JspException
+    {
+        if (_params == null) {
+            _params = new HashMap();
+        }
+        ParamHelper.addParam(_params, name, value);
+    }
+
+    /**
+     * This method will create the &lt;a> portion of an anchor.  It is called 
by subclasses, for example, the
+     * <code>ImageAnchor</code> relies on this code to generate the  &lt;a>.
+     * @param scriptRef a <code>ByRef&lt;String></code> that will contain any 
JavaScript that may need to be added
+     *               to the generated HTML response.
+     * @return a boolean value indicating if an error occur creating the 
anchor.
+     * @throws JspException
+     */
+    protected final boolean createAnchorBeginTag(HttpServletRequest request, 
ByRef scriptRef,
+                                                 TagRenderingBase trb, 
AbstractRenderAppender writer)
+            throws JspException
+    {
+        int have = 0;
+        String formAction = null;
+        String idScript = null;
+
+        if (_formSubmit)
+            _form = getNearestForm();
+
+        HttpServletResponse response = (HttpServletResponse) 
pageContext.getResponse();
+        ServletContext ctxt = pageContext.getServletContext();
+        JavaScriptUtils jsu = getJavaScriptUtils(request);
+
+        // 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 && tagId != null) {
+            return createNameAnchor(request, tagId, trb);
+        }
+
+        // if the anchor is submitting a consider this a submit level problem
+        // set the action to the form action.
+        if (_formSubmit == true) {
+            formAction = getFormAction();
+            if ((formAction != null) && (have == 0)) {
+                have++;
+            }
+            if (_action == null)
+                _action = formAction;
+        }
+
+        // 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[]{REQUIRED_ATTR});
+            registerTagError(s, null);
+            return false;
+        }
+
+        if (_linkName != null) {
+            return createPageAnchor(request, trb);
+        }
+
+        // report that action is not an action
+        if ((_action != null) && (!PageflowTagUtils.isAction(request, 
response, ctxt, _action))) {
+            String s = null;
+            if (_action.equals("")) {
+                s = Bundle.getString("Tags_NullBadAction", null);
+            }
+            else {
+                s = Bundle.getString("Tags_BadAction", _action);
+            }
+            registerTagError(s, null);
+        }
+
+        String internalHref = _state.href;
+        boolean absoluteUrl = false;
+
+        // we assume that tagId will over have override id if both
+        // are defined.
+        if (tagId != null) {
+            idScript = renderTagId(_state, null, true, false);
+        }
+        else {
+            _state.id = id;
+        }
+
+        // Special case for name anchors
+        if (_clientAction != null) {
+            _state.href = "";
+        }
+        else {
+            // Generate the opening anchor element
+            String type = URLRewriter.ACTION_UNSECURE;
+
+            if (_action != null) {
+                // simply set this to the result of mangling the action
+                String qualifiedAction = 
PageflowTagUtils.qualifiedAction(ctxt, _action);
+                String actionUrl = PageflowTagUtils.createActionPath(request, 
qualifiedAction);
+                if (URLRewriterService.needsSecure(request, ctxt, actionUrl, 
false))
+                    type = URLRewriter.ACTION_SECURE;
+                internalHref = PageflowTagUtils.createActionURL(request, 
qualifiedAction);
+            }
+            else if (_href != null) {
+                internalHref = _href;
+                if (FileUtils.isAbsoluteURI(internalHref)) {
+                    absoluteUrl = true;
+                }
+                else if (!internalHref.startsWith("/")) {
+                    // for internal hrefs, we need to see if we need to secure 
the request
+                    if (!_href.equals("")) {
+                        String reqUri = request.getRequestURI();
+                        String path = reqUri.substring(0, 
reqUri.lastIndexOf("/") + 1);
+                        internalHref = path + internalHref;
+
+                        // is this a secure operation?
+                        if ((!absoluteUrl) && 
(URLRewriterService.needsSecure(request, ctxt, internalHref, true)))
+                            type = URLRewriter.ACTION_SECURE;
+                    }
+                }
+            }
+
+            // Add the jpfScopeID parameter, if the scope attribute is present.
+            if (_scope != null) {
+                if (_params == null) {
+                    _params = new HashMap();
+                }
+                _params.put(ScopedServletUtils.SCOPE_ID_PARAM, _scope);
+            }
+
+            if (!absoluteUrl) {
+                internalHref = calculateURL(internalHref, _location);
+            }
+            else {
+                if ((_params != null) && (_params.size() > 0)) {
+                    StringBuilder sb = new StringBuilder(internalHref);
+                    String encoding = response.getCharacterEncoding();
+                    PageflowTagUtils.addParameters(sb, encoding, false, 
_params);
+                    internalHref = sb.toString();
+                }
+            }
+
+            if (internalHref == null) {
+                if (hasErrors()) {
+                    return false;
+                }
+            }
+
+            if (!absoluteUrl) {
+                internalHref = URLRewriterService.rewriteURL(ctxt, request, 
response, internalHref, type);
+                internalHref = qualifyUrlToContext(internalHref);
+            }
+            _state.href = internalHref;
+        }
+
+        // We need to combine the onclick features
+        IScriptReporter sr = getScriptReporter();
+        if (sr != null && sr.isRunAtClient()) {
+            if (_clientAction == null) {
+                if (_state.onClick == null) {
+                    _state.onClick = "NetUIAnchorRewriter(this);";
+                }
+                else {
+                    String click = HtmlUtils.escapeEscapes(_state.onClick);
+                    String entry = 
JavaScriptUtils.getString("createAnchorRewriterOnClickExists",
+                            new Object[]{click});
+                    _state.onClick = entry;
+                }
+            }
+            else {
+                //@todo: we need to support onclick chaining here also...
+                String action = HtmlUtils.escapeEscapes(_clientAction);
+                String entry = JavaScriptUtils.getString("netuiAction",
+                        new Object[]{action});
+                _state.onClick = entry;
+            }
+        }
+
+        // if the user override the onclick we will ignor this
+        if (_state.onClick == null && _formSubmit && formAction != null) {
+            String realFormName = getRealFormName();
+            _state.onClick = jsu.writeAnchorFormSubmitAction(realFormName, 
internalHref);
+            if (_form != null)
+                _form.generateRealName();
+        }
+
+        if (hasErrors())
+            return false;
+
+        trb.doStartTag(writer, _state);
+
+        //Emit javascript if this anchor needs to sumbit the form
+        if (_formSubmit && formAction != null || idScript != null) {
+            StringBuilder script = new StringBuilder(32);
+            StringBuilderRenderAppender scriptWriter = new 
StringBuilderRenderAppender(script);
+
+            if (_formSubmit && formAction != null)
+                jsu.writeAnchorFormSubmit(getScriptReporter(),scriptWriter);
+            if (idScript != null)
+                scriptWriter.append(idScript);
+            scriptRef.setRef(script.toString());
+        }
+
+        // create the javaScript
+        return true;
+    }
+
+    /**
+     * @param tagId
+     * @return
+     */
+    private boolean createNameAnchor(ServletRequest req, String tagId, 
TagRenderingBase trb)
+    {
+        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
+        _state.name = tagId;
+        trb = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req);
+        trb.doStartTag(writer, _state);
+        return !hasErrors();
+    }
+
+    private boolean createPageAnchor(ServletRequest req, TagRenderingBase trb)
+    {
+        _linkName = _linkName.trim();
+        if (_linkName.charAt(0) != '#') {
+            _state.href = "#" + _linkName;
+        }
+        else
+            _state.href = _linkName;
+
+        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
+        trb = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req);
+        trb.doStartTag(writer, _state);
+        return !hasErrors();
+    }
+
+    /**
+     * Return the complete URL to which this hyperlink will direct the user.
+     * @param href
+     * @param location
+     * @return
+     * @throws JspException
+     */
+    private String calculateURL(String href, String location) throws 
JspException
+    {
+        String url = null;
+        try {
+            url = PageflowTagUtils.computeURL(pageContext, null, href, null, 
null, _params, location, true);
+        }
+        catch (MalformedURLException e) {
+            // report the error...
+            logger.error(Bundle.getString("Tags_MalformedURLException"));
+            String s = null;
+            s = Bundle.getString("Tags_Anchor_URLException",
+                    new Object[]{e.getMessage()});
+            registerTagError(s, e);
+        }
+        return url;
+    }
+
+    /**
+     * 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;
+    }
+
+    /**
+     * 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 getRealFormName()
+    {
+        if (_form != null) {
+            return _form.getRealName();
+        }
+        return null;
+    }
+
+    /**
+     * Release any acquired resources.
+     */
+    protected void localRelease()
+    {
+        super.localRelease();
+
+        _state.clear();
+        _linkName = null;
+        _clientAction = null;
+
+        _action = null;
+        _href = null;
+        _scope = null;
+        _location = null;
+        _params = null;
+        _form = null;
+        _formSubmit = false;
+    }
+
+}

Added: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Area.java
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Area.java
    Sat Nov 13 08:55:28 2004
@@ -0,0 +1,95 @@
+package org.apache.beehive.netui.tags.html;
+
+import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
+import org.apache.beehive.netui.tags.rendering.WriteRenderAppender;
+import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
+import org.apache.beehive.netui.tags.ByRef;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.http.HttpServletRequest;
+/**
+ * @netui:tag name="area" description="Generates a URL-encoded area to a 
specified URI."
+ * @netui.tldx:tag renderer="workshop.netui.jspdesigner.tldx.AreaRenderer" 
whitespace="indent"
+ * @see Attribute
+ * @see java.lang.String
+*/
+public class Area extends AnchorBase
+{
+    /**
+     * Returns the name of the Tag.
+     */
+    public String getTagName()
+    {
+        return "Area";
+    }
+
+    /**
+     * 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 property to specify the alt text of the image.
+     * @param alt - the image alignment.
+     * @jsptagref.attributedescription The alternative text of the image
+     * @jsptagref.databindable Read Only
+     * @jsptagref.attributesyntaxvalue <i>string_alt</i>
+     * @netui:attribute required="false" rtexprvalue="true"
+     * description="The alternative text of the image."
+     * @netui.tldx:attribute
+     */
+    public void setAlt(String alt)
+    {
+        _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ALT, alt, 
true);
+    }
+
+    /**
+     * Prepare the hyperlink for rendering
+     * @throws javax.servlet.jsp.JspException if a JSP exception has occurred
+     */
+    public int doStartTag() throws JspException
+    {
+        if (hasErrors())
+            return SKIP_BODY;
+        return EVAL_BODY_BUFFERED;
+    }
+
+    /**
+     * Render the hyperlink.
+     * @throws JspException if a JSP exception has occurred
+     */
+    public int doEndTag() throws JspException
+    {
+        // report errors that may have occurred when the required attributes 
are being set
+        if (hasErrors())
+            return reportAndExit(EVAL_PAGE);
+
+        // build the anchor into the results
+        ByRef script = new ByRef();
+
+        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
+        HttpServletRequest request = (HttpServletRequest) 
pageContext.getRequest();
+        TagRenderingBase trb = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.AREA_TAG, request);
+
+        if (!createAnchorBeginTag(request, script, trb, writer)) {
+            if (!script.isNull())
+                write(script.getRef().toString());
+            return reportAndExit(EVAL_PAGE);
+        }
+
+        assert(trb != null) : "trb is null";
+        trb.doEndTag(writer);
+
+        if (!script.isNull())
+            write(script.getRef().toString());
+
+        // Render the remainder to the output stream
+        localRelease();
+        return EVAL_PAGE;
+    }
+}

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlConstants.java
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlConstants.java
   (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlConstants.java
   Sat Nov 13 08:55:28 2004
@@ -465,6 +465,11 @@
     static final String ANCHOR = "a";
 
     /**
+     * The name of the <code>area</code> element.
+     */
+    static final String AREA = "area";
+
+    /**
      * The name of the <code>base</code> element.
      */
     static final String BASE = "base";

Added: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AreaTag.java
    Sat Nov 13 08:55:28 2004
@@ -0,0 +1,64 @@
+package org.apache.beehive.netui.tags.rendering;
+
+import org.apache.beehive.netui.tags.html.HtmlConstants;
+
+import java.util.HashMap;
+
+abstract public class AreaTag extends TagHtmlBase implements HtmlConstants
+{
+    /**
+     * Add the Renderer for the HTML and XHTML tokens.
+     * @param html  The map of HTML Tag Renderers
+     * @param xhtml The map of XHTML Tag Renderers
+     */
+    public static void add(HashMap html, HashMap xhtml)
+    {
+        html.put(AREA_TAG, new AreaTag.HtmlRendering());
+        xhtml.put(ANCHOR_TAG, new AreaTag.XhtmlRendering());
+    }
+
+    public void doStartTag(AbstractRenderAppender sb, AbstractTagState 
renderState)
+    {
+        assert(sb != null) : "Parameter 'sb' must not be null";
+        assert(renderState != null) : "Parameter 'renderState' must not be 
null";
+        assert(renderState instanceof ImageTag.State) : "Paramater 
'renderState' must be an instance of ImageTag.State";
+
+        AnchorTag.State state = (AnchorTag.State) renderState;
+
+        renderTag(sb, ANCHOR);
+        renderAttribute(sb, ID, state.id);
+        renderAttribute(sb, NAME, state.name);
+        renderAttribute(sb, HREF, state.href);
+
+        renderAttribute(sb, CLASS, state.styleClass);
+        renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
+        renderAttribute(sb, STYLE, state.style);
+        renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state, false);
+
+        renderAttributeSingleQuotes(sb, ONCLICK, state.onClick);
+
+        writeEnd(sb);
+    }
+
+    public void doEndTag(AbstractRenderAppender sb)
+    {
+    }
+
+    abstract protected void writeEnd(AbstractRenderAppender sb);
+
+    private static class HtmlRendering extends AreaTag
+    {
+        protected void writeEnd(AbstractRenderAppender sb)
+        {
+            sb.append(">");
+        }
+    }
+
+    private static class XhtmlRendering extends AreaTag
+    {
+        protected void writeEnd(AbstractRenderAppender sb)
+        {
+            sb.append(" />");
+        }
+    }
+}

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
   (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
   Sat Nov 13 08:55:28 2004
@@ -56,10 +56,7 @@
      * Token identifying the Anchor Renderer &lt;a>
      */
     public static final Object ANCHOR_TAG = new Object();
-
-    /**
-     * Token indentifying the Base Renderer &lt;base>
-     */
+    public static final Object AREA_TAG = new Object();
     public static final Object BASE_TAG = new Object();
     public static final Object BODY_TAG = new Object();
     public static final Object BR_TAG = new Object();

Reply via email to