object."Alarm/creationTime" {
toolTipText: "@#tooltipFormatBean";
label: @creationTime;
}
Subobject#toolTipFormatBean {
class:"ilog.cpl.util.text.IlpSimpleDataFormat";
pattern: "HH:mm:ss z";
}
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 the example, an
IlpSimpleDateFormat object is created, with
the pattern property set to
HH:mm:ss z
, and is assigned to the
toolTipText
property of the object.
There are two refinements to 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
returns the same instance, the one created the first time and
without applying the CSS rules.
@+ID
Using
@+ID
instead of
@#ID
avoids unnecessary creation of objects. The CSS engine first
checks whether the property value corresponding to the
declaration is defined and not
null
. If the property value is defined, this current value is
customized directly using the rules for the
#ID
operator, deliberately ignoring any
class
declaration. If it is not defined, the operator behaves
exactly as with the
@#
operator. In this case, the operator creates the property
value only when required and customizes it in all cases.
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 when properties
change. Under certain circumstances, the creation of objects may
lead to expensive processing. These optional mechanisms minimize
the creation of objects.