KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tags > rendering > AreaTag


1 package org.apache.beehive.netui.tags.rendering;
2
3 import org.apache.beehive.netui.tags.html.HtmlConstants;
4
5 import java.util.HashMap JavaDoc;
6
7 abstract public class AreaTag extends TagHtmlBase implements HtmlConstants
8 {
9     /**
10      * Add the Renderer for the HTML and XHTML tokens.
11      * @param html The map of HTML Tag Renderers
12      * @param xhtml The map of XHTML Tag Renderers
13      */

14     public static void add(HashMap JavaDoc html, HashMap JavaDoc htmlQuirks, HashMap JavaDoc xhtml)
15     {
16         html.put(AREA_TAG, new HtmlRendering());
17         htmlQuirks.put(AREA_TAG, new HtmlRendering());
18         xhtml.put(AREA_TAG, new XhtmlRendering());
19     }
20
21     public void doStartTag(AbstractRenderAppender sb, AbstractTagState renderState)
22     {
23         assert(sb != null) : "Parameter 'sb' must not be null";
24         assert(renderState != null) : "Parameter 'renderState' must not be null";
25         assert(renderState instanceof AnchorTag.State) : "Paramater 'renderState' must be an instance of AnchorTag.State:"
26                 + renderState.getClass().getName();
27
28         AnchorTag.State state = (AnchorTag.State) renderState;
29
30         renderTag(sb, AREA);
31         renderAttribute(sb, ID, state.id);
32         renderAttribute(sb, NAME, state.name);
33         renderAttribute(sb, HREF, state.href);
34
35         renderAttribute(sb, CLASS, state.styleClass);
36         renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
37         renderAttribute(sb, STYLE, state.style);
38
39         //String onclick = state.getAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK);
40
//if (onclick != null)
41
// state.removeAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK);
42
renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state);
43
44         // backward compat for a second
45
//renderAttributeSingleQuotes(sb, ONCLICK, onclick);
46

47         writeEnd(sb);
48     }
49
50     public void doEndTag(AbstractRenderAppender sb)
51     {
52     }
53
54     abstract protected void writeEnd(AbstractRenderAppender sb);
55
56     private static class HtmlRendering extends AreaTag
57     {
58         protected void writeEnd(AbstractRenderAppender sb)
59         {
60             sb.append(">");
61         }
62     }
63
64     private static class XhtmlRendering extends AreaTag
65     {
66         protected void writeEnd(AbstractRenderAppender sb)
67         {
68             sb.append(" />");
69         }
70     }
71 }
72
Popular Tags