NetCharts Pro

netcharts.pro.common
Class NFTextStyle

java.lang.Object
  |
  +--netcharts.pro.common.NFBaseClass
        |
        +--netcharts.pro.common.NFTextStyle
All Implemented Interfaces:
java.lang.Cloneable, NFCDLGenerator
Direct Known Subclasses:
NFLabel, NFModalLabel

public class NFTextStyle
extends NFBaseClass
implements NFCDLGenerator

The NFTextStyle describes how text is to be rendered.


Field Summary
static int CENTER
          CENTER Alignment
static int LEFT
          LEFT Alignment
static int RIGHT
          RIGHT Alignment
 
Constructor Summary
NFTextStyle()
          Constructs a default text style.
NFTextStyle(java.awt.Color color, java.awt.Font font)
          Constructs a text style with the given color and font.
NFTextStyle(java.awt.Color color, java.awt.Font font, int angle, int alignment)
          Constructs a text style with the given color and font.
 
Method Summary
 int getAlignment()
          Gets the text alignment, either CENTER (default), LEFT or RIGHT.
 int getAngle()
          Get the text angle.
 java.lang.String getCDL()
          Generate CDL parameters representing this text style
 void getCDL(java.lang.StringBuffer sb, boolean includeParens)
          Append CDL parameters representing this text style to the given StringBuffer.
 java.awt.Color getColor()
          Get the text color
 java.awt.Font getFont()
          Get the text font
 void setAlignment(int alignment)
          Set the text alignment, either CENTER (default), LEFT or RIGHT.
 void setAngle(int angle)
          Set the text angle.
 void setCDL(java.lang.String cdl)
          Configures this object from a CDL parameter representation.
 void setCDL(java.lang.String[] elements, int offset)
          Configures this object from a CDL parameter representation.
 void setColor(java.awt.Color color)
          Set the text color.
 void setFont(java.awt.Font font)
          Set the text font.
 java.lang.String toString()
          Returns a new String object representing this text style..
 
Methods inherited from class netcharts.pro.common.NFBaseClass
clone, getModified, getUserObject, setModified, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
LEFT Alignment

RIGHT

public static final int RIGHT
RIGHT Alignment

CENTER

public static final int CENTER
CENTER Alignment
Constructor Detail

NFTextStyle

public NFTextStyle()
Constructs a default text style.

NFTextStyle

public NFTextStyle(java.awt.Color color,
                   java.awt.Font font)
Constructs a text style with the given color and font.
Parameters:
color - Color of text.
font - The font the text will be rendered with.

NFTextStyle

public NFTextStyle(java.awt.Color color,
                   java.awt.Font font,
                   int angle,
                   int alignment)
Constructs a text style with the given color and font.
Parameters:
color - Color of text.
font - The font the text will be rendered with.
angle - Font angle
alignment - The text alignment.
Method Detail

getColor

public java.awt.Color getColor()
Get the text color
Returns:
text color or null if not set.

setColor

public void setColor(java.awt.Color color)
Set the text color.
Parameters:
color - Color of text.

getFont

public java.awt.Font getFont()
Get the text font
Returns:
current font or null if not set.

setFont

public void setFont(java.awt.Font font)
Set the text font.
Parameters:
font - The text font.

getAngle

public int getAngle()
Get the text angle.
Returns:
int value between 0-359 degrees or 0 if not set.

setAngle

public void setAngle(int angle)
Set the text angle.
Parameters:
angle - int value between 0-359 degrees. If the value is outside 0 and 359 a warning will be written to the debug object.

setCDL

public void setCDL(java.lang.String cdl)
Configures this object from a CDL parameter representation.
Specified by:
setCDL in interface NFCDLGenerator
Parameters:
cdl - CDL in the form: (textcolor, "fontname", fontsize, angle, alignment)

setCDL

public void setCDL(java.lang.String[] elements,
                   int offset)
Configures this object from a CDL parameter representation.
Parameters:
elements - Array of parameter elements. This array is expected to contain consecutive elements containing color, font, angle and alignment information.
offset - Offset into the elements array.

getCDL

public java.lang.String getCDL()
Generate CDL parameters representing this text style
Specified by:
getCDL in interface NFCDLGenerator
Returns:
CDL in the form: (textcolor, fontname, fontsize, angle, alignment)

toString

public java.lang.String toString()
Returns a new String object representing this text style..
Specified by:
toString in interface NFCDLGenerator
Overrides:
toString in class java.lang.Object
Returns:
A new String object in the same form as that given by getCDL().

getCDL

public void getCDL(java.lang.StringBuffer sb,
                   boolean includeParens)
Append CDL parameters representing this text style to the given StringBuffer.
Parameters:
sb - Target buffer to append the CDL parameters
includeParens - If true, this will cause the parameters to be delimited with parenthesis.

setAlignment

public void setAlignment(int alignment)
Set the text alignment, either CENTER (default), LEFT or RIGHT.

If the value passed is not a valid alignment type, CENTER will be used.

Parameters:
orientation - One of LEFT, RIGHT or CENTER

getAlignment

public int getAlignment()
Gets the text alignment, either CENTER (default), LEFT or RIGHT.
Returns:
axisScaleMode. One of LEFT, RIGHT or CENTER or CENTER if not defined.

NetCharts Pro


Visual Mining, Inc.
15825 Shady Grove Rd.
Suite 20
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2004
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Apr 1, 2004