use of edu.cornell.kfs.sys.businessobject.options.FavoriteAccountValuesFinder in project cu-kfs by CU-CommunityApps.
the class GroupTitleLineRenderer method render.
/**
* @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 {
try {
// KFSPTS-985 : add favorite account selection
// setdistribution does not have accountPrefix
String accountPrefix = (String) pageContext.getAttribute("accountPrefix");
FavoriteAccountValuesFinder accounts = new FavoriteAccountValuesFinder();
if (canEdit && isDocumentIntegratedFavoriteAccount() && CollectionUtils.isNotEmpty(accounts.getKeyValues()) && accounts.getKeyValues().size() > 1) {
pageContext.getOut().write(buildFavoriteAccounts(accountPrefix));
}
String rowClass = null;
if (lineCollectionProperty.equals(KFSConstants.ACCOUNT_DISTRIBUTION_SRC_LINES)) {
rowClass = "distribution";
}
pageContext.getOut().write(buildRowBeginning(rowClass));
pageContext.getOut().write(buildBlankCell());
pageContext.getOut().write(buildTitleCell());
this.renderGroupLevelActions(pageContext, parentTag);
pageContext.getOut().write(buildRowEnding());
} catch (IOException ioe) {
throw new JspException("Difficulty in rendering import/group header line", ioe);
}
}
use of edu.cornell.kfs.sys.businessobject.options.FavoriteAccountValuesFinder in project cu-kfs by CU-CommunityApps.
the class GroupTitleLineRenderer method buildFavoriteAccounts.
private String buildFavoriteAccounts(String accountPrefix) {
int itemIdx = getItemIdx(accountPrefix);
Integer accountLineId = null;
if (isDocumentIntegratedFavoriteAccount()) {
if (itemIdx >= 0) {
accountLineId = ((PurchasingItemBase) ((PurchasingDocumentBase) this.getAccountingDocument()).getItem(itemIdx)).getFavoriteAccountLineIdentifier();
} else {
accountLineId = ((PurchasingDocumentBase) this.getAccountingDocument()).getFavoriteAccountLineIdentifier();
}
}
StringBuffer favoriteAccountLine = new StringBuffer();
favoriteAccountLine.append("<tr>");
favoriteAccountLine.append("<th colspan=\"2\" align=\"right\" valign=\"middle\" class=\"bord-l-b\">");
favoriteAccountLine.append("<div align=\"right\">");
favoriteAccountLine.append("Favorite Account");
favoriteAccountLine.append("</div>");
favoriteAccountLine.append("</th>");
if (StringUtils.isBlank(accountPrefix)) {
accountPrefix = "document.";
}
favoriteAccountLine.append("<td colspan=\"7\" class=\"infoline\">");
favoriteAccountLine.append("<select name=\"").append(accountPrefix).append("favoriteAccountLineIdentifier\" id=\"").append(accountPrefix).append("favoriteAccountLineIdentifier\" title=\"* Favorite Account\">");
FavoriteAccountValuesFinder accounts = new FavoriteAccountValuesFinder();
for (KeyValue keyValue : (List<KeyValue>) accounts.getKeyValues()) {
favoriteAccountLine.append("<option value=\"").append(keyValue.getKey());
if (checkToAddError(accountPrefix + "favoriteAccountLineIdentifier")) {
favoriteAccountLine.append(getSelected(accountLineId, keyValue.getKey()));
} else {
favoriteAccountLine.append("\" >");
}
favoriteAccountLine.append(keyValue.getValue());
favoriteAccountLine.append("</option>\n");
}
favoriteAccountLine.append("</select>");
if (checkToAddError(accountPrefix + "favoriteAccountLineIdentifier")) {
favoriteAccountLine.append(getErrorIconImageTag());
}
favoriteAccountLine.append("</td>");
favoriteAccountLine.append("<td valign=\"top\" class=\"infoline\">");
favoriteAccountLine.append("<div style=\"text-align: center;\">");
favoriteAccountLine.append("<input type=\"image\" name=\"methodToCall.addFavoriteAccount.line").append(itemIdx).append(".anchorFavoriteAnchor\" src=\"kr/static/images/tinybutton-add1.gif\" tabindex=\"0\" class=\"tinybutton\"");
favoriteAccountLine.append(" title=\"Add Favorite Accounting Line\" alt=\"Add Favorite Accounting Line\">");
favoriteAccountLine.append("</input>");
favoriteAccountLine.append("<br></div></td>");
favoriteAccountLine.append("</tr>");
return favoriteAccountLine.toString();
}
Aggregations