Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.visualization.css
Class CSSClassManager

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager

public class CSSClassManager
extends Object

Manager class to track CSS classes used in a particular SVG document.

Author:
Erich Schubert

Nested Class Summary
 class CSSClassManager.CSSNamingConflict
          Class to signal a CSS naming conflict.
 
Field Summary
private static long serialVersionUID
          Serial version.
private  HashMap<String,CSSClass> store
          Store the contained CSS classes.
 
Constructor Summary
CSSClassManager()
           
 
Method Summary
 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 compatibility
 void updateStyleElement(Document document, Element style)
          Update the text contents of an existing style element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

private HashMap<String,CSSClass> store
Store the contained CSS classes.


serialVersionUID

private static final long serialVersionUID
Serial version.

See Also:
Constant Field Values
Constructor Detail

CSSClassManager

public CSSClassManager()
Method Detail

addClass

public CSSClass addClass(CSSClass clss)
                  throws CSSClassManager.CSSNamingConflict
Add a single class to the map.

Parameters:
clss -
Returns:
existing (old) class
Throws:
CSSClassManager.CSSNamingConflict - when a class of the same name but different owner object exists.

removeClass

public void removeClass(CSSClass clss)
Remove a single CSS class from the map. Note that classes are removed by reference, not by name!

Parameters:
clss - Class to remove

getClass

public CSSClass getClass(String name,
                         Object owner)
                  throws CSSClassManager.CSSNamingConflict
Retrieve a single class by name and owner

Parameters:
name -
owner -
Returns:
existing (old) class
Throws:
CSSClassManager.CSSNamingConflict - if an owner was specified and doesn't match

getClass

public CSSClass getClass(String name)
Retrieve a single class by name only

Parameters:
name -
Returns:
existing (old) class

contains

public boolean contains(String name)
Check if a name is already used in the classes.

Parameters:
name -
Returns:
true if the class name is already used.

serialize

public void serialize(StringBuffer buf)
Serialize managed CSS classes to rule file.

Parameters:
buf - String buffer

getClasses

public Collection<CSSClass> getClasses()
Get all CSS classes in this manager.

Returns:
CSS classes.

testMergeable

public boolean testMergeable(CSSClassManager other)
Check compatibility


mergeCSSFrom

public boolean mergeCSSFrom(CSSClassManager other)
                     throws CSSClassManager.CSSNamingConflict
Merge CSS classes, for example to merge two plots.

Throws:
CSSClassManager.CSSNamingConflict - If there is a naming conflict.

updateStyleElement

public void updateStyleElement(Document document,
                               Element style)
Update the text contents of an existing style element.

Parameters:
document - Document element (factory)
style - Style element

makeStyleElement

public Element makeStyleElement(Document document)
Make a (filled) CSS style element for the given document.

Parameters:
document - Document
Returns:
Style element

Release 0.2 (2009-07-06_1820)