Example usage for org.apache.commons.lang.text StrBuilder appendFixedWidthPadRight

List of usage examples for org.apache.commons.lang.text StrBuilder appendFixedWidthPadRight

Introduction

In this page you can find the example usage for org.apache.commons.lang.text StrBuilder appendFixedWidthPadRight.

Prototype

public StrBuilder appendFixedWidthPadRight(int value, int width, char padChar) 

Source Link

Document

Appends an object to the builder padding on the right to a fixed length.

Usage

From source file:com.archivas.clienttools.arcmover.cli.ArcJobMgr.java

private String createJobListing() throws DatabaseException {
    StrBuilder sb = new StrBuilder();
    List<ManagedJobSummary> jobsList = ArcMoverFactory.getInstance().getAllManagedJobs();

    Map<String, Integer> columnWidths = calcColumnWidths(jobsList);

    for (Map.Entry<String, Integer> entry : columnWidths.entrySet()) {
        sb.appendFixedWidthPadRight(entry.getKey(), entry.getValue(), ' ').append(COL_SEP);
    }//from  w w  w. jav  a2 s  .c o m
    sb.append(NEWLINE);

    for (ManagedJobSummary job : jobsList) {
        sb.appendFixedWidthPadRight(getValue(job, JOB_NAME_LABEL), columnWidths.get(JOB_NAME_LABEL), ' ')
                .append(COL_SEP);
        sb.appendFixedWidthPadRight(getValue(job, JOB_TYPE_LABEL), columnWidths.get(JOB_TYPE_LABEL), ' ')
                .append(COL_SEP);
        sb.appendFixedWidthPadRight(getValue(job, JOB_STATE_LABEL), columnWidths.get(JOB_STATE_LABEL), ' ')
                .append(COL_SEP);

        sb.append(NEWLINE);
    }

    return sb.toString();

}

From source file:com.archivas.clienttools.arcmover.cli.ArcProfileMgr.java

/**
 * Create the Profile listing output/*from w  w  w .j av  a 2 s  .c  o m*/
 */
protected String createProfileListing() {
    StrBuilder sb = new StrBuilder();
    List<AbstractProfileBase> profileList = getProfiles();

    columnWidths = calcColumnWidths(profileList);

    for (Map.Entry<String, Integer> entry : columnWidths.entrySet()) {
        sb.appendFixedWidthPadRight(entry.getKey(), entry.getValue(), ' ').append(COL_SEP);
    }
    sb.append(NEWLINE);

    for (AbstractProfileBase profile : profileList) {
        sb.appendFixedWidthPadRight("" + profile.getName(), columnWidths.get(KEY_PROFILE_NAME), ' ')
                .append(COL_SEP);
        sb.appendFixedWidthPadRight("" + profile.getType(), columnWidths.get(KEY_TYPE), ' ').append(COL_SEP);
        sb.append(NEWLINE);
    }

    return sb.toString();
}