1 package org.apache.beehive.netui.tags.rendering; 2 3 import org.apache.beehive.netui.tags.html.HtmlConstants; 4 5 import java.util.HashMap ; 6 7 abstract public class AreaTag extends TagHtmlBase implements HtmlConstants 8 { 9 14 public static void add(HashMap html, HashMap htmlQuirks, HashMap 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 renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state); 43 44 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 |