|
|
![]() |
|
|||||
|
|||||||
|
|
|||||||
|
Proposal for UIML2 Shorthand Send comments to Marc
Abrams 11 October 2000 Abstract Describing a user interface in UIML2 can produce fairly verbose documents, compared to other markup languages (e.g., HTML). Proposed here is a shorthand notation called UIML2 Shorthand that can be mechanically mapped to UIML2. Motivation The reason that UIML2 can be verbose is illustrated by the following <structure> element, which creates a Java AWT Frame containing a Java AWT Label: <structure> <part name="TopHello" class="Frame"> <style> <property name="rendering">Frame</property> <property name="title">Example UI</property> <property name="resizable">true</property> <property name="layout">java.awt.FlowLayout</property> <property name="background">blue</property> <property name="foreground">white</property> <property name="size">500,100</property> <property name="location">100,100</property> </style> <part name="L" class="Label"> <style> <property name="text">Sample label.</property> </style> </part> </part> <structure> The fragment above requires 12 lines to describe the Frame, and 5 lines to describe the label. Moreover, for complex documents requiring many interface components, the <structure> element can become difficult to read. Proposed Syntax for UIML2 Shorthand The same example in UIML2 Shorthand would look like this: <structure> <Frame name="TopHello" title="Example UI" resizable="true" layout="java.awt.FlowLayout" background="blue" foreground="white" size="500,100" location="100,100"> <Label name="L" text="Sample label."/> </Frame> <structure> The syntax above has several advantages over the original UIML2 syntax:
Specification of Transformation Rules A UIML2 Shorthand document must satisfy the following requirements.
<C name="N" P1="V1" ... Pn="Vn"> ... </C> the equivalent UIML2 fragment is <part class="C" name="N"> <style> <property name="P1">V1</property> ... <property name="Pn">Vn</property> </style> ... </part> Equivalency of UIML2 Shorthand and UIML2 Documents A UIML2 document containing a <part> with a class attribute of "part" cannot be represented as a UIML2 Shorthand document (due to item 3 in section "Specification of Transformation Rules"). Otherwise, all UIML2 documents have an equivalent representation in UIML2 Shorthand, and vice versa. UIML2 Shorthand to UIML2 Converter To use UIML2 Shorthand, one requires a converter program. The program reads a UIML2 Shorthand document as input, validates the document if a DTD or XML Schema is present in the input file, translates the document to the UIML2 syntax, and writes a UIML2 document as output. A converter program must include in the output UIML2 document the name of the DTD or XML Schema whose syntax is used by the converter (e.g., http://uiml.org/dtd/UIML2_0d.dtd). Use of DTDs and XML Schemas with UIML2 Shorthand There is no fixed set of tags used within the <structure> element of a UIML2 Shorthand document. Consequently it is impossible to create a single DTD or XML Schema to be named in a UIML2 Shorthand document. The reason is that the UIML2 language is always used with a vocabulary defined outside UIML2. For example, there are vocabularies for Java JFC, HTML, WML, generic toolsets, and so on. Each vocabulary specifies possible values for the class attribute of the part element in UIML2. For example, a vocabulary for Java JFC might include class names of "Frame," "Menu," and "List." In UIML2 Shorthand, these class names become elements <Frame>, <Menu>, and <List>. Any DTD or XML Schema used with UIML2 Shorthand would therefore be dependent on the vocabulary used with UIML2. Given this, one way to use UIML2 Shorthand is to create a DTD or XML Schema for every vocabulary proposed for UIML2. A UIML2 Shorthand file can then include the proper DTD or XML Schema file, and the converter program (see "UIML2 Shorthand to UIML2 Converter" above) could then validate the UIML2 Shorthand file. Note that a single UIML2 Shorthand document might use multiple vocabularies. For example, one UIML2 Shorthand document might be designed to render to HTML and WML, and therefore use both the HTML and WML vocabularies. In this case one would have to use a DTD or XML Schema that was the union of the DTDs or XML Schemas for the HTML and WML vocabularies. © 1999-2001 UIML.org (all rights reserved) |