LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.misc
Class LyColors

java.lang.Object
  extended by leon.misc.LyResourceBundle
      extended by leon.misc.LyColors

public class LyColors
extends LyResourceBundle

This class is used to manage color resources of an application. For each instance a mapping is done between color key and color name (e.g. LY_MENU_COLOR and Gray75) using the LyResourceBundle mechanism. A static Hashtable of color codes is kept in memory: the table contains color name as a key and the RGB components of the color (eg Gray75 and 191 191 191).


Field Summary
static java.lang.String __VERSION
           
static java.lang.String COLOR_CODES_FILE
          Default color codes file.
static java.lang.String DEFAULT_COLOR
          Default color key.
static java.lang.String SYSTEM_COLOR
          System color key.
 
Fields inherited from class leon.misc.LyResourceBundle
PACKAGE_DIR, PROPERTIES_DIR, UPPER_CASE_KEYS_ONLY
 
Constructor Summary
LyColors(LyEnvironment environment)
          Constructor with a given environment.
LyColors(LyEnvironment environment, java.lang.String name)
          Constructor with a given environment and name.
LyColors(LyEnvironment environment, java.lang.String name, java.lang.String skin)
          Constructor with a given environment and name.
 
Method Summary
static LyColor getBarycentricColor(LyColor minColor, LyColor maxColor, float ratio)
          Gets theColor computed with two colors and a ratio.
 LyColor getColor(java.lang.String key)
          Gets the color corresponding to the given key.
 java.util.Vector<java.lang.String> getColorCodes()
          Gets the list of color keys of the color_codes properties file.
static LyColor getColorFromHexString(java.lang.String hexColor)
          Gets the Color representation of the given hexedecimal color code.
static java.lang.String getHexString(int r, int g, int b)
          Gets the hexadecimal string representation of the given RGB components.
static java.lang.String getHexString(LyColor color)
          Gets the hexadecimal string representation of the given color.
 
Methods inherited from class leon.misc.LyResourceBundle
checkKey, clearCache, free, get, getKeyList, getKeys, getSonEnvironments, hasKey, put, remove, removeBundles, saveTo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

SYSTEM_COLOR

public static final java.lang.String SYSTEM_COLOR
System color key.

See Also:
Constant Field Values

DEFAULT_COLOR

public static java.lang.String DEFAULT_COLOR
Default color key.


COLOR_CODES_FILE

public static java.lang.String COLOR_CODES_FILE
Default color codes file.

Constructor Detail

LyColors

public LyColors(LyEnvironment environment)
Constructor with a given environment.

Parameters:
environment - The environment of the colors bundle.

LyColors

public LyColors(LyEnvironment environment,
                java.lang.String name)
Constructor with a given environment and name.

Parameters:
environment - The environment of the colors bundle.
name - The name of the colors bundle.

LyColors

public LyColors(LyEnvironment environment,
                java.lang.String name,
                java.lang.String skin)
Constructor with a given environment and name.

Parameters:
environment - The environment of the colors bundle.
name - The name of the colors bundle.
skin - The name of the skin
Method Detail

getHexString

public static java.lang.String getHexString(int r,
                                            int g,
                                            int b)
Gets the hexadecimal string representation of the given RGB components.

Parameters:
r - The red component of the color.
g - The green component of the color.
b - The blue component of the color.
Returns:
The hexadecimal code for these RGB components.

getHexString

public static java.lang.String getHexString(LyColor color)
Gets the hexadecimal string representation of the given color.

Parameters:
color - The color to convert.
Returns:
The hexadecimal code for the color.

getColorFromHexString

public static LyColor getColorFromHexString(java.lang.String hexColor)
Gets the Color representation of the given hexedecimal color code.

Parameters:
hexColor - the hexadecimal code for the color.
Returns:
The java Color for the hexadecimal code.

getBarycentricColor

public static LyColor getBarycentricColor(LyColor minColor,
                                          LyColor maxColor,
                                          float ratio)
Gets theColor computed with two colors and a ratio.

Parameters:
minColor - the first color
maxColor - the second color
ratio - the ratio that must be used to compute the color. If ratio equals 0, the first color is returned. If ratio equals 1, the second color is returned. If ratio is between 0 and 1, use a barycentric algorithm to compute the color.
Returns:
the color computed with the two given colors and the given ratio

getColorCodes

public java.util.Vector<java.lang.String> getColorCodes()
Gets the list of color keys of the color_codes properties file.

Returns:
the keys list as a Vector

getColor

public LyColor getColor(java.lang.String key)
Gets the color corresponding to the given key.

Parameters:
key - the color key.
Returns:
the color corresponding to the given key if it is found, null otherwise

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com