Example usage for javax.servlet.jsp JspWriter write

List of usage examples for javax.servlet.jsp JspWriter write

Introduction

In this page you can find the example usage for javax.servlet.jsp JspWriter write.

Prototype

public void write(int c) throws IOException 

Source Link

Document

Writes a single character.

Usage

From source file:org.kuali.kfs.sys.document.web.renderers.DropDownRenderer.java

/**
 * //from w  w  w  .  j a v  a  2s . co m
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag)
 */
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();

    try {
        out.write(buildSelectControl());
        renderQuickFinderIfNecessary(pageContext, parentTag);
        if (isShowError()) {
            renderErrorIcon(pageContext);
        }
        RendererUtil.registerEditableProperty(pageContext, getFieldName());
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering drop down control", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.DynamicNameLabelRenderer.java

/**
 * //from w w  w.  jav a 2 s.  c om
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag, org.kuali.rice.krad.bo.BusinessObject)
 */
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();
    try {
        out.write("<br />");
        out.write("<div id=\"" + fieldName + ".div\" class=\"fineprint\">");
        if (!StringUtils.isBlank(fieldValue)) {
            out.write(fieldValue);
        }
        out.write("</div>");

        if (!StringUtils.isBlank(fieldValue)) {
            renderValuePersistingTag(pageContext, parentTag);
        }
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering a dynamic field label", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.DynamicReadOnlyRender.java

/**
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag)
 *///from ww  w.  j a  va 2s .  c o  m
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();

    try {
        String value = discoverRenderValue();
        out.write(buildBeginSpan());

        if (!StringUtils.isEmpty(value)) {
            if (shouldRenderInquiryLink()) {
                out.write(buildBeginInquiryLink());
            }
            out.write(value);
            if (shouldRenderInquiryLink()) {
                out.write(buildEndInquiryLink());
            }
        } else {
            out.write(buildNonBreakingSpace());
        }

        out.write(buildEndSpan());
        renderShadowInputTag(pageContext, parentTag);
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering read only field", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.GroupTitleLineRenderer.java

protected void renderGroupLevelActions(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();

    try {//from w ww .  j  a va2  s. c  om
        out.write(this.buildGroupActionsBeginning());

        this.renderGroupActions(pageContext, parentTag);

        this.renderUploadCell(pageContext, parentTag);

        out.write(this.buildGroupActionsColumnEnding());
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering group level actions", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.GroupTitleLineRenderer.java

/**
 * Oy, the big one...this one actually renders instead of returning the HTML in a String. This is because it's kind of complex
 * (and a likely target for future refactoring)
 *
 * @param pageContext the page contex to render to
 * @param parentTag the tag that is requesting all the rendering
 * @throws JspException thrown if something goes wrong
 *///from   ww  w. j a v  a2s .c om
protected void renderUploadCell(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();

    if (canUpload()) {
        try {
            String hideImport = getHideImportName();
            String showImport = getShowImportName();
            String showLink = getShowLinkName();
            String uploadDiv = getUploadDivName();

            out.write("\n<SCRIPT type=\"text/javascript\">\n");
            out.write("<!--\n");
            out.write("\tfunction " + hideImport + "(showLinkId, uploadDivId) {\n");
            out.write("\t\tdocument.getElementById(showLinkId).style.display=\"inline\";\n");
            out.write("\t\tdocument.getElementById(uploadDivId).style.display=\"none\";\n");
            out.write("\t}\n");
            out.write("\tfunction " + showImport + "(showLinkId, uploadDivId) {\n");
            out.write("\t\tdocument.getElementById(showLinkId).style.display=\"none\";\n");
            out.write("\t\tdocument.getElementById(uploadDivId).style.display=\"inline\";\n");
            out.write("\t}\n");
            out.write("\tdocument.write(\n");
            out.write("\t\t'<a id=\"" + showLink + "\" href=\"#\" onclick=\"" + showImport + "(\\\'" + showLink
                    + "\\\',\\\'" + uploadDiv + "\\\');return false;\">' +\n");
            out.write("\t\t'<img src=\""
                    + SpringContext.getBean(ConfigurationService.class)
                            .getPropertyValueAsString("externalizable.images.url")
                    + "tinybutton-importlines.gif\" title=\"import file\" alt=\"import file\"' +\n");
            out.write("\t\t'width=\"72\" border=\"0\">' +\n");
            out.write("\t\t'</a>' +\n");
            out.write("\t\t'<div id=\"" + uploadDiv + "\" style=\"display:none;\" >' +\n");

            out.write("\t\t'");

            scriptFileTag.setPageContext(pageContext);
            scriptFileTag.setParent(parentTag);
            String index = StringUtils.substringBetween(getLineCollectionProperty(), "[", "]");
            if (StringUtils.isNotBlank(index) && getLineCollectionProperty().contains("transactionEntries")) {
                scriptFileTag.setProperty(StringUtils.substringBeforeLast(getLineCollectionProperty(), ".")
                        + "." + accountingLineGroupDefinition.getImportedLinePropertyPrefix() + "File");
            } else {
                scriptFileTag
                        .setProperty(accountingLineGroupDefinition.getImportedLinePropertyPrefix() + "File");
            }
            scriptFileTag.doStartTag();
            scriptFileTag.doEndTag();

            out.write("' +\n");
            out.write("\t\t'");

            uploadButtonTag.setPageContext(pageContext);
            uploadButtonTag.setParent(parentTag);
            uploadButtonTag.setProperty("methodToCall.upload"
                    + StringUtils.capitalize(accountingLineGroupDefinition.getImportedLinePropertyPrefix())
                    + "Lines" + "." + getLineCollectionProperty());
            uploadButtonTag
                    .setAlt("insert " + accountingLineGroupDefinition.getGroupLabel() + " accounting lines");
            uploadButtonTag
                    .setTitle("insert " + accountingLineGroupDefinition.getGroupLabel() + " accounting lines");
            uploadButtonTag.doStartTag();
            uploadButtonTag.doEndTag();

            out.write("' +\n");

            out.write("\t\t'");

            cancelButtonTag.setPageContext(pageContext);
            cancelButtonTag.setParent(parentTag);
            cancelButtonTag.setAlt(
                    "Cancel import of " + accountingLineGroupDefinition.getGroupLabel() + " accounting lines");
            cancelButtonTag.setTitle(
                    "Cancel import of " + accountingLineGroupDefinition.getGroupLabel() + " accounting lines");
            cancelButtonTag.setOnclick(
                    getHideImportName() + "(\\\'" + showLink + "\\\',\\\'" + uploadDiv + "\\\');return false;");
            cancelButtonTag.doStartTag();
            cancelButtonTag.doEndTag();

            out.write("' +\n");

            out.write("\t'</div>');\n");
            out.write("\t//-->\n");
            out.write("</SCRIPT>\n");
            out.write("<NOSCRIPT>\n");
            out.write("\tImport " + accountingLineGroupDefinition.getGroupLabel() + " lines\n");

            noscriptFileTag.setPageContext(pageContext);
            noscriptFileTag.setParent(parentTag);
            noscriptFileTag.setProperty(accountingLineGroupDefinition.getImportedLinePropertyPrefix() + "File");
            noscriptFileTag.doStartTag();
            noscriptFileTag.doEndTag();

            uploadButtonTag.doStartTag();
            uploadButtonTag.doEndTag();

            out.write("</NOSCRIPT>\n");
        } catch (IOException ioe) {
            throw new JspException("Difficulty rendering accounting lines import upload", ioe);
        }
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.HideShowBlockRenderer.java

/**
 * Renders the title row and forces the rendering of child content
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag)
 */// www  .j  a v a2s  .  c om
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();

    try {
        out.write(buildLabelButtonTableOpening());
        renderTabStateTag(pageContext, parentTag);
        if (!StringUtils.isBlank(hideShowBlock.getLabel())) {
            out.write(hideShowBlock.getLabel());
        }
        renderShowHideButton(pageContext, parentTag);
        out.write(buildLabelButtonTableClosing());
        out.write(buildInnerTableOpening());
        hideShowBlock.renderChildRows(pageContext, parentTag);
        out.write(buildInnerTableClosing());
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering Hide/Show block", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.LabelRenderer.java

/**
 * //from   w ww. ja va2 s  . c o  m
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag, org.kuali.rice.krad.bo.BusinessObject)
 */
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    try {
        JspWriter out = pageContext.getOut();
        if (!StringUtils.isBlank(labelFor)) {
            out.write("<label for=\"" + labelFor + "\">");
        }
        if (required) {
            out.write(KFSConstants.REQUIRED_FIELD_SYMBOL);
            out.write("&nbsp;");
        }
        if (!StringUtils.isBlank(fullClassNameForHelp) && !StringUtils.isBlank(attributeEntryForHelp)) {
            out.write("<a href=\"");
            out.write(getApplicationURL());
            out.write("/kr/help.do?methodToCall=getAttributeHelpText&amp;businessObjectClassName=");
            out.write(fullClassNameForHelp);
            out.write("&amp;attributeName=");
            out.write(attributeEntryForHelp);
            out.write("\" target=\"_blank\">");
        }
        out.write(label);
        if (!StringUtils.isBlank(fullClassNameForHelp) && !StringUtils.isBlank(attributeEntryForHelp)) {
            out.write("</a>");
        }
        if (!StringUtils.isBlank(labelFor)) {
            out.write("</label>");
        }
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering label", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.RadioButtonGroupRenderer.java

/**
 * //w ww. j  a v  a2s .  c  om
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag)
 */
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();

    try {
        out.write(buildRadioButtons());
        renderQuickFinderIfNecessary(pageContext, parentTag);
        if (isShowError()) {
            renderErrorIcon(pageContext);
        }
        RendererUtil.registerEditableProperty(pageContext, getFieldName());
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering radio buttons", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.ReadOnlyRenderer.java

/**
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag)
 */// w ww .j a  v a 2  s.c  om
@Override
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();

    try {
        String value = discoverRenderValue();
        out.write(buildBeginSpan());

        if (!StringUtils.isEmpty(value)) {
            if (shouldRenderInquiryLink()) {
                out.write(buildBeginInquiryLink());
            }
            out.write(value);
            if (shouldRenderInquiryLink()) {
                out.write(buildEndInquiryLink());
            }
        } else {
            out.write(buildNonBreakingSpace());
        }

        out.write(buildEndSpan());
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering read only field", ioe);
    }
}

From source file:org.kuali.kfs.sys.document.web.renderers.TableCellRenderer.java

/**
 * Renders the table cell as a header cell as well as rendering all children renderable elements of the cell
 * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag)
 *//*from w  ww. ja  v a 2  s.co m*/
public void render(PageContext pageContext, Tag parentTag) throws JspException {
    JspWriter out = pageContext.getOut();
    try {
        out.write(buildBeginningTag());
        if (cell.hasChildElements()) {
            cell.renderChildrenElements(pageContext, parentTag);
        } else {
            out.write("&nbsp;");
        }
        out.write(buildEndingTag());
    } catch (IOException ioe) {
        throw new JspException("Difficulty rendering table cell", ioe);
    }
}