Search in sources :

Example 96 with JspWriter

use of javax.servlet.jsp.JspWriter in project sw360portal by sw360.

the class CompareAttachments method doStartTag.

public int doStartTag() throws JspException {
    JspWriter jspWriter = pageContext.getOut();
    StringBuilder display = new StringBuilder();
    try {
        renderAttachments(jspWriter, actual, additions, deletions, contextType, contextId);
        String renderString = display.toString();
        if (Strings.isNullOrEmpty(renderString)) {
            renderString = "<h4> No changes in attachments </h4>";
        }
        jspWriter.print(renderString);
    } catch (Exception e) {
        throw new JspException(e);
    }
    return SKIP_BODY;
}
Also used : JspException(javax.servlet.jsp.JspException) JspWriter(javax.servlet.jsp.JspWriter) JspException(javax.servlet.jsp.JspException) IOException(java.io.IOException)

Example 97 with JspWriter

use of javax.servlet.jsp.JspWriter in project sw360portal by sw360.

the class DisplayEnumSelection method doEnumValues.

private void doEnumValues(Iterable<? extends TEnum> enums) throws IOException {
    JspWriter jspWriter = getJspContext().getOut();
    Iterator<? extends TEnum> iterator = enums.iterator();
    while (iterator.hasNext()) {
        TEnum enumItem = iterator.next();
        String enumItemDescription = ThriftEnumUtils.enumToString(enumItem);
        boolean selected = enumItem.equals(this.selected) || enumItem.toString().equals(this.selectedName);
        String value = useStringValues ? enumItem.toString() : "" + enumItem.getValue();
        String result = String.format("<option value=\"%s\" class=\"textlabel stackedLabel\" " + (selected ? "selected=\"selected\" " : "") + ">%s</option>", value, enumItemDescription);
        if (inQuotes && iterator.hasNext()) {
            jspWriter.write("\'" + result + "\' +");
        } else if (inQuotes) {
            jspWriter.write("\'" + result + "\'");
        } else {
            jspWriter.write(result);
        }
    }
}
Also used : TEnum(org.apache.thrift.TEnum) JspWriter(javax.servlet.jsp.JspWriter)

Example 98 with JspWriter

use of javax.servlet.jsp.JspWriter in project sw360portal by sw360.

the class DisplayComponentChanges method doStartTag.

public int doStartTag() throws JspException {
    JspWriter jspWriter = pageContext.getOut();
    StringBuilder display = new StringBuilder();
    String namespace = getNamespace();
    if (additions == null || deletions == null) {
        return SKIP_BODY;
    }
    try {
        for (Component._Fields field : Component._Fields.values()) {
            switch(field) {
                // ignored Fields
                case ID:
                case REVISION:
                case TYPE:
                case CREATED_BY:
                case CREATED_ON:
                case PERMISSIONS:
                case DOCUMENT_STATE:
                // Releases and aggregates:
                case RELEASES:
                case RELEASE_IDS:
                case MAIN_LICENSE_IDS:
                case LANGUAGES:
                case OPERATING_SYSTEMS:
                case VENDOR_NAMES:
                // Taken care of externally
                case ATTACHMENTS:
                    break;
                default:
                    FieldMetaData fieldMetaData = Component.metaDataMap.get(field);
                    displaySimpleFieldOrSet(display, actual, additions, deletions, field, fieldMetaData, "");
            }
        }
        String renderString = display.toString();
        if (Strings.isNullOrEmpty(renderString)) {
            renderString = "<h4> No changes in basic fields </h4>";
        } else {
            renderString = String.format("<table class=\"%s\" id=\"%schanges\" >", tableClasses, idPrefix) + "<thead><tr><th colspan=\"4\"> Changes for Basic fields</th></tr>" + String.format("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>", FIELD_NAME, CURRENT_VAL, DELETED_VAL, SUGGESTED_VAL) + renderString + "</tbody></table>";
        }
        jspWriter.print(renderString);
    } catch (Exception e) {
        throw new JspException(e);
    }
    return SKIP_BODY;
}
Also used : JspException(javax.servlet.jsp.JspException) FieldMetaData(org.apache.thrift.meta_data.FieldMetaData) JspWriter(javax.servlet.jsp.JspWriter) Component(org.eclipse.sw360.datahandler.thrift.components.Component) JspException(javax.servlet.jsp.JspException) TException(org.apache.thrift.TException)

Example 99 with JspWriter

use of javax.servlet.jsp.JspWriter in project sw360portal by sw360.

the class DisplayVendorEdit method doStartTag.

public int doStartTag() throws JspException {
    JspWriter jspWriter = pageContext.getOut();
    namespace = getNamespace();
    StringBuilder display = new StringBuilder();
    try {
        if (vendor == null && !Strings.isNullOrEmpty(vendorId)) {
            VendorService.Iface client;
            try {
                client = new ThriftClients().makeVendorClient();
                vendor = client.getByID(vendorId);
            } catch (TException ignored) {
            }
        }
        if (vendor != null) {
            printFullVendor(display, vendor);
        } else {
            printEmptyVendor(display);
        }
        jspWriter.print(display.toString());
    } catch (Exception e) {
        throw new JspException(e);
    }
    return SKIP_BODY;
}
Also used : VendorService(org.eclipse.sw360.datahandler.thrift.vendors.VendorService) TException(org.apache.thrift.TException) JspException(javax.servlet.jsp.JspException) JspWriter(javax.servlet.jsp.JspWriter) JspException(javax.servlet.jsp.JspException) TException(org.apache.thrift.TException) ThriftClients(org.eclipse.sw360.datahandler.thrift.ThriftClients)

Example 100 with JspWriter

use of javax.servlet.jsp.JspWriter in project sw360portal by sw360.

the class DisplayEnumInfo method printEnumValuesInfo.

private void printEnumValuesInfo(Class enumClass) throws IOException {
    JspWriter jspWriter = getJspContext().getOut();
    String result = "<span class='" + PortalConstants.TOOLTIP_CLASS__CSS + " " + PortalConstants.TOOLTIP_CLASS__CSS + "-" + enumClass.getSimpleName() + "'>" + "<img class='" + SW360_INFO_IMG + "' src='" + SW360_INFO_IMG_PATH + "'></span>";
    jspWriter.print(result);
}
Also used : JspWriter(javax.servlet.jsp.JspWriter)

Aggregations

JspWriter (javax.servlet.jsp.JspWriter)145 IOException (java.io.IOException)72 JspException (javax.servlet.jsp.JspException)68 HttpServletRequest (javax.servlet.http.HttpServletRequest)17 JspWriteRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.JspWriteRuntimeException)14 PageContext (javax.servlet.jsp.PageContext)13 Iterator (java.util.Iterator)9 Engine (org.apache.wiki.api.core.Engine)9 JspContext (javax.servlet.jsp.JspContext)8 JspTagException (javax.servlet.jsp.JspTagException)8 OuterFormTagMissingRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.OuterFormTagMissingRuntimeException)7 ArrayList (java.util.ArrayList)6 Properties (java.util.Properties)6 HttpSession (javax.servlet.http.HttpSession)5 BodyContent (javax.servlet.jsp.tagext.BodyContent)5 org.apache.ecs.xhtml.select (org.apache.ecs.xhtml.select)5 Page (org.apache.wiki.api.core.Page)5 HtmlCode (org.compiere.util.HtmlCode)5 MissingParametersRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.MissingParametersRuntimeException)5 IPropertyRuleIntrospector (org.jaffa.rules.IPropertyRuleIntrospector)5