planetj.formatters
Class StringFormatter

java.lang.Object
  extended byplanetj.formatters.AbstractFormatter
      extended byplanetj.formatters.StringFormatter
All Implemented Interfaces:
IFormatter

public class StringFormatter
extends AbstractFormatter

Provide static methods to position or center a String within a given width. Creation date: (4/22/2002 2:56:09 PM)


Constructor Summary
StringFormatter()
           
 
Method Summary
static java.lang.String center(java.lang.String s, int width)
          Place spaces around s to center it within width characters.
 java.lang.String formatValue(java.lang.Object value, Field f)
          Formats a value for display.
static java.lang.String leftAdjust(java.lang.String s, int width)
          Pad out s with spaces after it.
static java.lang.String rightAdjust(java.lang.String pString, int pWidth)
          Pad out s with spaces before it.
static java.lang.String spaceApartStrings(java.lang.String pLeftString, java.lang.String pRightString, int pTotalWidth)
          Inserts spaces between two Strings until the Stirng.length() = pWidth Creation date: Jun 11, 2004 11:54:59 AM
 
Methods inherited from class planetj.formatters.AbstractFormatter
isPrepareFieldValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringFormatter

public StringFormatter()
Method Detail

center

public static java.lang.String center(java.lang.String s,
                                      int width)
Place spaces around s to center it within width characters. Creation date: (4/22/2002 2:56:36 PM)


formatValue

public java.lang.String formatValue(java.lang.Object value,
                                    Field f)
Description copied from interface: IFormatter
Formats a value for display. This method is only used when formating a read-only display value

Parameters:
value - The value to format
f - The field whose value is being formatted
Returns:
The formatted display value of the value

leftAdjust

public static java.lang.String leftAdjust(java.lang.String s,
                                          int width)
Pad out s with spaces after it. Creation date: (4/22/2002 2:57:02 PM)


rightAdjust

public static java.lang.String rightAdjust(java.lang.String pString,
                                           int pWidth)
Pad out s with spaces before it. Creation date: (4/22/2002 2:57:28 PM)


spaceApartStrings

public static java.lang.String spaceApartStrings(java.lang.String pLeftString,
                                                 java.lang.String pRightString,
                                                 int pTotalWidth)
Inserts spaces between two Strings until the Stirng.length() = pWidth Creation date: Jun 11, 2004 11:54:59 AM