com.objectxp.msg.ems
Class EMSTextFormat

java.lang.Object
  extended bycom.objectxp.msg.ems.EMSTextFormat
All Implemented Interfaces:
java.io.Serializable

public class EMSTextFormat
extends java.lang.Object
implements java.io.Serializable

This class represents a EMS Text Format. The format can be applied to a EMS text element.

Example:

 EMSMessage msg = new EMSMessage(service);
 EMSTextFormat fmt = new EMSTextFormat();
 fmt.setSize(EMSTextFormat.SIZE_LARGE);
 fmt.setBold(true);
 fmt.setColor(EMSTextFormat.BLUE, EMSTextFormat.YELLOW);   
 EMSText txt = new EMSText("Large bold blue text on yellow background", fmt);
 msg.add(txt);
 

Since:
jSMS 1.7
See Also:
EMSText, EMSMessage, Serialized Form

Field Summary
static int ALIGN_CENTER
          Align centered
static int ALIGN_DEFAULT
           
static int ALIGN_LEFT
          Align left
static int ALIGN_RIGHT
          Align right
static int BLACK
           
static int BLUE
           
static EMSTextFormat BOLD
          Predefined Format: Bold text.
static int CYAN
           
static int DARK_BLUE
           
static int DARK_CYAN
           
static int DARK_GREEN
           
static int DARK_GREY
           
static int DARK_MAGENTA
           
static int DARK_RED
           
static int DARK_YELLOW
           
static int GREEN
           
static int GREY
           
static EMSTextFormat ITALIC
          Predefined Format: Italic text.
static EMSTextFormat LARGE
          Predefined Format: Large text size.
static int MAGENTA
           
static EMSTextFormat NORMAL
          Predefined Format: Normal text size.
static int RED
           
static int SIZE_LARGE
          Font size large
static int SIZE_NORMAL
          Font size normal
static int SIZE_SMALL
          Font size small
static EMSTextFormat SMALL
          Predefined Format: Small text size.
static EMSTextFormat UNDERLINE
          Predefined Format: underlined text.
static int WHITE
           
static int YELLOW
           
 
Constructor Summary
EMSTextFormat()
          Construct a new EMSTextFormat object.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getAlignment()
           
 int getBgColor()
          Returns the background color.
 boolean getBold()
           
 int getFgColor()
          Returns the foreground color.
 boolean getItalic()
           
 int getSize()
           
 boolean getStrikethrough()
           
 boolean getUnderline()
           
 EMSTextFormat setAlignment(int alignment)
          Set the alignment of the EMS text.
 EMSTextFormat setBold(boolean state)
          set the font face
 EMSTextFormat setColor(int fg, int bg)
          Set the foreground and background text color.
 EMSTextFormat setItalic(boolean state)
          set the font type
 EMSTextFormat setSize(int size)
          Set the font size.
 EMSTextFormat setStrikethrough(boolean state)
           
 EMSTextFormat setUnderline(boolean state)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALIGN_LEFT

public static final int ALIGN_LEFT
Align left

See Also:
Constant Field Values

ALIGN_CENTER

public static final int ALIGN_CENTER
Align centered

See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
Align right

See Also:
Constant Field Values

ALIGN_DEFAULT

public static final int ALIGN_DEFAULT
See Also:
Constant Field Values

SIZE_NORMAL

public static final int SIZE_NORMAL
Font size normal

See Also:
Constant Field Values

SIZE_LARGE

public static final int SIZE_LARGE
Font size large

See Also:
Constant Field Values

SIZE_SMALL

public static final int SIZE_SMALL
Font size small

See Also:
Constant Field Values

BLACK

public static final int BLACK
See Also:
Constant Field Values

DARK_GREY

public static final int DARK_GREY
See Also:
Constant Field Values

DARK_RED

public static final int DARK_RED
See Also:
Constant Field Values

DARK_YELLOW

public static final int DARK_YELLOW
See Also:
Constant Field Values

DARK_GREEN

public static final int DARK_GREEN
See Also:
Constant Field Values

DARK_CYAN

public static final int DARK_CYAN
See Also:
Constant Field Values

DARK_BLUE

public static final int DARK_BLUE
See Also:
Constant Field Values

DARK_MAGENTA

public static final int DARK_MAGENTA
See Also:
Constant Field Values

GREY

public static final int GREY
See Also:
Constant Field Values

WHITE

public static final int WHITE
See Also:
Constant Field Values

RED

public static final int RED
See Also:
Constant Field Values

YELLOW

public static final int YELLOW
See Also:
Constant Field Values

GREEN

public static final int GREEN
See Also:
Constant Field Values

CYAN

public static final int CYAN
See Also:
Constant Field Values

BLUE

public static final int BLUE
See Also:
Constant Field Values

MAGENTA

public static final int MAGENTA
See Also:
Constant Field Values

NORMAL

public static final EMSTextFormat NORMAL
Predefined Format: Normal text size.


LARGE

public static final EMSTextFormat LARGE
Predefined Format: Large text size.


SMALL

public static final EMSTextFormat SMALL
Predefined Format: Small text size.


BOLD

public static final EMSTextFormat BOLD
Predefined Format: Bold text.


ITALIC

public static final EMSTextFormat ITALIC
Predefined Format: Italic text.


UNDERLINE

public static final EMSTextFormat UNDERLINE
Predefined Format: underlined text.

Constructor Detail

EMSTextFormat

public EMSTextFormat()
Construct a new EMSTextFormat object.

Method Detail

setAlignment

public EMSTextFormat setAlignment(int alignment)
Set the alignment of the EMS text.

Parameters:
alignment - the desired alignment (ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT.

getAlignment

public int getAlignment()

setSize

public EMSTextFormat setSize(int size)
Set the font size.

Parameters:
size - the desired size (SIZE_NORMAL, SIZE_LARGE, SIZE_SMALL.

getSize

public int getSize()
Returns:
the size (SIZE_NORMAL, SIZE_LARGE, SIZE_SMALL)

setBold

public EMSTextFormat setBold(boolean state)
set the font face

Parameters:
state - (true = bold, false = normal)

getBold

public boolean getBold()
Returns:
the font face

setItalic

public EMSTextFormat setItalic(boolean state)
set the font type


getItalic

public boolean getItalic()
Returns:
the font type

setUnderline

public EMSTextFormat setUnderline(boolean state)

getUnderline

public boolean getUnderline()

setStrikethrough

public EMSTextFormat setStrikethrough(boolean state)

getStrikethrough

public boolean getStrikethrough()

setColor

public EMSTextFormat setColor(int fg,
                              int bg)
Set the foreground and background text color. Use the color constants (e.g. BLUE) to specify the colors.

Parameters:
fg - the foreground color
bg - the background color

getFgColor

public int getFgColor()
Returns the foreground color.


getBgColor

public int getBgColor()
Returns the background color.


equals

public boolean equals(java.lang.Object obj)

toString

public java.lang.String toString()


object XP, Inc. © 2000-2007. All rights reserved object XP