1 18 package org.apache.beehive.netui.tags.rendering; 19 20 import org.apache.beehive.netui.tags.html.HtmlConstants; 21 22 import java.util.HashMap ; 23 24 28 abstract public class AnchorTag extends TagHtmlBase implements HtmlConstants 29 { 30 35 public static void add(HashMap html, HashMap htmlQuirks, HashMap xhtml) 36 { 37 html.put(ANCHOR_TAG, new Rendering()); 38 htmlQuirks.put(ANCHOR_TAG, new Rendering()); 39 xhtml.put(ANCHOR_TAG, new Rendering()); 40 } 41 42 45 public static class State extends AbstractHtmlState 46 { 47 public String name; 48 public String href; 49 50 public void clear() 51 { 52 super.clear(); 53 54 name = null; 55 href = null; 56 } 57 } 58 59 62 private static class Rendering extends AnchorTag 63 { 64 public void doStartTag(AbstractRenderAppender sb, AbstractTagState renderState) 65 { 66 assert(sb != null) : "Parameter 'sb' must not be null"; 67 assert(renderState != null) : "Parameter 'renderState' must not be null"; 68 assert(renderState instanceof State) : "Paramater 'renderState' must be an instance of AnchorTag.State"; 69 70 State state = (State) renderState; 72 73 renderTag(sb, ANCHOR); 74 renderAttribute(sb, ID, state.id); 75 renderAttribute(sb, NAME, state.name); 76 renderAttribute(sb, HREF, state.href); 77 78 renderAttribute(sb, CLASS, state.styleClass); 79 renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state); 80 renderAttribute(sb, STYLE, state.style); 81 82 renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state); 83 sb.append(">"); 84 } 85 86 public void doEndTag(AbstractRenderAppender sb) 87 { 88 renderEndTag(sb, ANCHOR); 89 } 90 } 91 } 92 | Popular Tags |