The rom.def file
The rom.def file contains metadata defining the specific ROM elements, their properties, their slots, and their methods. You can find rom.def in:
$INSTALL_DIR\eclipse\plugins
\org.eclipse.birt.report.model_<version>.jar
\org\eclipse\birt\report\model\elements\rom.def
The rom.def file is an internal file that the design engine uses to present a property sheet for a ROM element. The property sheet for an element contains the element’s properties and their types, the element’s methods, and valid choice selections for each of the element’s properties. When the BIRT development team changes the structure of a ROM element, the changed item includes an attribute that shows the BIRT version in which that change occurred, for example:
<Property displayNameID="Element.ReportItem.language" name="language" since="4.3" type="string"/>
The rom.def file specifies the following kinds of metadata:
*Choice
Choice specifies all the allowable values that an attribute can have. Most choice definitions relate to style attributes. The following example from rom.def defines all the allowable font families available to a fontFamily style specification:
<ChoiceType name="fontFamily">
<Choice displayNameID="Choices.fontFamily.serif" name="serif" />
<Choice displayNameID="Choices.fontFamily.sans-serif" name="sans-serif" />
<Choice displayNameID="Choices.fontFamily.cursive" name="cursive" />
<Choice displayNameID="Choices.fontFamily.fantasy" name="fantasy" />
<Choice displayNameID="Choices.fontFamily.monospace" name="monospace" />
</ChoiceType>
*Class
Class defines a Java class that a report designer application can access using the BIRT model API. Class definitions describe the following component types:
*Data types, such as Array, Number, and String
*Functional classes, such as Global, Math, and RegExp
A class definition defines attributes, constructors, localization, members, and methods identifiers. The following example from rom.def shows part of the definition of the Number class:
<Class displayNameID="Class.Number" name="Number"
native="true" toolTipID="Class.Number.toolTip">
<Constructor displayNameID="Class.Number.Number" name="Number" returnType="Number" toolTipID="Class.Number.Number.toolTip">
<Argument name="value" tagID="Class.Number.Number.value" type="Object"/>
</Constructor>
<Member dataType="number" displayNameID="Class.Number.MAX_VALUE" isStatic="true" name="MAX_VALUE" toolTipID="Class.Number.MAX_VALUE.toolTip"/>
<Member dataType="number" displayNameID="Class.Number.MIN_VALUE" isStatic="true" name="MIN_VALUE" toolTipID="Class.Number.MIN_VALUE.toolTip"/>
...
<Method displayNameID="Class.Number.toExponential" name="toExponential" returnType="String" toolTipID="Class.Number.toExponential.toolTip" >
<Argument name="digits" tagID="Class.Number.toExpoential.digits" type="number"/>
</Method>
<Method displayNameID="Class.Number.toFixed" name="toFixed" returnType="String"
toolTipID="Class.Number.toFixed.toolTip">
<Argument name="digits"
tagID="Class.Number.toFixed.digits" type="number"/>
</Method>
...
</Class>
*Element
The rom.def file contains an element definition for every ROM element. Every element definition includes attributes, such as the element’s name, display name, and the element type that it extends. ROM supports methods, properties, property visibility, slot, and style properties in an element definition. The following example from the rom.def file illustrates an element definition:
<Element allowsUserProperties="true" canExtend="true" displayNameID="Element.Parameter" extends="ReportElement" hasStyle="false" isAbstract="true" isNameRequired="true" name="Parameter" nameSpace="parameter" since="1.0">
<Property displayNameID="Element.Parameter.helpText" name="helpText" runtimeSettable="false" since="1.0" type="string"/>
<Property displayNameID="Element.Parameter.helpTextID" name="helpTextID" type="resourceKey"/>
<Property displayNameID="Element.Parameter.promptText" name="promptText" runtimeSettable="false" since="2.0" type="string"/>
<Property displayNameID="Element.Parameter.promptTextID" name="promptTextID" since="2.1" type="resourceKey"/>
<Property displayNameID="Element.Parameter.hidden" name="hidden" runtimeSettable="false" since="1.0" type="boolean">
<Default>false</Default>
</Property>
<Method context="factory" displayNameID="Element.Parameter.validate"
name="validate" returnType="boolean" since="2.5" toolTipID="Element.Parameter.validate.toolTip">
<Argument name="reportContext" tagID="Element.Parameter.validate.reportContext" type="org.eclipse.birt.report.engine.api.script
.IReportContext"/>
</Method>
</Element>
PropertyVisibility specifies whether BIRT exposes an inherited property to the user interface. For example, the label element extends ReportItem, which has dataSet and dataBindingRef properties. Because a label does not bind data, a property inherited by a label element must not appear visible to a user. The following example shows the use of property visibility to hide these properties:
<Element canExtend="true" displayNameID="Element.Label" extends="ReportItem" isAbstract="false" javaClass="org.eclipse.birt.report.model.elements.Label" name="Label" selector="label" since="1.0" xmlName="label">
...
<PropertyVisibility name="dataSet" visibility="hide"/>
<PropertyVisibility name="dataBindingRef" visibility="hide"/>
...
</Element>
Slot defines the element as a container and specifies the types of items that the slot contains. Slots appear in the user interface in BIRT views such as Outline. The following example illustrates a slot definition:
<Element allowsUserProperties="true" canExtend="true" displayNameID="Element.CascadingParameterGroup" extends="ParameterGroup" hasStyle="false" isAbstract="false" isNameRequired="true" javaClass="org.eclipse.birt.report
.model.elements.CascadingParameterGroup" name="CascadingParameterGroup" since="2.0" xmlName="cascading-parameter-group">
...
<Slot displayNameID="Element.CascadingParameterGroup.slot
.parameters" multipleCardinality="true" name="parameters"
since="2.0" xmlName="parameters">
<Type name="ScalarParameter"/>
<Trigger validator="CascadingParameterTypeValidator"/>
</Slot>
</Element>
StyleProperty defines the style components supported by the ROM element. The following example illustrates style property definitions for the data element. The label element definition does not have these style properties because it contains only string values, not numbers.
<Element allowsUserProperties="true" canExtend="true" displayNameID="Element.Data" extends="ReportItem" hasStyle="true" isAbstract="false" isNameRequired="false" javaClass="org.eclipse.birt.report.model.elements.DataItem" name="Data" selector="data" since="1.0" xmlName="data">
...
<StyleProperty name="numberFormat"/>
<StyleProperty name="numberAlign"/>
...
</Element>
*Structure
Structure is a complex data type that typically consists of two or more members. A few structures that are candidates for future expansion have only a single member. The following example from the rom.def file illustrates the definition of a structure.
<Structure displayNameID="Structure.TimeInterval" name="TimeInterval" since="2.5.2">
<Member displayNameID="Structure.TimeInterval.measure" isIntrinsic="true" name="measure" since="2.5.2" type="integer"/>
<Member detailType="interval"
displayNameID="Structure.TimeInterval.unit"
isIntrinsic="true" name="unit" since="2.5.2"
type="choice">
<Allowed>hour,minute,second</Allowed>
</Member>
</Structure>
*Style
Style contains the least information of any type of metadata described in rom.def. A style definition defines the name of the style, its display name, and a reference value, as shown in the following example.
<Style displayNameID="Style.Report" name="report" reference="Overall default" />
*Validator
A validator definition specifies a Java class with which to do validation. Two of the validator classes are for validating values. The rest are semantic validators. The following example from rom.def illustrates a SemanticValidator definition.
<SemanticValidator class="org.eclipse.birt.report.model.api.validators
.CascadingParameterTypeValidator" modules="design, library"
name="CascadingParameterTypeValidator" />