public class CSSClassManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CSSClassManager.CSSNamingConflict
Class to signal a CSS naming conflict.
|
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<java.lang.String,CSSClass> |
store
Store the contained CSS classes.
|
Constructor and Description |
---|
CSSClassManager() |
Modifier and Type | Method and Description |
---|---|
CSSClass |
addClass(CSSClass clss)
Add a single class to the map.
|
boolean |
contains(java.lang.String name)
Check if a name is already used in the classes.
|
CSSClass |
getClass(java.lang.String name)
Retrieve a single class by name only
|
CSSClass |
getClass(java.lang.String name,
java.lang.Object owner)
Retrieve a single class by name and owner
|
java.util.Collection<CSSClass> |
getClasses()
Get all CSS classes in this manager.
|
org.w3c.dom.Element |
makeStyleElement(org.w3c.dom.Document document)
Make a (filled) CSS style element for the given document.
|
boolean |
mergeCSSFrom(CSSClassManager other)
Merge CSS classes, for example to merge two plots.
|
void |
removeClass(CSSClass clss)
Remove a single CSS class from the map.
|
void |
serialize(java.lang.StringBuilder buf)
Serialize managed CSS classes to rule file.
|
boolean |
testMergeable(CSSClassManager other)
Check whether or not CSS classes of two plots can be merged
|
void |
updateStyleElement(org.w3c.dom.Document document,
org.w3c.dom.Element style)
Update the text contents of an existing style element.
|
private java.util.HashMap<java.lang.String,CSSClass> store
public CSSClass addClass(CSSClass clss) throws CSSClassManager.CSSNamingConflict
clss
- new CSS classCSSClassManager.CSSNamingConflict
- when a class of the same name but different owner object exists.public void removeClass(CSSClass clss)
clss
- Class to removepublic CSSClass getClass(java.lang.String name, java.lang.Object owner) throws CSSClassManager.CSSNamingConflict
name
- Class nameowner
- Class ownerCSSClassManager.CSSNamingConflict
- if an owner was specified and doesn't matchpublic CSSClass getClass(java.lang.String name)
name
- CSS class namepublic boolean contains(java.lang.String name)
name
- CSS class namepublic void serialize(java.lang.StringBuilder buf)
buf
- String bufferpublic java.util.Collection<CSSClass> getClasses()
public boolean testMergeable(CSSClassManager other)
other
- Other classpublic boolean mergeCSSFrom(CSSClassManager other) throws CSSClassManager.CSSNamingConflict
other
- Other class to merge withCSSClassManager.CSSNamingConflict
- If there is a naming conflict.public void updateStyleElement(org.w3c.dom.Document document, org.w3c.dom.Element style)
document
- Document element (factory)style
- Style elementpublic org.w3c.dom.Element makeStyleElement(org.w3c.dom.Document document)
document
- DocumentCopyright © 2019 ELKI Development Team. License information.