Package org.apache.empire.struts2.html.HtmlWriter

Examples of org.apache.empire.struts2.html.HtmlWriter.HtmlTag


    public int doStartTag() throws JspException
    {
        // Tabel cell tag
        HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
        HtmlWriter w = new HtmlWriter(pageContext.getOut());
        HtmlTag menu = w.startTag(dic.MenuTag());
        addStandardAttributes(menu, null);
        menu.beginBody(true);
        // Create Menu Item Info
        MenuInfo mi = new MenuInfo();
        // Get Stack
        Stack<MenuInfo> stack = (Stack<MenuInfo>)pageContext.getAttribute(MENU_STACK_ATTRIBUTE);
        if (stack!=null)
View Full Code Here


                pageContext.removeAttribute(MENU_STACK_ATTRIBUTE);
        }
        // Write End Tag
        HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
        HtmlWriter w = new HtmlWriter(pageContext.getOut());
        HtmlTag menu = w.continueTag (dic.MenuTag(), true);
        menu.endTag();
        // done
        resetParams();
        return EVAL_PAGE;
    }
View Full Code Here

    {
        if (vi instanceof ControlInfo)
        {   // Wrap read only in a div if it's a control
            ControlInfo ci = ((ControlInfo)vi);
            HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
            HtmlTag div = writer.startTag(dic.InputReadOnlyDataWrapperTag());
            div.addAttribute("id",    ci.getId());
            div.addAttribute("class", ci.getCssClass());
            div.addAttribute("style", ci.getCssStyle());
            div.beginBody();
            internalRenderText(writer, vi);
            div.endTag();
        }
        else
        {
            internalRenderText(writer, vi);
        }
View Full Code Here

    }
   
    @Override
    public void renderInput(HtmlWriter writer, ControlInfo ci)
    {
        HtmlTag input = writer.startTag("input");
        input.addAttribute("type", "text");
        input.addAttribute("id",    ci.getId());
        input.addAttribute("class", ci.getCssClass());
        input.addAttribute("style", ci.getCssStyle());
        if (ci.getDisabled()==false)
        {   // Name of the field
            input.addAttribute("name", ci.getName());
            // Get Max Length
            int maxLength = getMaxInputLength(ci.getColumn());
            if (maxLength>0)
            {
                input.addAttribute("maxlength", maxLength);
                input.addAttribute("size", String.valueOf(Math.min(maxLength, ci.getHSize())));
            }  
        }
        else
        {   // Disabled text control
            input.addAttribute("disabled");
            // Get Max Length
            int maxLength = getMaxInputLength(ci.getColumn());
            if (maxLength>0)
            {
                input.addAttribute("size", String.valueOf(Math.min(maxLength, ci.getHSize())));
            }  
        }
        // Value
        input.addAttribute("value", formatValue(ci, ci.getDisabled()));
        // Event Attributes
        input.addAttribute("onclick",   ci.getOnclick());
        input.addAttribute("onchange",  ci.getOnchange());
        input.addAttribute("onfocus",   ci.getOnfocus());
        input.addAttribute("onblur",    ci.getOnblur());
        input.endTag();
        // Add Unit
        if (ci.getDisabled()==false)
        {  
            String unit = getUnitString(ci);
            if (unit != null)
View Full Code Here

            if (useBean())
                setId(null); // Id has already be used for componentBean
            // Render Tag
            HtmlTagDictionary dic = HtmlTagDictionary.getInstance()
            HtmlWriter w = new HtmlWriter(pageContext.getOut());
            HtmlTag wrapTag  = w.startTag( dic.FormPartWrapperTag());
            addStandardAttributes(wrapTag, dic.FormPartWrapperClass());
            wrapTag.addAttributes(dic.FormPartWrapperAttributes());
            wrapTag.beginBody(true);
        }
        // do Start
        return result;
    }
View Full Code Here

        // Close Wrapper Tag
        if (renderWrapperTag())
        {   // Close Form Wrapper Tag
            HtmlTagDictionary dic = HtmlTagDictionary.getInstance()
            HtmlWriter w = new HtmlWriter(pageContext.getOut());
            HtmlTag wrap = w.continueTag(dic.FormPartWrapperTag(), true);
            wrap.endTag();
        }
        // NullValue
        if (nullValue!=null)
            removePageAttribute(NULLVALUE_ATTRIBUTE, oldNullValue);
        oldNullValue = null;
View Full Code Here

        MenuTag.MenuInfo mi = getMenuInfo();
        boolean current = isCurrent(mi);
        // HtmlWriter
        HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
        HtmlWriter w = new HtmlWriter(pageContext.getOut());
        HtmlTag wrap = w.startTag("li");
        addStandardAttributes(wrap, null);
        this.cssClass = getCssClass(mi, current);
        this.cssStyle = null;
        wrap.beginBody();
        // The Anchors
        if (item== null && mi.actionItem!=null)
            item = mi.actionItem;
        // OnClick
        if (onclick== null)
View Full Code Here

        setBodyContent(null);
        // End tag
        int result = super.doEndTag();
        // HtmlWriter
        HtmlWriter w = new HtmlWriter(pageContext.getOut());
        HtmlTag wrap = w.continueTag("li", true);
        wrap.endTag(body);
        // Done
        return result;
    }
View Full Code Here

                double height = Math.max(ci.getVSize(), 2) * 1.25;
                style +=  "height:" + height + "em";
            }
            // Wrap read only in a div if it's a control
            HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
            HtmlTag div = writer.startTag(dic.InputReadOnlyDataWrapperTag());
            div.addAttribute("id",    ci.getId());
            div.addAttribute("class", ci.getCssClass());
            div.addAttribute("style", style);
            div.beginBody();
            internalRenderText(writer, vi);
            div.endTag();
        }
        else
        {
            super.internalRenderText(writer, vi);
        }
View Full Code Here

    }
   
    @Override
    public void renderInput(HtmlWriter writer, ControlInfo ci)
    {
        HtmlTag input = writer.startTag("textarea");
        input.addAttribute("id",    ci.getId());
        input.addAttribute("class", ci.getCssClass());
        input.addAttribute("style", ci.getCssStyle());
        input.addAttribute("name",  ci.getName());
        input.addAttribute("disabled", ci.getDisabled());
        input.addAttribute("rows",  Math.max(ci.getVSize(), 2));
        input.addAttribute("cols",  Math.max(ci.getHSize(), 1));
        // maxlength
        if (ci.getDisabled()==false)
        {   // Get Max Length
            String checklength = getFormatOption(ci, "maxlength:");
            if (StringUtils.isValid(checklength))
            {   // Do lengthcheck via onKeyPress and onKeyUp Events
                int maxLength = (int)ci.getColumn().getSize();
                checklength = StringUtils.replace(checklength, "{0}", String.valueOf(maxLength));
                input.addAttribute("onkeypress", checklength);
                input.addAttribute("onkeyup",    checklength);
            }  
        }
        // Event Attributes
        input.addAttribute("onclick",   ci.getOnclick());
        input.addAttribute("onchange",  ci.getOnchange());
        input.addAttribute("onfocus",   ci.getOnfocus());
        input.addAttribute("onblur",    ci.getOnblur());
        // Body
        String value = StringUtils.toString(ci.getValue());
        value = TextUtils.htmlEncode(value);
        input.beginBody(value);
        // End
        input.endTag();
    }
View Full Code Here

TOP

Related Classes of org.apache.empire.struts2.html.HtmlWriter.HtmlTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.