public class CSSClass
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CSSClass.InvalidCSS
Exception class thrown when encountering invalid CSS.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
name
CSS class name
|
private java.lang.ref.WeakReference<java.lang.Object> |
owner
Owner.
|
private java.util.Collection<Pair<java.lang.String,java.lang.String>> |
statements
Actual CSS statements
|
Constructor and Description |
---|
CSSClass(java.lang.Object owner,
java.lang.String name)
Simplified constructor, empty statements list.
|
CSSClass(java.lang.Object owner,
java.lang.String name,
java.util.Collection<Pair<java.lang.String,java.lang.String>> statements)
Full constructor
|
CSSClass(java.lang.Object owner,
java.lang.String name,
CSSClass other)
Cloning constructor
|
Modifier and Type | Method and Description |
---|---|
void |
appendCSSDefinition(java.lang.StringBuilder buf)
Append CSS definition to a stream
|
static boolean |
checkCSSStatement(java.lang.String key,
java.lang.String value)
Validate a single CSS statement.
|
static boolean |
checkCSSStatements(java.util.Collection<Pair<java.lang.String,java.lang.String>> statements)
Validate a set of CSS statements.
|
static boolean |
checkName(java.lang.String name)
Verify that the name is an admissible CSS class name.
|
java.lang.String |
getName()
Get the class name.
|
java.lang.Object |
getOwner()
Get class owner.
|
java.lang.String |
getStatement(java.lang.String key)
Get the current value of a particular CSS statement.
|
java.util.Collection<Pair<java.lang.String,java.lang.String>> |
getStatements()
Get read-only collection access to all statements.
|
java.lang.String |
inlineCSS()
Render CSS class to inline formatting
|
void |
removeStatement(java.lang.String key)
Remove a CSS statement.
|
static java.lang.String |
sanitizeName(java.lang.String name)
Return a sanitized version of the given string.
|
void |
setName(java.lang.String name)
Set the class name.
|
void |
setStatement(java.lang.String key,
double value)
Set a CSS statement.
|
void |
setStatement(java.lang.String key,
int value)
Set a CSS statement.
|
void |
setStatement(java.lang.String key,
java.lang.String value)
Set a CSS statement.
|
private java.lang.String name
private java.util.Collection<Pair<java.lang.String,java.lang.String>> statements
private java.lang.ref.WeakReference<java.lang.Object> owner
public CSSClass(java.lang.Object owner, java.lang.String name, java.util.Collection<Pair<java.lang.String,java.lang.String>> statements)
owner
- Class owner (to detect conflicts)name
- Class namestatements
- Collection of CSS statementspublic CSSClass(java.lang.Object owner, java.lang.String name)
owner
- Class owner.name
- Class name.public CSSClass(java.lang.Object owner, java.lang.String name, CSSClass other)
owner
- Class owner.name
- Class name.other
- Class to clonepublic static boolean checkName(java.lang.String name)
name
- name to usepublic static java.lang.String sanitizeName(java.lang.String name)
name
- name to sanitizepublic static boolean checkCSSStatement(java.lang.String key, java.lang.String value)
key
- Keyvalue
- Valuepublic static boolean checkCSSStatements(java.util.Collection<Pair<java.lang.String,java.lang.String>> statements)
statements
- Statements to checkpublic java.lang.String getName()
public void setName(java.lang.String name)
name
- new class name.public java.lang.Object getOwner()
public java.lang.String getStatement(java.lang.String key)
key
- statement key.public java.util.Collection<Pair<java.lang.String,java.lang.String>> getStatements()
public void setStatement(java.lang.String key, java.lang.String value)
key
- Statement key.value
- Value or null (to unset)public void setStatement(java.lang.String key, int value)
key
- Statement key.value
- Valuepublic void setStatement(java.lang.String key, double value)
key
- Statement key.value
- Valuepublic void removeStatement(java.lang.String key)
key
- Statement key.public void appendCSSDefinition(java.lang.StringBuilder buf)
buf
- String buffer to append to.public java.lang.String inlineCSS()
Copyright © 2019 ELKI Development Team. License information.