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>cacheCachestatic java.lang.StringDEFAULT_PROPERTIES_EXTENSIONFile extensionprivate static java.lang.StringDEFAULT_PROPERTIES_PATHDefault properties pathstatic java.lang.StringDEFAULT_SCHEME_FILENAMEFile name of the default color scheme.static java.lang.StringDEFAULT_SCHEME_NAMEName of the default color scheme.private LineStyleLibrarylinelibLine style library to usestatic java.lang.StringLIST_SEPARATORSeparator for lists.private static LoggingLOGLoggerprivate MarkerLibrarymarkerlibMarker library to useprivate java.lang.StringnameStyle scheme namestatic java.lang.StringPROP_LINES_LIBRARYProperty string for the line style librarystatic java.lang.StringPROP_MARKER_LIBRARYProperty string for the marker style libraryprivate java.util.PropertiespropertiesProperties 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.StringgetBackgroundColor(java.lang.String key)Retrieve background color for an itemprivate <T> TgetCached(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.StringgetColor(java.lang.String key)Retrieve a color for an itemColorLibrarygetColorSet(java.lang.String key)Retrieve colorset for an itemjava.lang.StringgetFontFamily(java.lang.String key)Get font familydoublegetLineWidth(java.lang.String key)Get line widthprotected java.lang.StringgetName()Get the style scheme name.doublegetOpacity(java.lang.String key)Get opacityprotected java.lang.StringgetPropertyValue(java.lang.String prefix, java.lang.String postfix)Retrieve the property value for a particular path + type pair.doublegetSize(java.lang.String key)Get generic sizejava.lang.StringgetTextColor(java.lang.String key)Retrieve text color for an itemdoublegetTextSize(java.lang.String key)Get text sizeLineStyleLibrarylines()Get the line style library to use.MarkerLibrarymarkers()Get the marker library to use.private <T> voidsetCached(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:StyleLibraryRetrieve a color for an item- Specified by:
getColorin 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:StyleLibraryRetrieve background color for an item- Specified by:
getBackgroundColorin 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:StyleLibraryRetrieve text color for an item- Specified by:
getTextColorin 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:StyleLibraryRetrieve colorset for an item- Specified by:
getColorSetin interfaceStyleLibrary- Parameters:
key- Reference name- Returns:
- color library
-
getLineWidth
public double getLineWidth(java.lang.String key)
Description copied from interface:StyleLibraryGet line width- Specified by:
getLineWidthin interfaceStyleLibrary- Parameters:
key- Key- Returns:
- line width as double
-
getTextSize
public double getTextSize(java.lang.String key)
Description copied from interface:StyleLibraryGet text size- Specified by:
getTextSizein interfaceStyleLibrary- Parameters:
key- Key- Returns:
- line width as double
-
getFontFamily
public java.lang.String getFontFamily(java.lang.String key)
Description copied from interface:StyleLibraryGet font family- Specified by:
getFontFamilyin interfaceStyleLibrary- Parameters:
key- Key- Returns:
- font family CSS string
-
getSize
public double getSize(java.lang.String key)
Description copied from interface:StyleLibraryGet generic size- Specified by:
getSizein interfaceStyleLibrary- Parameters:
key- Key- Returns:
- size as double
-
getOpacity
public double getOpacity(java.lang.String key)
Description copied from interface:StyleLibraryGet opacity- Specified by:
getOpacityin interfaceStyleLibrary- Parameters:
key- Key- Returns:
- size as double
-
lines
public LineStyleLibrary lines()
Description copied from interface:StyleLibraryGet the line style library to use.- Specified by:
linesin interfaceStyleLibrary- Returns:
- line style library
-
markers
public MarkerLibrary markers()
Description copied from interface:StyleLibraryGet the marker library to use.- Specified by:
markersin interfaceStyleLibrary- Returns:
- marker library
-
-