| Developing with the SDK > Using CSS Syntax in the Style Sheet > Applying CSS To Java Objects > Divergences from CSS2 |
Divergences from CSS2 |
INDEX
PREVIOUS
NEXT
|
Java objects are not HTML documents. The CSS2 syntax remains, so that a CSS editor can still be used to create the style sheet. However, the differences lead to adaptations of the CSS mechanism so that its power can be fully exploited and to some specific behavior.
Cascading is explicit: the API offers a means of cascading style sheets. However, the !important and inherit tags are not supported for the sake of simplicity.
The pseudo-class construct is fully implemented and used to represent renderer-specific states or GUI items. The list of predefined pseudo-classes and where they are used is as follows:
inspector (Workflow Modeler)
selected (any renderer)
collapsed or expanded (expandCollapseRenderer)
<renderer_name>, for example, legendRenderer (to specify that the rule applies only to rendering properties and not graphic object properties)
renderer (to specify a property belonging to a renderer, as opposed to one with the same name belonging to the graphic object)
tree (Workflow Modeler)
table (Workflow Modeler)
You can add custom pseudo-classes with the method IlvSDMEngine:setPseudoClasses.
The CSS2 predefined pseudo-elements and pseudo-classes (:link, :hover, and so forth) are not implemented because they have no meaning in Java.
The attribute pattern in CSS2 makes the following checks for strings: presence [att], equality [att=val], and inclusion [att~=val] . The |= operator is disabled.
For Java objects, there are the following numeric comparators >, >=, <>, <=, <, with the usual semantics.
There are also equal and not-equal comparators which make the distinction between string comparison and numerical comparison:
CSS for Java requires the use of quotation marks when a token contains special characters, such as dot (.), colon (:), at sign (@), number sign (also known as hash sign, #), space ( ), and so on.
Quotes can be used almost everywhere, in particular to delimit a declaration value, an element type, or a CSS class with reserved characters.
The closing ";" is optional.
Sometimes it makes sense to specify a null value in a declaration. By convention, null is a zero-length string '' or "". For example:
node.not-handled {
class : '' ;
}
When a null class name is specified, no object is created at all, and no error is reported as it would be for a malformed class name.
The notation '' is also used to denote a null array for properties expecting an array of values.
The null syntax does not allow you to specify an empty string in the style sheet. Instead, you can create an empty string, as shown in Code Sample 3.13.
node { label : @#emptyString ; } Subobject#emptyString { class : 'java.lang.String'; } |
Better still, you can use the sharing mechanism to avoid the creation of several strings. The @= construct will create the empty string the first time only and will then reuse the same instance for all other occurrences of @#emptyString, see Code Sample 3.14.
node { label : @=emptyString ; } Subobject#emptyString { class : 'java.lang.String'; } |
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |