|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcox.jmatt.java.MathTools.markup.StyleInfo
public class StyleInfo
This class encapsulates CSS rules and 'style=' attributes. It contains an internal Hashtable for tracking this information along with methods to add, remove,
and clear it. It also has methods to format the information as a CSS-style rule or raw data for an XML attribute. For declarations whose value should be
numeric, the _addNDeclaration()
methods offer numeric enforcement and optional value clamping.
Constructor Summary | |
---|---|
StyleInfo()
Create a blank tag, waiting for declarations to be set. |
|
StyleInfo(java.lang.String pRuleName)
Create a named tag, if the name supplied is not null or blank. |
Method Summary | |
---|---|
protected boolean |
_addDeclaration(java.lang.String pKey,
java.lang.String pValue)
Add a declaration to the internal data. |
protected boolean |
_addNDeclaration(java.lang.String pKey,
java.lang.Number pValue)
Convenience method for _addNDeclaration(pKey, pValue, null, null) . |
protected boolean |
_addNDeclaration(java.lang.String pKey,
java.lang.Number pValue,
java.lang.Double pMin,
java.lang.Double pMax)
Add a possibly-clamped numeric declaration. |
protected java.util.Hashtable<java.lang.String,java.lang.String> |
_declarations()
Return a copy of the current declarations. |
protected void |
_enableCopy()
Use this method to enable the various copyOf() methods. |
protected static java.lang.String |
_uniqueName()
Use this method to generate a unique name rule for declaration groups. |
void |
configurate(java.util.Properties pPizza)
This is a generic default configuration method for StyleInfo subclasses. |
void |
configurateGlobalPizza()
This method simply calls configurate() on the Global Pizza. |
StyleInfo |
copyOf()
Create and return a copy of this instance. |
void |
reset()
Clear all inernal data. |
void |
setName(java.lang.String pName)
Set the the (default) attribute name (attribute) or selector (css) text. |
java.lang.String |
toAttribute()
This is the toAttribute() method with the internal name, if one is set. |
java.lang.String |
toAttribute(java.lang.String pName)
Return the declarations in a format appropriate for an XML attribute. |
java.lang.String |
toCSS()
Return the declarations in a format suitable for an internal or external CSS stylesheet. |
java.lang.String |
toRawCSS()
List all the declarations as a String of key-value pairs. |
java.lang.String |
toString()
List all the declarations as a String of key-value pairs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StyleInfo()
public StyleInfo(java.lang.String pRuleName)
Method Detail |
---|
protected static final java.lang.String _uniqueName()
protected final java.util.Hashtable<java.lang.String,java.lang.String> _declarations()
protected final void _enableCopy()
copyOf()
methods. When called it stores all declarations in a temporary static variable; the next
instance automatically copies the declarations set for itself, then the temporary variable is cleared.
protected final boolean _addDeclaration(java.lang.String pKey, java.lang.String pValue)
addStyle('visible', 'false');
.
pKey
- The declaration property name.pValue
- The declaration value.protected final boolean _addNDeclaration(java.lang.String pKey, java.lang.Number pValue, java.lang.Double pMin, java.lang.Double pMax)
java.lang.Number
and the limits as java.lang.Double
. If
either limit is ignored. If not, the value is replaced by the minimum if it is less than the minimum and the maximum if it is greater than the maximum.
CAUTION: This method does not check to see if the minimum supplied is in fact less than the maximum! Use with care. If the value is null it is removed. If
the key is null or blank the method returns false immediately.
pKey
- The name of the declaration property.pValue
- The (numeric) value of the declaration or null to remove it.pMin
- The minimum value, ignored if null.pMax
- The maximum value, ignored if null.protected final boolean _addNDeclaration(java.lang.String pKey, java.lang.Number pValue)
_addNDeclaration(pKey, pValue, null, null)
.
public void setName(java.lang.String pName)
public void configurate(java.util.Properties pPizza)
StyleInfo
subclasses. This implementation is empty but is provided if needed. Any subclass
defining this method must document exactly what and how the information is passed (other than by the Properties
object, which is given!). The
theory is that subclasses can pick through the keys, select the ones relevant to themselves and self-configure accordingly.
pPizza
- The Properties object containing configuration information.public void configurateGlobalPizza()
configurate()
on the Global Pizza.
public void reset()
public StyleInfo copyOf()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toRawCSS()
public java.lang.String toAttribute(java.lang.String pName)
toString()
but with quotes on both sides.
if the pName argument is not null or void it appears to the left, making the entire returned String usable as an attribute. If pName is null or blank no
name or equals sign appears.
pName
- The attribute name to be output to the left of the rules String.public java.lang.String toAttribute()
toAttribute()
method with the internal name, if one is set.
public java.lang.String toCSS()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |