Changeset 8808


Ignore:
Timestamp:
2004-12-14T17:15:01+13:00 (19 years ago)
Author:
mdewsnip
Message:

Removed the full justification by adding spaces of plugin and classifier option descriptions. This is no longer useful now that a non-fixed width font is used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r8802 r8808  
    263263            // If adding the next token would push us over the maximum line width.
    264264            else if(current_width + 1 + token.length() > width) {
    265             line = space(line, width, current_width);
    266265            lines.push(line);
    267266            line = token;
     
    944943
    945944
    946     /** Method to spread out a line of text so that is is justified to the given width, by attempting to widen white-spacing in a balanced way.
    947      * @param original The <strong>String</strong> to justify.
    948      * @param width The desired width as an <i>int</i>.
    949      * @param current_width An <i>int</i> representing the current width of the string, which takes into account special characters.
    950      * @return The newly justified <strong>String</strong>.
    951      */
    952     static private String space(String original, int width, int current_width) {
    953     // Strip trailing whitespace.
    954     while(original.charAt(original.length() - 1) == ' ') {
    955         original = original.substring(0, original.length() - 2);
    956     }
    957     int diff = width - current_width;
    958     // Now add diff spaces, one at each existing space.
    959     int pos = 0;
    960     while(diff > 0) {
    961         if(pos == original.length()) {
    962         pos = 0;
    963         }
    964         if(original.charAt(pos) == ' ') {
    965         // Insert a space.
    966         String prefix = original.substring(0, pos);
    967         String suffix = original.substring(pos);
    968         original = prefix + " " + suffix;
    969         pos = pos + 2;
    970         diff--;
    971         }
    972         pos++;
    973     }
    974     return original;
    975     }
    976 
    977 
    978945    /** I think this works a bit better on Unicode strings. */
    979946    static public String stripNL(String raw_string)
Note: See TracChangeset for help on using the changeset viewer.