SWT LPEX
v3.0.5

com.ibm.lpex.hlasm
Class ColorDefinition

java.lang.Object
  extended bycom.ibm.lpex.hlasm.ColorDefinition

public final class ColorDefinition
extends Object

This class is used to associate a name with two RGB values. The name is used to identify a color, and the RGB values are foreground and background RGB values for the color. The color definitions are used to color HLASM instructions with user-defined colors.


Constructor Summary
ColorDefinition()
          Default constructor.
ColorDefinition(char color_code, String name, String foreground, String background, String foreground_RGB, String background_RGB)
          Constructor.
 
Method Summary
 int getBackgroundBlue()
          Retrieve the blue component of the background color.
 int getBackgroundGreen()
          Retrieve the green component of the background color.
 int getBackgroundRed()
          Retrieve the red component of the background color.
 char getColorCode()
          Get the color code.
 int getForegroundBlue()
          Retrieve the blue component of the foreground color.
 int getForegroundGreen()
          Retrieve the green component of the foreground color.
 int getForegroundRed()
          Retrieve the red component of the foreground color.
 String getName()
          Get the color name.
 String getRGBString()
          Return the six RBG values for this color.
 boolean setBackground(String background)
          Set the background.
 void setBackgroundRGB(int red, int green, int blue)
          Set the highlight color.
 boolean setForeground(String foreground)
          Set the foreground.
 void setForegroundRGB(int red, int green, int blue)
          Set the text color.
 void setName(String name)
          Set the color name.
 StringBuffer toXMLString()
          Return an XML-tagged string for this color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorDefinition

public ColorDefinition()
Default constructor. Constructs a color with no style character (a space), no name, and default foreground and background colors (black and white).


ColorDefinition

public ColorDefinition(char color_code,
                       String name,
                       String foreground,
                       String background,
                       String foreground_RGB,
                       String background_RGB)
Constructor.

Parameters:
color_code - a style character that can be used by LPEX for this color. The character should be one that is not in use by the document parser or reserved by LPEX
name - a name that will be used to uniquely identify the color
foreground - the color to be used for the text. Optional (null or empty string for none). If given, the string should be a number between 1 and 16 inclusive. The numbers corespond to pre-defined colors as follows: If not specified, a foreground_RGB should be provided
background - specifies the color to be used to highlight the text. Optional (null or empty string for none). If given, the string should be a number between 1 and 16 inclusive. The numbers corespond to the pre-defined colors mentioned above. If not specified, a background_RGB should be provided
foreground_RGB - the color to be used to color the text. This will overide a foreground value. The foreground color can be in any of 3 forms:
background_RGB - the color to be used to highlight the text. This will overide the background value. The background color can be in any of the three forms that can be used for foreground_RGB
Method Detail

getName

public String getName()
Get the color name.

Returns:
the name of the color

setName

public void setName(String name)
Set the color name.

Parameters:
name - the name to set

getForegroundRed

public int getForegroundRed()
Retrieve the red component of the foreground color.

Returns:
a number between 0 and 255 inclusive

getForegroundGreen

public int getForegroundGreen()
Retrieve the green component of the foreground color.

Returns:
a number between 0 and 255 inclusive

getForegroundBlue

public int getForegroundBlue()
Retrieve the blue component of the foreground color.

Returns:
a number between 0 and 255 inclusive

setForeground

public boolean setForeground(String foreground)
Set the foreground.

Parameters:
foreground - the foreground color, specified in any of 3 forms:
  • number between 1 - 16, for the corresponding preset LPEX color to be used;
  • HEX RGB (e.g., "FF00CC");
  • RGB value (e.g., "123,123,99"), with commas separating the numbers.
Returns:
true = the specified color was set; or false = incorrect color given, value is unchanged

getBackgroundRed

public int getBackgroundRed()
Retrieve the red component of the background color.

Returns:
a number between 0 and 255 inclusive

getBackgroundGreen

public int getBackgroundGreen()
Retrieve the green component of the background color.

Returns:
a number between 0 and 255 inclusive

getBackgroundBlue

public int getBackgroundBlue()
Retrieve the blue component of the background color.

Returns:
a number between 0 and 255 inclusive

setBackground

public boolean setBackground(String background)
Set the background.

Parameters:
background - the background color, specified in any of 3 forms:
  • number between 1 - 16, for the corresponding preset LPEX color to be used;
  • HEX RGB (e.g., "FF00CC");
  • RGB value (e.g., "123,123,99"), with commas separating the numbers.
Returns:
true = the specified color was set; or false = incorrect color given, value is unchanged

getColorCode

public char getColorCode()
Get the color code.

Returns:
the style character used to represent this color in LPEX

getRGBString

public String getRGBString()
Return the six RBG values for this color.

Returns:
a string of the form f_red f_green f_blue b_red b_green b_blue e.g., "255 128 0 222 111 123"

setForegroundRGB

public void setForegroundRGB(int red,
                             int green,
                             int blue)
Set the text color.

Parameters:
red - value between 0 and 255 inclusive
green - value between 0 and 255 inclusive
blue - value between 0 and 255 inclusive

setBackgroundRGB

public void setBackgroundRGB(int red,
                             int green,
                             int blue)
Set the highlight color.

Parameters:
red - value between 0 and 255 inclusive
green - value between 0 and 255 inclusive
blue - value between 0 and 255 inclusive

toXMLString

public StringBuffer toXMLString()
Return an XML-tagged string for this color.

Returns:
the xml definition for the "color" element: color name, foreground RGB values, background RGB values

SWT LPEX
v3.0.5

(C) Copyright IBM Corporation 1998, 2005.  All Rights Reserved.