com.gridsystems.utils.text
Class MaxWidthFormat

java.lang.Object
  extended by java.text.Format
      extended by com.gridsystems.utils.text.MaxWidthFormat
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MaxWidthFormat
extends java.text.Format

Title: General Utilities. Description: Copyright: Copyright (c) 2003 Company: GridSystems

Version:
1.0
Author:
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
java.text.Format.Field
 
Constructor Summary
MaxWidthFormat(int length, java.lang.String align, java.lang.String suffix)
          Creates an instance with the specified MaxWidthFormat.
 
Method Summary
 java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer sb, java.text.FieldPosition fp)
          Tag Format adjust tags to the selected length.
static int getCharacterSizeCount(char character)
          Tells how much space uses a character in an HTML page.
static int mustShort(java.lang.String text, int maxLength)
          Returns the index we have to cut the text.
 java.lang.Object parseObject(java.lang.String s, java.text.ParsePosition parsePosition)
          Function not implemented.
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaxWidthFormat

public MaxWidthFormat(int length,
                      java.lang.String align,
                      java.lang.String suffix)
Creates an instance with the specified MaxWidthFormat.

Parameters:
length - max width length must be greater than three
align - options are "left", "center", "right"
suffix - added at the end of the text longer than 'length'
Method Detail

parseObject

public java.lang.Object parseObject(java.lang.String s,
                                    java.text.ParsePosition parsePosition)
Function not implemented.

Specified by:
parseObject in class java.text.Format
Parameters:
s - String
parsePosition - ParsePosition
Returns:
null always

format

public java.lang.StringBuffer format(java.lang.Object obj,
                                     java.lang.StringBuffer sb,
                                     java.text.FieldPosition fp)
Tag Format adjust tags to the selected length.

Specified by:
format in class java.text.Format
Parameters:
obj - Object
sb - StringBuffer
fp - FieldPosition
Returns:
a StringBuffer

mustShort

public static int mustShort(java.lang.String text,
                            int maxLength)
Returns the index we have to cut the text.

Parameters:
text - the input text
maxLength - the number of chars (uperCase) we can write.
Returns:
the index we have to cut the text

getCharacterSizeCount

public static int getCharacterSizeCount(char character)
Tells how much space uses a character in an HTML page.

Parameters:
character - the character to check.
Returns:
the space used to draw it (1 = minimum space).


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.