Package elki.visualization.style
Class PropertiesBasedStyleLibrary
- java.lang.Object
-
- elki.visualization.style.PropertiesBasedStyleLibrary
-
- All Implemented Interfaces:
StyleLibrary
public class PropertiesBasedStyleLibrary extends java.lang.Object implements StyleLibrary
Style library loading the parameters from a properties file.- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Object>
cache
Cachestatic java.lang.String
DEFAULT_PROPERTIES_EXTENSION
File extensionprivate static java.lang.String
DEFAULT_PROPERTIES_PATH
Default properties pathstatic java.lang.String
DEFAULT_SCHEME_FILENAME
File name of the default color scheme.static java.lang.String
DEFAULT_SCHEME_NAME
Name of the default color scheme.private LineStyleLibrary
linelib
Line style library to usestatic java.lang.String
LIST_SEPARATOR
Separator for lists.private static Logging
LOG
Loggerprivate MarkerLibrary
markerlib
Marker library to useprivate java.lang.String
name
Style scheme namestatic java.lang.String
PROP_LINES_LIBRARY
Property string for the line style librarystatic java.lang.String
PROP_MARKER_LIBRARY
Property string for the marker style libraryprivate java.util.Properties
properties
Properties file to use.-
Fields inherited from interface 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, PLOTGRAY, POLYGONS, REFERENCE_POINTS, SCALE, SELECTION, SELECTION_ACTIVE, TEXT_COLOR, TEXT_SIZE, XYCURVE
-
-
Constructor Summary
Constructors Constructor Description PropertiesBasedStyleLibrary()
Constructor without a properties file name.PropertiesBasedStyleLibrary(java.lang.String filename, java.lang.String name)
Constructor with a given file name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBackgroundColor(java.lang.String key)
Retrieve background color for an itemprivate <T> T
getCached(java.lang.String prefix, java.lang.String postfix, java.lang.Class<T> cls)
Get a value from the cache (to avoid repeated parsing)java.lang.String
getColor(java.lang.String key)
Retrieve a color for an itemColorLibrary
getColorSet(java.lang.String key)
Retrieve colorset for an itemjava.lang.String
getFontFamily(java.lang.String key)
Get font familydouble
getLineWidth(java.lang.String key)
Get line widthprotected java.lang.String
getName()
Get the style scheme name.double
getOpacity(java.lang.String key)
Get opacityprotected java.lang.String
getPropertyValue(java.lang.String prefix, java.lang.String postfix)
Retrieve the property value for a particular path + type pair.double
getSize(java.lang.String key)
Get generic sizejava.lang.String
getTextColor(java.lang.String key)
Retrieve text color for an itemdouble
getTextSize(java.lang.String key)
Get text sizeLineStyleLibrary
lines()
Get the line style library to use.MarkerLibrary
markers()
Get the marker library to use.private <T> void
setCached(java.lang.String prefix, java.lang.String postfix, T data)
Set a cache value
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Logger
-
DEFAULT_SCHEME_NAME
public static final java.lang.String DEFAULT_SCHEME_NAME
Name of the default color scheme.- See Also:
- Constant Field Values
-
DEFAULT_SCHEME_FILENAME
public static final java.lang.String DEFAULT_SCHEME_FILENAME
File name of the default color scheme.- See Also:
- Constant Field Values
-
DEFAULT_PROPERTIES_EXTENSION
public static final java.lang.String DEFAULT_PROPERTIES_EXTENSION
File extension- See Also:
- Constant Field Values
-
DEFAULT_PROPERTIES_PATH
private static final java.lang.String DEFAULT_PROPERTIES_PATH
Default properties path
-
LIST_SEPARATOR
public static final java.lang.String LIST_SEPARATOR
Separator for lists.- See Also:
- Constant Field Values
-
PROP_LINES_LIBRARY
public static final java.lang.String PROP_LINES_LIBRARY
Property string for the line style library- See Also:
- Constant Field Values
-
PROP_MARKER_LIBRARY
public static final java.lang.String PROP_MARKER_LIBRARY
Property string for the marker style library- See Also:
- Constant Field Values
-
properties
private java.util.Properties properties
Properties file to use.
-
name
private java.lang.String name
Style scheme name
-
cache
private java.util.Map<java.lang.String,java.lang.Object> 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(java.lang.String filename, java.lang.String name)
Constructor with a given file name.- Parameters:
filename
- Name of properties file.name
- NAme for this style
-
-
Method Detail
-
getName
protected java.lang.String getName()
Get the style scheme name.- Returns:
- the name
-
getCached
private <T> T getCached(java.lang.String prefix, java.lang.String postfix, java.lang.Class<T> cls)
Get a value from the cache (to avoid repeated parsing)- Type Parameters:
T
- Type- Parameters:
prefix
- Tree namepostfix
- Property namecls
- Class restriction- Returns:
- Resulting value
-
setCached
private <T> void setCached(java.lang.String prefix, java.lang.String postfix, T data)
Set a cache value- Type Parameters:
T
- Type- Parameters:
prefix
- Tree namepostfix
- Property namedata
- Data
-
getPropertyValue
protected java.lang.String getPropertyValue(java.lang.String prefix, java.lang.String postfix)
Retrieve the property value for a particular path + type pair.- Parameters:
prefix
- Pathpostfix
- Type- Returns:
- Value
-
getColor
public java.lang.String getColor(java.lang.String key)
Description copied from interface:StyleLibrary
Retrieve a color for an item- Specified by:
getColor
in interfaceStyleLibrary
- Parameters:
key
- Reference name- Returns:
- color in CSS/SVG valid format: hexadecimal (#aabbcc) or names such as "red"
-
getBackgroundColor
public java.lang.String getBackgroundColor(java.lang.String key)
Description copied from interface:StyleLibrary
Retrieve background color for an item- Specified by:
getBackgroundColor
in interfaceStyleLibrary
- Parameters:
key
- Reference name- Returns:
- color in CSS/SVG valid format: hexadecimal (#aabbcc) or names such as "red"
-
getTextColor
public java.lang.String getTextColor(java.lang.String key)
Description copied from interface:StyleLibrary
Retrieve text color for an item- Specified by:
getTextColor
in interfaceStyleLibrary
- Parameters:
key
- Reference name- Returns:
- color in CSS/SVG valid format: hexadecimal (#aabbcc) or names such as "red"
-
getColorSet
public ColorLibrary getColorSet(java.lang.String key)
Description copied from interface:StyleLibrary
Retrieve colorset for an item- Specified by:
getColorSet
in interfaceStyleLibrary
- Parameters:
key
- Reference name- Returns:
- color library
-
getLineWidth
public double getLineWidth(java.lang.String key)
Description copied from interface:StyleLibrary
Get line width- Specified by:
getLineWidth
in interfaceStyleLibrary
- Parameters:
key
- Key- Returns:
- line width as double
-
getTextSize
public double getTextSize(java.lang.String key)
Description copied from interface:StyleLibrary
Get text size- Specified by:
getTextSize
in interfaceStyleLibrary
- Parameters:
key
- Key- Returns:
- line width as double
-
getFontFamily
public java.lang.String getFontFamily(java.lang.String key)
Description copied from interface:StyleLibrary
Get font family- Specified by:
getFontFamily
in interfaceStyleLibrary
- Parameters:
key
- Key- Returns:
- font family CSS string
-
getSize
public double getSize(java.lang.String key)
Description copied from interface:StyleLibrary
Get generic size- Specified by:
getSize
in interfaceStyleLibrary
- Parameters:
key
- Key- Returns:
- size as double
-
getOpacity
public double getOpacity(java.lang.String key)
Description copied from interface:StyleLibrary
Get opacity- Specified by:
getOpacity
in interfaceStyleLibrary
- 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 interfaceStyleLibrary
- Returns:
- line style library
-
markers
public MarkerLibrary markers()
Description copied from interface:StyleLibrary
Get the marker library to use.- Specified by:
markers
in interfaceStyleLibrary
- Returns:
- marker library
-
-