BIRT Report Object Model - ROM
BIRT Report Object Model - ROM
Functional Specification
Draft 8: July 18, 2005
Abstract
Document Revisions
-1-
Functional Specification ROM Styles
Contents
1. Introduction .............................................................................................................................................
1.1 Motivation .................................................................................................... 4
1.2 Style............................................................................................................. 4
1.3 Terminology................................................................................................. 5
1.4 Overview...................................................................................................... 5
1.5 BIRT and CSS ............................................................................................. 6
1.6 Cascading Style Sheets (CSS) and XML-FO.............................................. 6
1.7 UI Considerations ........................................................................................ 7
2. Selectors ..................................................................................................................................................
2.1 Background ................................................................................................. 7
2.2 Style Selection in ROM................................................................................ 8
2.3 Predefined Style Names (Selectors) ........................................................... 8
2.3.1 Note on HTML Rendering...........................................................................................................
2.3.2 UI Considerations .......................................................................................................................
2.4 Pseudo-Selectors ...................................................................................... 11
2.5 Named Styles ............................................................................................ 12
3. Style Cascade................................................................................................................................
3.1 Style Search .............................................................................................. 13
3.1.1 Highlight Property Search...........................................................................................................
3.1.2 Highlight Rule Search .................................................................................................................
3.1.3 Style Property Search .................................................................................................................
3.1.4 Initial Values................................................................................................................................
3.1.5 Alternative Algorithm...................................................................................................................
4. Formatting Model ................................................................................................................................
4.1 Block-Level Elements ................................................................................ 16
4.2 In-line Elements......................................................................................... 17
4.3 Font Matching............................................................................................ 17
4.4 Unsupported Features............................................................................... 17
5. Style Definition ................................................................................................................................
5.1 The Style Sheet ......................................................................................... 17
5.2 Style Properties ......................................................................................... 17
5.2.1 Unsupported CSS properties................................................................................................
5.3 Style Element ............................................................................................ 18
5.4 Font Properties .......................................................................................... 21
5.4.1 fontFamily Property ..............................................................................................................
5.4.2 fontStyle Property.................................................................................................................
5.4.3 fontVariant Property ............................................................................................................
5.4.4 fontWeight Property ..............................................................................................................
5.4.5 fontSize Property ...................................................................................................................
5.4.6 color Property .........................................................................................................................
5.5 Background Properties .............................................................................. 27
5.5.1 backgroundColor Property................................................................................................
5.5.2 backgroundImage Property................................................................................................
5.5.3 backgroundRepeat Property ................................................................................................
5.5.4 backgroundAttachment Property.........................................................................................
5.5.5 backgroundPositionX Property ...........................................................................................
5.5.6 backgroundPositionY Property ...........................................................................................
5.6 Text Properties .......................................................................................... 31
5.6.1 wordSpacing Property ............................................................................................................
5.6.2 letterSpacing Property ................................................................................................
-2-
Functional Specification ROM Styles
-3-
Functional Specification ROM Styles
1. Introduction
1
CSS was selected as the basis for the style system for a number of
reasons. First, CSS is a public specification. Second, the people who
use BIRT, are assumed to understand web technology and hence may
already understand CSS. Third, many CSS books exist, making
information about CSS readily available to users. Finally, our target
output formats are HTML and FO, both of which are closely associated
with CSS.
2
The current CSS version at W3C is CSS 2.1, and CSS 3 is under
review. However, Internet Explorer supports only CSS 1. Since IE
accounts for the lion’s share of the browser market, prudence suggests
that we limit our support to only that which IE supports, plus those
portions of CSS 2.1 that deal with print and are supported by XML-FO.
-4-
Functional Specification ROM Styles
1.4 Overview
The developer can apply style to report items in one of several
ways:
• Allow the element to inherit style properties from its container.
• Define a style that matches all elements of a given type or in a
given context.
• Explicitly identify the style to be used for an element.
-5-
Functional Specification ROM Styles
-6-
Functional Specification ROM Styles
1.7 UI Considerations
Some aspects of the CSS specification reflect its history as a text-
based system instead of one designed for a GUI environment.
This specification points out areas that are likely to be the most
difficult for the UI. These sections are only suggestions; there is
no guarantee that the assessment is complete or accurate.
One key consideration is that many CSS properties provide both
a set of CSS-defined values along with the option to specify
additional values. (See font-family.) Some properties allow lists of
values. (Again, see font-family.) Some attributes cannot be set
directly, bur rather only in conjunction with other attributes. This
means that the UI must somehow link these properties to prevent
the user from setting them in a way that cannot be expressed in
CSS. (See the border properties: one cannot specify the style,
color and width of one border independently of other border
attributes.)
The UI may choose to ignore some CSS properties in the first
release. For example, word-spacing and char-spacing would be
seldom used in reports. The user an see the effect of these
properties by previewing the report in HTML.
2. Selectors
-7-
Functional Specification ROM Styles
-8-
Functional Specification ROM Styles
the style name. For example, to select a list, use the “list” style.
To select a list header, use the “list-header” style.
Unlike CSS, ROM does not allow style selectors to select arbitrary
document structures. For example, one cannot select “list header
table footer” to apply style to a table footer, but only when it
appears inside a list header. This simplification is adopted
because of the difference between reports and web documents.
Web documents can be arbitrarily complex and are often
generated automatically. Reports, however, tend to be created by
hand. (Report instances, however, are automatically generated.)
For example, a style sheet writer may choose to apply certain
style to top-level headers, another to second level headers. The
style applies to any content in the headers. The same style sheet
can apply to existing reports, new reports, and even reports
created on the web because the style applies to report structure,
not specific content.
Developers specify styles for the entire report using the “report”
selector. Developers then apply formatting to specific bits of the
report by using detailed selectors. See the “Cascade” section
below for details on which styles apply to a given element.
The following is a list of the supported selectors. The list was
created by creating a selector for each element, for each of the
slots that is identical in Table and List, and for each of the
element/slot combinations for any element that has multiple slots.
Finally, additional styles were defined for elements with internal
structure, such as charts.
Selector Description
report Overall default
list List. Applies to all slots within the
list.
group-header-n List or table group header for level n
group-footer-n List or table group footer for level n
list-header List header
list-footer List footer
list-group-header-n List group header for level n
list-group-footer-n List group footer for level n
list-detail List Detail
table-header Table Header
table-footer Table Footer
table-group-header-n Table Group Header n
table-group-footer-n Table Group Footer n
-9-
Functional Specification ROM Styles
Selector Description
table-column-header Table Column Header
table-detail Table Detail
page Master page
matrix Matrix
matrix-row-header-n Matrix row headers 1 through 9
matrix-row-footer-n Matrix row footers 1 though 9
matrix-column-header-n Matrix column headers 1 though 9
matrix-column-footer-n Matrix column footers 1 though 9
matrix-cell Matrix cell
chart Chart
chart-title Chart Title
chart-legend Chart Legend
chart-value Chart Value Label
chart-axis Chart Axis Label
label Label item
number Data item that displays a number
date Data item that displays a date or
time
string Data item that displays a string
text Text item
grid Grid item
toc Table-of-contents item
toc-n TOC level n
free-form Free-form item
line Line item
rectangle Rectangle item
extended-item Extended item
- 10 -
Functional Specification ROM Styles
2.3.2 UI Considerations
BIRT may provide a New Report Wizard to create reports. Such a
wizard, if provided, will generate a report complete with formatting
for titles, group headers, detail, and more. Advanced developers
often want to customize this formatting to match a visual format
defined by that particular company. The selectors above make
this task easy. The developer simply creates a style sheet that
customizes these styles. The result is that the look of the wizard-
generated report will follow the customer-defined styles.
2.4 Pseudo-Selectors
BIRT supports two kinds of CSS pseudo-selectors: link pseudo
selectors and :first-line/:first-letter pseudo selectors. Link pseudo
selectors include :link, :visited, :active, and :hover. Pseudo link
selectors apply only to HTML pages shown in a browser. They do
not apply to other forms of output such as print, PDF, etc.
Such pseudo-selectors do not apply to printed output.
BIRT defines and applies pseudo-selectors as follows:
• Define a “base” style (or class in term of CSS).
• Define optional pseudo-styles. Assume the base style is
named X, the pseudo-styles should be named as X:first-letter,
and X:first-line or X:visited, X:link, X:hover, or X:active.
• At report design time, a report element only refers to the “base”
style.
• The Presentation Engine copies base and pseudo styles into
the HTML output. The pseudo styles automatically apply to all
contents or links that uses the base style.
Customers can use the :first-line/:first-letter pseudo selectors to
achieve textual or typographical effects that are frequently seen in
printed materials. Customers who have a standard for how links
should look on their web site can use the above feature to ensure
that their reports use the same look as the rest of the site.
For example, suppose that you have a project standard that links
are to appear green, and visited links are to appear in navy. You
would define the following styles:
• report is the overall default style for the report.
• report:link gives the formatting for unvisited links, in this
case green. (This is equivalent to the :link style in CSS.)
• report:visited gives the formatting for visited links, in this
case navy. (This is equivalent to the :visited style in CSS.)
You can also create a specialized style to apply these rules
selectively. Specifically, the appearance of link(s) can be
customized in group or on a link-by-link basis. Assume that style
X has pseudo link styles defined, and a table (text item) uses style
- 11 -
Functional Specification ROM Styles
X, then all links in the table (or embedded in the HTML/RTF text)
are selected by the pseudo selectors. If a label or data item uses
style X and defines a hyperlink, then the hyperlink is selected by
the pseudo selectors.
Only text and multi-line data items observe the :first-line/:first-
letter pseudo selectors. Because neither report item is a
container, inheritance through containment hierarchy is moot. Link
pseudo selectors, however, supports style property inheritance
through element and containment hierarchy.
Only a subset of the style properties is allowed to appear in each
pseudo style. See CSS specification for more detail. Pseudo-
selectors support is not available in the first-release of BIRT.
2.5 Named Styles
HTML provides the “class” attribute to associate an HTML
element with a specific style. BIRT provides a similar concept
called “style.”3 This attribute works identically to the HTML/CSS
feature: it can be used to associate an element to a specific style.
ROM uses a simplified version of the CSS class selection model.
ROM styles are named and either match one of the predefined
names above (and act as a selector), or have a user-defined
name that corresponds to an HTML class.
For example, an element may reference the “important” style. The
report would then contain a style called “important”.
3. Style Cascade
3
BIRT uses the term “class” for other purposes: referring to Java code
attached to a report element. Hence, BIRT uses “style” to associate an
element with a style.
- 12 -
Functional Specification ROM Styles
- 13 -
Functional Specification ROM Styles
- 14 -
Functional Specification ROM Styles
- 15 -
Functional Specification ROM Styles
The property detail shows the set of initial value for each property.
This information is taken from Appendix F of the CSS 2.1
specification (http://www.w3.org/TR/CSS21/propidx.html).
3.1.5 Alternative Algorithm
Note that, in the Design Engine, steps 1-3 cannot be done, as
items do not yet have actual data values. Note also that the
Presentation Engine the actual implementation algorithm may be
different. For example, the Presentation Engine can achieve the
same results by working with sets of properties:
• Create a list that contains properties as name/value pairs.
• Traverse to the most-base element. Copy all its properties into
the property list.
• Repeat with each child element down though the inheritance
hierarchy.
• If the element has a style selector, copy that style’s properties
into the list.
• If the element has private style properties, copy those into the
list.
• If the element has an associated highlight rule, copy the rule’s
properties into the list.
The result of this is a list that contains all properties that apply to
this item specifically. Such properties would override any
properties inherited by context though containment. Note also that
later steps in the above algorithm replace values found in earlier
steps. The net result is that any given property takes the same
value in the above batch algorithm as it does from using steps 1-7
above in the property-by-property algorithm.
4. Formatting Model
The ROM formatting model follows that of CSS. BIRT defers most
formatting to the browser or FO processor. Hence, the CSS user
agent (UA) will do the actual visual formatting, and so all
formatting must be expressed in a form that can be passed, via
CSS, to the UA.
See the CSS1 specification for an explanation of the formatting
model. This section discusses formatting issues unique to BIRT.
4.1 Block-Level Elements
ROM uses the term “section” and “subsection” to identify top-level
content within the report. By default, all sections and subsection
are block-level elements. Block-level elements have an implied
line break before and after the element. For example, when a
chart appears as a section, BIRT will put the chart on a line by
itself.
- 16 -
Functional Specification ROM Styles
5. Style Definition
- 17 -
Functional Specification ROM Styles
• list-style-position
• list-style
• height, width: These are element properties in ROM, not style
properties.
• clear
The user can define CSS properties that are passed though to the
browser. If a style contains an unsupported CSS property, then
that style is included with the style when sent to the browser,
though it will not appear in the BIRT UI.
5.3 Style Element
A BIRT report can define “shared” styles. Every style must have a
name, and that name must be unique with the report design.
Summary
- 18 -
Functional Specification ROM Styles
backgroundRepeat
TBD.
borderTopColor
borderLeftColor
borderBottomColor
borderRightColor
Sets the color of the border. Implements the CSS border-color
property.
borderTopStyle
borderLeftStyle
borderBottomStyle
borderRightStyle
The line style of the border. Implements the CSS border-style
property.
borderTopWidth
borderLeftWidth
borderBottomWidth
borderRightWidth
The width of the border.
can-shrink
Whether an item can shrink based on its contents.
color
Foreground color, usually for text.
dateTimeFormat
The display format for date/time values displayed in a data
item.
display
Specifies if a top-level element should be a block or in-line
element.
fontFamily
The font family name: user defined or a CSS generic family.
fontSize
The size (height) of the text.
fontStyle
Normal or italic.
fontVariant
Normal or small caps.
- 19 -
Functional Specification ROM Styles
fontWeight
Level of “boldness.”
highlight
Rules for changing the visual formatting of data items based
on a data value.
letterSpacing
The spacing between individual letters.
lineHeight
Height of a line. Implies spacing between lines.
map
Provides a mechanism for mapping internal database values
to user-visible display values.
marginTop
marginLeft
marginBottom
marginRight
Provides spacing between paragraphs in text, and around
block-level content.
masterPage
If the item starts a new page, this property selects the master
page to display.
numberFormat
The format string to apply to data items that display numbers.
orphans
Controls whether orphans appear on a page.
paddingTop
paddingLeft
paddingBottom
paddingRight
The amount of space between the border and the contents of
a report item.
pageBreakAfter
Causes a page break before the report item.
pageBreakBefore
Causes a page break after the report item.
pageBreakInside
Causes a page break between detail items of a list.
- 20 -
Functional Specification ROM Styles
showIfBlank
If false, hides a data item if it is blank.
stringFormat
The format string to apply to string data shown in a data item.
textAlign
How to align the text: left, center or right.
textDecoration
TBD.
textUnderline
Part of implementation of CSS text-decoration.
textOverline
Part of implementation of CSS text-decoration.
textLineThrough
Part of implementation of CSS text-decoration.
textIndent
The indentation for text within a Text or Multi-line text item.
textTransform
Transforms for text such as all-upper case.
verticalAlign
The vertical alignment: top, middle or bottom.
whiteSpace
Whether to ignore or keep white space in a Text or Multi-Line
text item formatted in HTML.
widows
Whether to suppress widows in pagination
wordSpacing
The amount of spacing between words.
5.4 Font Properties
The next several sections discuss the various style properties.
Subsections describe the properties in detail using the information
from the CSS 1 spec where applicable. See the CSS 1
specification for a description of the syntax used to describe
values.
5.4.1 fontFamily Property
The font name: a user-defined name or a CSS-defined name.
Summary
- 21 -
Functional Specification ROM Styles
Choices
- 22 -
Functional Specification ROM Styles
Choices
Description
- 23 -
Functional Specification ROM Styles
Choices
Description
- 24 -
Functional Specification ROM Styles
Choices
Description
- 25 -
Functional Specification ROM Styles
Choices
Description
- 26 -
Functional Specification ROM Styles
Description
Description
- 27 -
Functional Specification ROM Styles
Description
- 28 -
Functional Specification ROM Styles
- 29 -
Functional Specification ROM Styles
Description
- 30 -
Functional Specification ROM Styles
- 31 -
Functional Specification ROM Styles
Description
- 32 -
Functional Specification ROM Styles
- 33 -
Functional Specification ROM Styles
- 34 -
Functional Specification ROM Styles
- 35 -
Functional Specification ROM Styles
Description
- 36 -
Functional Specification ROM Styles
Display name Margin Top, Margin Right, Margin Bottom Margin Left
Property group Box
Value <length> | <percentage> | auto
Initial 0
Applies to all elements
Cascades no
Percentage values refer to width of the closest block-level ancestor
CSS equivalent
CSS compatibility Defined by CSS 1
CSS section 5.5.1
ROM type Dimension plus extended choice
- 37 -
Functional Specification ROM Styles
Description
Display name Padding Top, Padding Right, Padding Bottom, Padding Left
Property group Box
Value <length> | <percentage>
Initial 0
Applies to all elements
Cascades no
Percentage values refer to width of closest block-level ancestor
CSS equivalent
CSS compatibility Defined by CSS 1
CSS section 5.5.6
ROM type Dimension
JavaScript type String
Settable at runtime Yes
Availability First Release
Display name Border Top Width, Border Left Width, Border Bottom Width,
Border Right Width
Property group Box
- 38 -
Functional Specification ROM Styles
Display name Border Top Color, Border Left Color, Border Bottom Color, Border
Right Color
Property group Box
Value <color>
Initial the value of the 'color' property
Applies to all elements
Cascades no
Percentage values N/A
CSS equivalent border-color
CSS compatibility ROM properties that implement the CSS border-color property
defined in CSS 1.
CSS section 5.5.16
ROM type Color
JavaScript type String
Settable at runtime Yes
Availability First Release
- 39 -
Functional Specification ROM Styles
Description
Display name Border Top Style, Border Left Style, Border Bottom Style, Border
Right Style
Property group Box
Value none | dotted | dashed | solid | double | groove | ridge | inset |
outset
Initial none
Applies to all elements
Cascades no
Percentage values N/A
CSS equivalent border-style
CSS compatibility ROM properties that implement the CSS border-style property
defined in CSS 1.
CSS section 5.5.17
- 40 -
Functional Specification ROM Styles
Description
CSS defines the ‘border-style property to set the line style of the
four borders. Again, ROM prefers to set one attribute with each
property. ROM defines these four properties to implement this
CSS property.
ROM creates the CSS ‘border-style’ property by following rules
similar to those for border-color.
5.8 String, Number and Date/Time Format Properties
The string format rules apply when a data control displays a string
(text) value; the number rules when the data item displays a
numeric value; and the date/time rules when the item displays a
date/time value.
5.8.1 numberFormat Property
Format string applied to numeric results.
Summary
Standard Choices
- 41 -
Functional Specification ROM Styles
Keyword Description
General Returns number in normal number format.
Number
Currency Returns number in currency number format
Percent Returns number in percentage format
Fixed Returns number in decimal format
Scientific Returns in standard scientific notation,
appropriately rounded
Standard Returns with thousands separators and two
digits to the right of the decimal separator.
Description
- 42 -
Functional Specification ROM Styles
- 43 -
Functional Specification ROM Styles
• http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/vblr7/html/vafmtuserdefinednumericformats.asp for
information on Excel formatting.
• http://office.microsoft.com/assistance/hfws.aspx?AssetID=HP0
51986791033&CTT=1&Origin=EC010229841033&QueryID=8
Ax53w4jL0
5.8.2 dateTimeFormat Property
Format string for displaying date/time values.
Summary
Standard Choices
- 44 -
Functional Specification ROM Styles
Description
Description
The following table shows the symbols or characters you can use
to create your own user-defined formats, and the effect of each
symbol on the resulting format string.
- 45 -
Functional Specification ROM Styles
- 46 -
Functional Specification ROM Styles
Choices
- 47 -
Functional Specification ROM Styles
Description
- 48 -
Functional Specification ROM Styles
Description
- 49 -
Functional Specification ROM Styles
Description
- 50 -
Functional Specification ROM Styles
- 51 -
Functional Specification ROM Styles
Description
Description
Show this report item even if it is empty, or all its data elements
are empty. If false, the report item is automatically hidden when
empty.
5.11.2 canShrink Property
Whether a report item shrinks to fit its content.
Summary
- 52 -
Functional Specification ROM Styles
Description
Description
highlightRules Property
5.11.4 highlightRules Property
Conditional formatting rules.
Summary
- 53 -
Functional Specification ROM Styles
Description
highlightTestExpr Property
5.11.5 mapExpr Property
An expression used to map internal values to display values.
Summary
Description
The map rules convert internal values into display values. For
example, a null value can be converted to the string “null” for
display. Or, internal “M” and “F” codes can be converted to “Male”
and “Female” for display.
See Also
mapRules Property
- 54 -
Functional Specification ROM Styles
Description
A map rule transforms a value in the input into a different value for
display. It works best for fields with a limited set of values, such
as converting “Y” to “Yes” and “N” to “No”. Mappings with many
rules are better handled in the data access layer.
Another common use of mapping is to convert a null value into a
display value, such as “No Data.”
If a particular item has both highlight and map rules, the
highlighting rules apply to the original value. Formatting, however,
is applied to the mapped value. The mapped value determines
the type of formatting rule to apply. For example, if a numeric
value of 1 is mapped to “On Order”, then the string formatting
rules will apply to the item.
See Also
mapExpr Property
6. Property Structures
- 55 -
Functional Specification ROM Styles
value1
The value for simple conditions with the operators: <, <=, =,
<>, >=, >, between, not between, like
value2
The value for simple conditions with the operators: between,
not between
style
The name of the style to apply when the condition is met.
Description
- 56 -
Functional Specification ROM Styles
The value for simple conditions with the operators: <, <=, =, <>,
>=, >, between, not between, like
6.1.3 value2 Property
The value for simple conditions with the operators: between, not
between
Summary
The value for simple conditions with the operators: between, not
between
6.1.4 style Property
The name of the style to apply when the condition is met
Summary
- 57 -
Functional Specification ROM Styles
Summary
A map rule is part of the map style property. The map property
defines a test value and a set of map rules. Each map rule
contains a condition that matches the test value, and a value to
display when the rule “triggers.” For example, a set of map rules
for a “gender” database column may map the values null, M, F
into the display values “No data”, “Male” and “Female”.
6.2.1 operator Property
Summary
- 58 -
Functional Specification ROM Styles
The value for simple conditions with the operators: <, <=, =, <>,
>=, >, between, not between, like
6.2.3 value2 Property
The value for simple conditions with the operators: between, not
between
Summary
The value for simple conditions with the operators: between, not
between
6.2.4 display Property
The value to display when the map rule “triggers.”
Summary
- 59 -
Functional Specification ROM Styles
The display value appears when the map rule triggers. The value
is a string and is not further formatted.
- 60 -