Divergences from CSS2

Java objects are not HTML documents. The differences lead to an adaptation of the CSS, so that its power can be fully exploited. The CSS2 syntax is retained. Therefore, a CSS editor can still be used to create the style sheet.

Cascading

Cascading is explicit. The API provides a means of cascading the style sheets. The !important and inherit tags are not supported. They have not been implemented for the sake of simplicity.

Pseudo-classes and pseudo-elements

Pseudo-classes are minimal building blocks which match model objects according to an external context. The syntax is like a CSS class, but uses a colon (:) instead of a dot (.). For example, :link-visited matches a link element only if it is already visited. Only the browser can resolve this pseudoclass at run time.
The pseudo-classes are fully implemented and are used by all JViews TGO renderers. JViews TGO recognizes the pseudo-classes :selected , :focus , and :expanded by default.
A pseudo-class has the same specificity as a CSS class.
Pseudo-elements are metaclasses like pseudo-classes, but match document structure instead of the browser state; for example, :first-child .
The CSS2 predefined pseudoelements and pseudo-classes ( :link , :hover , and so forth) are not implemented: they have no meaning in Java™.

Attribute matching

Each attribute value must be converted to String . This conversion is done using the Type converter specified in your application context.
The attribute pattern in CSS2 checks only the presence [att] , equality [att=val] , and inclusion [att~=val] of strings. The |= operator is disabled. In Java, numeric comparators > , >= , <> , <= , < have been added, with the usual semantics.
Operators available in the attribute selectors
Operator
Meaning
Applicable To
A
present
strings
A=val
equals
strings
A~val
not equals
strings
A~=val
contains the word
strings
A==val
equals
numbers
A<>val
not equals
numbers
A<val
less than
numbers
A<=val
less than or equals
numbers
A>val
greater than
numbers
A>=val
greater than or equals
numbers

Syntax enhancement

CSS for Java requires the use of quotation marks when a token contains special characters such as dot (.), colon (:), commercial at sign (@), 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 semicolon (;) is optional.

Null value

Sometimes it makes sense to specify a null value in a declaration. By convention, null is a zero-length string '' or "" .

How to specify a null value

object {
    labelBackground: '';
}
The notation '' is also used to denote a null array for properties that expect an array of values.

Empty string

The null syntax does not distinguish the ability to write an empty string in the style sheets. If an empty string is required, it is easy to create it dynamically.

How to create an empty string

object {
    label: @#emptyString;
}

Subobject#emptyString {
    class: 'java.lang.String';
}
Note
You can use the sharing mechanism to avoid creating several strings. The @= construct creates the empty string the first time only and reuses the same instance for all other occurrences of @=emptyString.