List of usage examples for org.apache.commons.lang StringUtils rightPad
public static String rightPad(String str, int size, String padStr)
Right pad a String with a specified String.
From source file:org.kuali.kfs.module.ld.LaborConstants.java
public static String getSpaceAllLaborOriginEntryFields() { List<AttributeDefinition> attributes = SpringContext.getBean(DataDictionaryService.class) .getDataDictionary().getBusinessObjectEntry(LaborOriginEntry.class.getName()).getAttributes(); int totalLength = 0; for (AttributeDefinition attributeDefinition : attributes) { if (!(KFSPropertyConstants.ENTRY_GROUP_ID.equals(attributeDefinition.getName()) || KFSPropertyConstants.ENTRY_ID.equals(attributeDefinition.getName()))) { totalLength += attributeDefinition.getMaxLength(); }//from ww w. j a va 2 s. c o m } return StringUtils.rightPad("", totalLength, ' '); }
From source file:org.kuali.kfs.sys.KFSConstants.java
public static String getDashFinancialObjectCode() { if (DASH_FINANCIAL_OBJECT_CODE == null) { DASH_FINANCIAL_OBJECT_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class) .getAttributeMaxLength(OriginEntryFull.class, KFSPropertyConstants.FINANCIAL_OBJECT_CODE), '-'); }//from w w w . j a v a2 s. co m return DASH_FINANCIAL_OBJECT_CODE; }
From source file:org.kuali.kfs.sys.KFSConstants.java
public static String getDashFinancialSubObjectCode() { if (DASH_FINANCIAL_SUB_OBJECT_CODE == null) { DASH_FINANCIAL_SUB_OBJECT_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(OriginEntryFull.class, KFSPropertyConstants.FINANCIAL_SUB_OBJECT_CODE), '-'); }/* www. ja v a 2 s . c om*/ return DASH_FINANCIAL_SUB_OBJECT_CODE; }
From source file:org.kuali.kfs.sys.KFSConstants.java
public static String getDashSubAccountNumber() { if (DASH_SUB_ACCOUNT_NUMBER == null) { DASH_SUB_ACCOUNT_NUMBER = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class) .getAttributeMaxLength(OriginEntryFull.class, KFSPropertyConstants.SUB_ACCOUNT_NUMBER), '-'); }/*from w ww .j a v a2 s . c om*/ return DASH_SUB_ACCOUNT_NUMBER; }
From source file:org.kuali.kfs.sys.KFSConstants.java
public static String getSpaceSubAccountNumber() { if (SPACE_SUB_ACCOUNT_NUMBER == null) { SPACE_SUB_ACCOUNT_NUMBER = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class) .getAttributeMaxLength(OriginEntryFull.class, KFSPropertyConstants.SUB_ACCOUNT_NUMBER), ' '); }/* w w w. j a v a2 s . com*/ return SPACE_SUB_ACCOUNT_NUMBER; }
From source file:org.kuali.kfs.sys.KFSConstants.java
public static String getDashProjectCode() { if (DASH_PROJECT_CODE == null) { DASH_PROJECT_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class) .getAttributeMaxLength(OriginEntryFull.class, KFSPropertyConstants.PROJECT_CODE), '-'); }/*from w ww . j ava 2 s.c om*/ return DASH_PROJECT_CODE; }
From source file:org.kuali.kfs.sys.report.BusinessObjectReportHelper.java
/** * Returns multiple lines of what represent a table header. The last line in this list is the format of the table cells. * /*from ww w . j a v a 2s. c o m*/ * @param maximumPageWidth maximum before line is out of bounds. Used to fill message to the end of this range. Note that if * there isn't at least maximumPageWidth characters available it will go minimumMessageLength out of bounds. It is up to * the calling class to handle that * @return table header. Last element is the format of the table cells. */ public List<String> getTableHeader(int maximumPageWidth) { String separatorLine = StringUtils.EMPTY; String messageFormat = StringUtils.EMPTY; // Construct the header based on orderedPropertyNameToHeaderLabelMap. It will pick the longest of label or DD size for (Iterator<Map.Entry<String, String>> entries = orderedPropertyNameToHeaderLabelMap.entrySet() .iterator(); entries.hasNext();) { Map.Entry<String, String> entry = entries.next(); int longest; try { longest = retrievePropertyValueMaximumLength(dataDictionaryBusinessObjectClass, entry.getKey()); } catch (Exception e) { throw new RuntimeException("Failed getting propertyName=" + entry.getKey() + " from businessObjecName=" + dataDictionaryBusinessObjectClass.getName(), e); } if (entry.getValue().length() > longest) { longest = entry.getValue().length(); } separatorLine = separatorLine + StringUtils.rightPad("", longest, KFSConstants.DASH) + " "; messageFormat = messageFormat + "%-" + longest + "s "; } // Now fill to the end of pageWidth for the message column. If there is not enough space go out of bounds int availableWidth = maximumPageWidth - (separatorLine.length() + 1); if (availableWidth < minimumMessageLength) { availableWidth = minimumMessageLength; } separatorLine = separatorLine + StringUtils.rightPad("", availableWidth, KFSConstants.DASH); messageFormat = messageFormat + "%-" + availableWidth + "s"; // Fill in the header labels. We use the errorFormat to do this to get justification right List<Object> formatterArgs = new ArrayList<Object>(); formatterArgs.addAll(orderedPropertyNameToHeaderLabelMap.values()); formatterArgs.add(messageLabel); String tableHeaderLine = String.format(messageFormat, formatterArgs.toArray()); // Construct return list List<String> tableHeader = new ArrayList<String>(); tableHeader.add(tableHeaderLine); tableHeader.add(separatorLine); tableHeader.add(messageFormat); return tableHeader; }
From source file:org.kuali.kfs.sys.report.BusinessObjectReportHelper.java
/** * get the separator line/*from ww w . ja va 2s .co m*/ * @param cellWidthList the given cell width list * @return the separator line */ public String getSepartorLine(List<Integer> cellWidthList) { StringBuffer separatorLine = new StringBuffer(); for (int index = 0; index < this.columnCount; index++) { Integer cellWidth = cellWidthList.get(index); separatorLine = separatorLine .append(StringUtils.rightPad(StringUtils.EMPTY, cellWidth, KFSConstants.DASH)).append(" "); } return separatorLine.toString(); }
From source file:org.kuali.ole.gl.GeneralLedgerConstants.java
public static String getSpaceUniversityFiscalPeriodCode() { if (SPACE_UNIVERSITY_FISCAL_PERIOD_CODE == null) { SPACE_UNIVERSITY_FISCAL_PERIOD_CODE = StringUtils .rightPad("", SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength( OriginEntryFull.class, OLEPropertyConstants.UNIVERSITY_FISCAL_PERIOD_CODE), ' '); }// w ww .ja v a2 s. co m return SPACE_UNIVERSITY_FISCAL_PERIOD_CODE; }
From source file:org.kuali.ole.gl.GeneralLedgerConstants.java
public static String getSpaceBalanceTypeCode() { if (SPACE_BALANCE_TYPE_CODE == null) { SPACE_BALANCE_TYPE_CODE = StringUtils.rightPad("", SpringContext.getBean(DataDictionaryService.class) .getAttributeMaxLength(BalanceType.class, OLEPropertyConstants.CODE), ' '); }//ww w .j a va2s . c o m return SPACE_BALANCE_TYPE_CODE; }