:  » Library » Apache-beehive-1.0.2 » org » apache » beehive » netui » tags » rendering » Java Open Source

Java Open Source » Library » Apache beehive 1.0.2 
Apache beehive 1.0.2 » org » apache » beehive » netui » tags » rendering »
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * $Header:$
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 htmlQuirks, HashMap xhtml)
        html.put(AREA_TAG, new HtmlRendering());
        htmlQuirks.put(AREA_TAG, new HtmlRendering());
        xhtml.put(AREA_TAG, new 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 AnchorTag.State) : "Paramater 'renderState' must be an instance of AnchorTag.State:"
                + renderState.getClass().getName();

        AnchorTag.State state = (AnchorTag.State) renderState;

        renderTag(sb, AREA);
        renderAttribute(sb, ID,;
        renderAttribute(sb, NAME,;
        renderAttribute(sb, HREF, state.href);

        renderAttribute(sb, CLASS, state.styleClass);
        renderAttributes(AbstractHtmlState.ATTR_GENERAL, sb, state);
        renderAttribute(sb, STYLE,;

        //String onclick = state.getAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK);
        //if (onclick != null)
        //    state.removeAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK);
        renderAttributes(AbstractHtmlState.ATTR_JAVASCRIPT, sb, state);

        // backward compat for a second
        //renderAttributeSingleQuotes(sb, ONCLICK, onclick);


    public void doEndTag(AbstractRenderAppender sb)

    abstract protected void writeEnd(AbstractRenderAppender sb);

    private static class HtmlRendering extends AreaTag
        protected void writeEnd(AbstractRenderAppender sb)

    private static class XhtmlRendering extends AreaTag
        protected void writeEnd(AbstractRenderAppender sb)
            sb.append(" />");
}  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.