de.lmu.ifi.dbs.elki.visualization.style
Class PropertiesBasedStyleLibrary

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.visualization.style.PropertiesBasedStyleLibrary
All Implemented Interfaces:
StyleLibrary

public class PropertiesBasedStyleLibrary
extends Object
implements StyleLibrary

Style library loading the parameters from a properties file.


Field Summary
private  AnyMap<String> cache
          Cache
static String DEFAULT_PROPERTIES_EXTENSION
          File extension
private static String DEFAULT_PROPERTIES_PATH
          Default properties path
static String DEFAULT_SCHEME_FILENAME
          File name of the default color scheme.
static String DEFAULT_SCHEME_NAME
          Name of the default color scheme.
private  LineStyleLibrary linelib
          Line style library to use
static String LIST_SEPARATOR
          Separator for lists.
protected static Logging logger
          Logger
private  MarkerLibrary markerlib
          Marker library to use
private  String name
          Style scheme name
private  Properties properties
          Properties file to use.
 
Fields inherited from interface de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary
AXIS, AXIS_LABEL, AXIS_TICK, AXIS_TICK_MINOR, BACKGROUND_COLOR, BUBBLEPLOT, CLUSTERORDER, COLOR, COLORSET, DEFAULT, DOTPLOT, FONT_FAMILY, GENERIC_SIZE, KEY, LINE_WIDTH, MARGIN, MARKERPLOT, OPACITY, PAGE, PLOT, POLYGONS, REFERENCE_POINTS, SCALE, SELECTION, SELECTION_ACTIVE, TEXT_COLOR, TEXT_SIZE
 
Constructor Summary
PropertiesBasedStyleLibrary()
          Constructor without a properties file name.
PropertiesBasedStyleLibrary(String filename, String name)
          Constructor with a given file name.
 
Method Summary
 String getBackgroundColor(String key)
          Retrieve background color for an item
private
<T> T
getCached(String prefix, String postfix, Class<T> cls)
          Get a value from the cache (to avoid repeated parsing)
 String getColor(String key)
          Retrieve a color for an item
 ColorLibrary getColorSet(String key)
          Retrieve colorset for an item
 String getFontFamily(String key)
          Get font family
 double getLineWidth(String key)
          Get line width
protected  String getName()
          Get the style scheme name.
 double getOpacity(String key)
          Get opacity
protected  String getPropertyValue(String prefix, String postfix)
          Retrieve the property value for a particular path + type pair.
 double getSize(String key)
          Get generic size
 String getTextColor(String key)
          Retrieve text color for an item
 double getTextSize(String key)
          Get text size
 LineStyleLibrary lines()
          Get the line style library to use.
 MarkerLibrary markers()
          Get the marker library to use.
private
<T> void
setCached(String prefix, String postfix, T data)
          Set a cache value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logging logger
Logger


DEFAULT_SCHEME_NAME

public static final String DEFAULT_SCHEME_NAME
Name of the default color scheme.

See Also:
Constant Field Values

DEFAULT_SCHEME_FILENAME

public static final String DEFAULT_SCHEME_FILENAME
File name of the default color scheme.

See Also:
Constant Field Values

DEFAULT_PROPERTIES_EXTENSION

public static final String DEFAULT_PROPERTIES_EXTENSION
File extension

See Also:
Constant Field Values

DEFAULT_PROPERTIES_PATH

private static final String DEFAULT_PROPERTIES_PATH
Default properties path


LIST_SEPARATOR

public static final String LIST_SEPARATOR
Separator for lists.

See Also:
Constant Field Values

properties

private Properties properties
Properties file to use.


name

private String name
Style scheme name


cache

private AnyMap<String> cache
Cache


linelib

private LineStyleLibrary linelib
Line style library to use


markerlib

private MarkerLibrary markerlib
Marker library to use

Constructor Detail

PropertiesBasedStyleLibrary

public PropertiesBasedStyleLibrary()
Constructor without a properties file name.


PropertiesBasedStyleLibrary

public PropertiesBasedStyleLibrary(String filename,
                                   String name)
Constructor with a given file name.

Parameters:
filename - Name of properties file.
name - NAme for this style
Method Detail

getName

protected String getName()
Get the style scheme name.

Returns:
the name

getCached

private <T> T getCached(String prefix,
                        String postfix,
                        Class<T> cls)
Get a value from the cache (to avoid repeated parsing)

Type Parameters:
T - Type
Parameters:
prefix - Tree name
postfix - Property name
cls - Class restriction
Returns:
Resulting value

setCached

private <T> void setCached(String prefix,
                           String postfix,
                           T data)
Set a cache value

Type Parameters:
T - Type
Parameters:
prefix - Tree name
postfix - Property name
data - Data

getPropertyValue

protected String getPropertyValue(String prefix,
                                  String postfix)
Retrieve the property value for a particular path + type pair.

Parameters:
prefix - Path
postfix - Type
Returns:
Value

getColor

public String getColor(String key)
Description copied from interface: StyleLibrary
Retrieve a color for an item

Specified by:
getColor in interface StyleLibrary
Parameters:
key - Reference name
Returns:
color in CSS/SVG valid format: hexadecimal (#aabbcc) or names such as "red"

getBackgroundColor

public String getBackgroundColor(String key)
Description copied from interface: StyleLibrary
Retrieve background color for an item

Specified by:
getBackgroundColor in interface StyleLibrary
Parameters:
key - Reference name
Returns:
color in CSS/SVG valid format: hexadecimal (#aabbcc) or names such as "red"

getTextColor

public String getTextColor(String key)
Description copied from interface: StyleLibrary
Retrieve text color for an item

Specified by:
getTextColor in interface StyleLibrary
Parameters:
key - Reference name
Returns:
color in CSS/SVG valid format: hexadecimal (#aabbcc) or names such as "red"

getColorSet

public ColorLibrary getColorSet(String key)
Description copied from interface: StyleLibrary
Retrieve colorset for an item

Specified by:
getColorSet in interface StyleLibrary
Parameters:
key - Reference name
Returns:
color library

getLineWidth

public double getLineWidth(String key)
Description copied from interface: StyleLibrary
Get line width

Specified by:
getLineWidth in interface StyleLibrary
Parameters:
key - Key
Returns:
line width as double

getTextSize

public double getTextSize(String key)
Description copied from interface: StyleLibrary
Get text size

Specified by:
getTextSize in interface StyleLibrary
Parameters:
key - Key
Returns:
line width as double

getFontFamily

public String getFontFamily(String key)
Description copied from interface: StyleLibrary
Get font family

Specified by:
getFontFamily in interface StyleLibrary
Parameters:
key - Key
Returns:
font family CSS string

getSize

public double getSize(String key)
Description copied from interface: StyleLibrary
Get generic size

Specified by:
getSize in interface StyleLibrary
Parameters:
key - Key
Returns:
size as double

getOpacity

public double getOpacity(String key)
Description copied from interface: StyleLibrary
Get opacity

Specified by:
getOpacity in interface StyleLibrary
Parameters:
key - Key
Returns:
size as double

lines

public LineStyleLibrary lines()
Description copied from interface: StyleLibrary
Get the line style library to use.

Specified by:
lines in interface StyleLibrary
Returns:
line style library

markers

public MarkerLibrary markers()
Description copied from interface: StyleLibrary
Get the marker library to use.

Specified by:
markers in interface StyleLibrary
Returns:
marker library

Release 0.4.0 (2011-09-20_1324)