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;
}
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);
}
}
}
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;
}
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;
}
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);
}
Aggregations