LPEX
4.4.0

com.ibm.lpex.core
Class LpexPaletteAttributes

java.lang.Object
  extended by com.ibm.lpex.core.LpexPaletteAttributes

public final class LpexPaletteAttributes
extends Object

This class provides a mechanism for converting style attributes to a specified palette.


Method Summary
static String background(LpexView lpexView)
          Use this method to determine the background color of the default style (parameter styleAttributes.default) that is used by the specified document view.
static String convert(String styleAttributesString, String fromBackground, String toBackground)
          Use this method to convert a style attributes string from one background color to another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

background

public static String background(LpexView lpexView)
Use this method to determine the background color of the default style (parameter styleAttributes.default) that is used by the specified document view. The color is returned as a string of three integers representing the red, green, and blue components of the background color.


convert

public static String convert(String styleAttributesString,
                             String fromBackground,
                             String toBackground)
Use this method to convert a style attributes string from one background color to another.

As an example, below is how the style character for comments ('c') is defined in the Java document parser, in order to ensure correct colors for the active palette. The parser uses the common ATTRIBUTES_COMMENT style attributes, which are defined for BACKGROUND_COLOR (white), first converted to the currently active palette.

 
 // get the background color of view's active palette
 String toBackground = LpexPaletteAttributes.background(view);
 // convert style attributes from definition background to the active one 
 String attributes = LpexPaletteAttributes.convert(ATTRIBUTES_COMMENT,
                                                   BACKGROUND_COLOR,
                                                   toBackground);
 // define the style character
 setStyle("c", attributes); 

See Also:
LpexCommonParser.setStyle(java.lang.String, java.lang.String)

LPEX
4.4.0

Copyright � 2016 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.