JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d
Class JCMultiFieldString

java.lang.Object
  |
  +--com.klg.jclass.chart3d.JCMultiFieldString
All Implemented Interfaces:
Serializable

public class JCMultiFieldString
extends Object
implements Serializable

Encapsulates the notion of a multi-field String, where each field may have a different alignment of text within its field. Used by the JCChart3dLegend class to manage specialized legend text.

See Also:
Serialized Form

Field Summary
static Integer CENTER_ALIGNMENT
           
protected  Vector contentList
           
static Integer LEFT_ALIGNMENT
           
static Integer RIGHT_ALIGNMENT
           
 
Constructor Summary
JCMultiFieldString()
          Empty constructor.
JCMultiFieldString(String inputString)
          Constructor with input String.
 
Method Summary
 void draw(Graphics gc, Font useFont, int x, int y, int[] maxFieldWidths, int fieldGap)
          Draws the multi-field String.
 List getContentList()
          Gets the multi field String as a list of alignment items and Strings.
 Vector parseEncodedString(String inputString)
          Parses a String encoded in the JCMultiFieldString format into a series of field alignment attributes and field Strings.
 void setContents(String inputString)
          Sets the contents of the multi field String.
 String toString()
          Converts this object back to a String representation of its contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT_ALIGNMENT

public static final Integer LEFT_ALIGNMENT

CENTER_ALIGNMENT

public static final Integer CENTER_ALIGNMENT

RIGHT_ALIGNMENT

public static final Integer RIGHT_ALIGNMENT

contentList

protected Vector contentList
Constructor Detail

JCMultiFieldString

public JCMultiFieldString()
Empty constructor.


JCMultiFieldString

public JCMultiFieldString(String inputString)
Constructor with input String. The input String is parsed to see if it contains any field alignment codes (\c for center alignment, \r for right alignment, and \l for left alignment).

Parameters:
inputString - the input String
Method Detail

setContents

public void setContents(String inputString)
Sets the contents of the multi field String. The input String is parsed to see if it contains any field alignment codes (\c for center alignment, \r for right alignment, and \l for left alignment).

Parameters:
inputString - the input String

getContentList

public List getContentList()
Gets the multi field String as a list of alignment items and Strings. (Each field should be represented in the list as one alignment item and one String.)


parseEncodedString

public Vector parseEncodedString(String inputString)
Parses a String encoded in the JCMultiFieldString format into a series of field alignment attributes and field Strings.

Parameters:
inputString - the String to parse
Returns:
a Vector of Strings and field alignment items (RIGHT_ALIGNMENT, LEFT_ALIGNMENT, or CENTER_ALIGNMENT)

draw

public void draw(Graphics gc,
                 Font useFont,
                 int x,
                 int y,
                 int[] maxFieldWidths,
                 int fieldGap)
Draws the multi-field String.

Parameters:
gc - the Graphics object to write the String to
useFont - the font to write the String with
x - the x position to write the String at
y - the y position to write the String at
maxFieldWidths - an array of maximum field widths that is used to justify the text in each field
fieldGap - the spacing between fields

toString

public String toString()
Converts this object back to a String representation of its contents.

Overrides:
toString in class Object

Copyright © 2004 Quest Software Inc..
All rights reserved.