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

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

public class CSSClass
extends Object

Class representing a single CSS class.


Nested Class Summary
 class CSSClass.InvalidCSS
          Exception class thrown when encountering invalid CSS.
 
Field Summary
private  String name
          CSS class name
private  WeakReference<Object> owner
          Owner.
private  Collection<Pair<String,String>> statements
          Actual CSS statements
 
Constructor Summary
CSSClass(Object owner, String name)
          Simplified constructor, empty statements list.
CSSClass(Object owner, String name, Collection<Pair<String,String>> statements)
          Full constructor
CSSClass(Object owner, String name, CSSClass other)
          Cloning constructor
 
Method Summary
 void appendCSSDefinition(StringBuffer buf)
          Append CSS definition to a stream
static boolean checkCSSStatement(String key, String value)
          Validate a single CSS statement.
static boolean checkCSSStatements(Collection<Pair<String,String>> statements)
          Validate a set of CSS statements.
static boolean checkName(String name)
          Verify that the name is an admissible CSS class name.
 String getName()
          Get the class name.
 Object getOwner()
          Get class owner.
 String getStatement(String key)
          Get the current value of a particular CSS statement.
 Collection<Pair<String,String>> getStatements()
          Get read-only collection access to all statements.
 String inlineCSS()
          Render CSS class to inline formatting
 void removeStatement(String key)
          Remove a CSS statement.
static String sanitizeName(String name)
          Return a sanitized version of the given string.
 void setName(String name)
          Set the class name.
 void setStatement(String key, double value)
          Set a CSS statement.
 void setStatement(String key, int value)
          Set a CSS statement.
 void setStatement(String key, String value)
          Set a CSS statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private String name
CSS class name


statements

private Collection<Pair<String,String>> statements
Actual CSS statements


owner

private WeakReference<Object> owner
Owner.

Constructor Detail

CSSClass

public CSSClass(Object owner,
                String name,
                Collection<Pair<String,String>> statements)
Full constructor

Parameters:
owner - Class owner (to detect conflicts)
name - Class name
statements - Collection of CSS statements

CSSClass

public CSSClass(Object owner,
                String name)
Simplified constructor, empty statements list.

Parameters:
owner - Class owner.
name - Class name.

CSSClass

public CSSClass(Object owner,
                String name,
                CSSClass other)
Cloning constructor

Parameters:
owner - Class owner.
name - Class name.
other - Class to clone
Method Detail

checkName

public static boolean checkName(String name)
Verify that the name is an admissible CSS class name. TODO: implement.

Parameters:
name - name to use
Returns:
true if valid CSS class name

sanitizeName

public static String sanitizeName(String name)
Return a sanitized version of the given string. TODO: implement extensive checks.

Parameters:
name - name to sanitize
Returns:
Sanitized version.

checkCSSStatement

public static boolean checkCSSStatement(String key,
                                        String value)
Validate a single CSS statement. TODO: implement extensive checks.

Parameters:
key - Key
value - Value
Returns:
true if valid statement.

checkCSSStatements

public static boolean checkCSSStatements(Collection<Pair<String,String>> statements)
Validate a set of CSS statements. TODO: checks are currently not very extensive.

Parameters:
statements - Statements to check
Returns:
true if valid

getName

public String getName()
Get the class name.

Returns:
class name.

setName

public void setName(String name)
Set the class name.

Parameters:
name - new class name.

getOwner

public Object getOwner()
Get class owner.

Returns:
class owner.

getStatement

public String getStatement(String key)
Get the current value of a particular CSS statement.

Parameters:
key - statement key.
Returns:
current value or null.

getStatements

public Collection<Pair<String,String>> getStatements()
Get read-only collection access to all statements.

Returns:
Collection

setStatement

public void setStatement(String key,
                         String value)
Set a CSS statement.

Parameters:
key - Statement key.
value - Value or null (to unset)

setStatement

public void setStatement(String key,
                         int value)
Set a CSS statement.

Parameters:
key - Statement key.
value - Value

setStatement

public void setStatement(String key,
                         double value)
Set a CSS statement.

Parameters:
key - Statement key.
value - Value

removeStatement

public void removeStatement(String key)
Remove a CSS statement.

Parameters:
key - Statement key.

appendCSSDefinition

public void appendCSSDefinition(StringBuffer buf)
Append CSS definition to a stream

Parameters:
buf - String buffer to append to.

inlineCSS

public String inlineCSS()
Render CSS class to inline formatting

Returns:
string rendition of CSS for inline use

Release 0.4.0 (2011-09-20_1324)