public class CSSClassManager extends Object
Modifier and Type | Class and Description |
---|---|
class |
CSSClassManager.CSSNamingConflict
Class to signal a CSS naming conflict.
|
Modifier and Type | Field and Description |
---|---|
private HashMap<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(String name)
Check if a name is already used in the classes.
|
CSSClass |
getClass(String name)
Retrieve a single class by name only
|
CSSClass |
getClass(String name,
Object owner)
Retrieve a single class by name and owner
|
Collection<CSSClass> |
getClasses()
Get all CSS classes in this manager.
|
Element |
makeStyleElement(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(StringBuffer 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(Document document,
Element style)
Update the text contents of an existing style element.
|
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(String name, Object owner) throws CSSClassManager.CSSNamingConflict
name
- Class nameowner
- Class ownerCSSClassManager.CSSNamingConflict
- if an owner was specified and doesn't matchpublic CSSClass getClass(String name)
name
- CSS class namepublic boolean contains(String name)
name
- CSS class namepublic void serialize(StringBuffer buf)
buf
- String bufferpublic 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(Document document, Element style)
document
- Document element (factory)style
- Style element