CSS recursion

You are likely to want to specify a Java™ object as the value of a declaration. A simple convention allows you to recurse in the style sheet, that is, to define a new Java object which has the same style sheet but is unrelated to the current data model.

@# construct

Prefix the value with @# to create new beans when required as shown in the following code example.
Creating a bean in a declaration
form { 
      date : "@#dateBean" ; 
      title : "CSS rules" ;
}
Subobject#dateBean { 
      class : ’java.util.Date’ ; 
      time  : ’23849291’ ;
} 
The @# operator extends the current data model by adding a dummy model object as the child of the current object. The object ID of the dummy object is the remainder of the string, beyond the @# operator. The type of the dummy object is Subobject . The dummy object inherits CSS classes and attributes from its parent.
The CSS engine creates and customizes a new subobject according to the declarations it finds for the dummy object. This means, in particular, that the Java class of the subobject is determined by the value of the class property. The newly created subobject becomes the value of the @# expression. In the declarations for the subobject, attribute references through the @ operator refer to the attributes of the parent object.
Once the subobject is completed, the previous model is restored so that normal processing is resumed.
In code example Creating a bean in a declaration, a java.util.Date object is created, with the time property set to 23849291 . This new object is assigned to the date property of the form object.

@= and @+ constructs

There are two refinements of the @#ID operator:
  • '@=ID'
    Using @=ID instead of @#ID shares the instance. The first time the declaration is resolved, the object is created as with the @# operator. But for all subsequent access to the same value, @=ID will return the same instance, the one created the first time, without applying the rules. Note that all instances created with @= are cleared when a new style sheet is applied.
  • '@+ID'
    Using @+ID instead of @#ID avoids useless creation. Basically @+ID customizes only the object currently assigned to the property, unless it does not exist or its class is not the same as the one defined in the #ID rule. In this case, the object is first created, then customized, and then assigned to the property, the same as with an @# construct.
The need for these refinements arises from a performance issue. The @# operator creates a new object each time a declaration is resolved. Usually a declaration is applied whenever a property changes. Under certain circumstances, the creation of objects may lead to expensive processing, so Rogue Wave® JViews Diagrammer provides an optional mechanism to minimize the creation of objects during property changes.

@| construct

A CSS declaration value starting with @| is interpreted as an expression (see Expressions).

@ construct

A CSS declaration value that is exactly @ means cancel the property setting made in a previous rule. This construct is useful to prevent a property from being modified, especially when the default value is unknown. For example:
Canceling a property setting
node {
   width : 23 ;
}

node.fixed {
   width : @ ;
}
These two rules say that the width property value should be set to 23, unless the node has the CSS class fixed . Without the @ ability, the default value of width would have to be written down in the CSS.