NetCharts Pro

netcharts.pro.common
Class NFTextStyle

java.lang.Object
  extended by netcharts.pro.common.NFBaseClass
      extended by 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 LINETHROUGH_DECORATION
          Line through decoration.
static int NO_ASCENT
          No ascent.
static int NO_DECORATION
          No decoration.
static int NO_DESCENT
          No descent.
static int NO_LEADING
          No leading.
static int NO_MAXLINEADVANCE
          No maxlineadvance.
static int OVERLINE_DECORATION
          Overline decoration.
static int RIGHT
          RIGHT Alignment
static int UNDERLINE_DECORATION
          Underline decoration.
 
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.
NFTextStyle(java.awt.Color color, java.awt.Font font, int angle, int alignment, int decoration)
          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.
 int getAscent()
          Gets the override of the font ascent.
 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.
 void getCDL(java.lang.StringBuffer sb, boolean includeParens, boolean includeAllCommas)
           
 java.awt.Color getColor()
          Get the text color
 int getDecoration()
          Gets the text decoration.
 int getDescent()
          Gets the override of the font descent.
 java.awt.Font getFont()
          Get the text font
 int getLeading()
          Gets the override of the font leading.
 int getMaxLineAdvance()
          Gets the max line advance.
 void setAlignment(int alignment)
          Set the text alignment, either CENTER (default), LEFT or RIGHT.
 void setAngle(int angle)
          Set the text angle.
 void setAscent(int ascent)
          Set the override of the font ascent.
 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 setDecoration(int decoration)
          Set the text decoration.
 void setDescent(int descent)
          Set the override of the font descent.
 void setFont(java.awt.Font font)
          Set the text font.
 void setLeading(int leading)
          Set the override of the font leading.
 void setMaxLineAdvance(int maxLineAdvance)
          Set the max line advance.
 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

NO_ASCENT

public static final int NO_ASCENT
No ascent.


NO_DESCENT

public static final int NO_DESCENT
No descent.


NO_LEADING

public static final int NO_LEADING
No leading.


NO_MAXLINEADVANCE

public static final int NO_MAXLINEADVANCE
No maxlineadvance.


NO_DECORATION

public static final int NO_DECORATION
No decoration.


UNDERLINE_DECORATION

public static final int UNDERLINE_DECORATION
Underline decoration.


OVERLINE_DECORATION

public static final int OVERLINE_DECORATION
Overline decoration.


LINETHROUGH_DECORATION

public static final int LINETHROUGH_DECORATION
Line through decoration.


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.

NFTextStyle

public NFTextStyle(java.awt.Color color,
                   java.awt.Font font,
                   int angle,
                   int alignment,
                   int decoration)
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.
decoration - The text decoration.
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.

getCDL

public void getCDL(java.lang.StringBuffer sb,
                   boolean includeParens,
                   boolean includeAllCommas)

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:
alignment - One of LEFT, RIGHT or CENTER

getAlignment

public int getAlignment()
Gets the text alignment, either CENTER (default), LEFT or RIGHT.

Returns:
One of LEFT, RIGHT or CENTER or CENTER if not defined.

setDecoration

public void setDecoration(int decoration)
Set the text decoration. Valid values are either NO_DECORATION or a value built by bitwise OR'ing together (that is, using the int "|" operator) two or more of the UNDERLINE_DECORATION, OVERLINE_DECORATION and LINETHROUGH_DECORATION constants.

Parameters:
decoration - The text decoration value

getDecoration

public int getDecoration()
Gets the text decoration. The value returned is either NO_DECORATION or a value built by bitwise OR'ing together two or more of the UNDERLINE_DECORATION, OVERLINE_DECORATION and LINETHROUGH_DECORATION constants.

Returns:
The text decoration.

setAscent

public void setAscent(int ascent)
Set the override of the font ascent.

Parameters:
ascent - The ascent.

getAscent

public int getAscent()
Gets the override of the font ascent.

Returns:
The ascent.

setDescent

public void setDescent(int descent)
Set the override of the font descent.

Parameters:
descent - The descent.

getDescent

public int getDescent()
Gets the override of the font descent.

Returns:
The descent.

setLeading

public void setLeading(int leading)
Set the override of the font leading.

Parameters:
leading - The leading.

getLeading

public int getLeading()
Gets the override of the font leading.

Returns:
The leading.

setMaxLineAdvance

public void setMaxLineAdvance(int maxLineAdvance)
Set the max line advance.

Parameters:
maxLineAdvance - The max line advance.

getMaxLineAdvance

public int getMaxLineAdvance()
Gets the max line advance.

Returns:
The max line advance.

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
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: Jun 28, 2011