Examples
This is a simple example of the famous "Hello world" written in concrete user interface (cui).All UsiXML files must begin by
<?xml version="1.0" encoding="UTF-8"?>
<uiModel xmlns="http://www.usixml.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.usixml.org/ http://www.usixml.org/spec/UsiXML.xsd"
id="file_id" name="project name"
creationDate="creation date" schemaVersion="1.8.0">
After that, you have to place the header. In this header, you have to write the version of your file, the author name and optionally some comments.
<head>
<version modifDate="modification date">1</version>
<authorName>Your name</authorName>
<comment>Some comment</comment>
<comment>Another comment</comment>
</head>
We can now add the CuiModel. In the Hello world example, we add a single window with a gridBagBox box in it. In our example, we want to translate the Hello world in english and french.
<cuiModel id="id" name="id">
<window id="id" name="name" content="xpath to translation"
defaultContent="default content" width="integer" height="integer">
<gridBagBox id="id" name="name" gridHeight="integer" gridWidth="integer"/>
</window>
</cuiModel>
And finally, we add the contextModel and resourceModel.
<contextModel id="id" name="name">
<context id="id" name="name">
<userStereotype id="id" language="en_US" stereotypeName="name"/>
<platform id="id" name="name"/>
<environment id="id" name="name"/>
</context>
<context id="id" name="name">
<userStereotype id="id" language="fr_FR" stereotypeName="name"/>
<platform id="id" name="name"/>
<environment id="id" name="name"/>
</context>
</contextModel>
<resourceModel id="id" name="id">
<cioRef cioId="id of the cio">
<resource content="French translation" contextId="context fr_FR"/>
<resource content="English translation" contextId="context en_US"/>
</cioRef>
</resourceModel>
the complete example is
<?xml version="1.0" encoding="UTF-8"?>
<uiModel xmlns="http://www.usixml.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.usixml.org/ http://www.usixml.org/spec/UsiXML-ui_model.xsd"
id="hello_world_12" name="hello world"
creationDate="2007-02-12T14:31:45.143+01:00" schemaVersion="1.8.0">
<head>
<version modifDate="2007-02-12T14:31:45.143+01:00">1</version>
<authorName>Benjamin Michotte</authorName>
<comment>Hello World example</comment>
</head>
<cuiModel id="hello_world-cui_12" name="hello world-cui">
<window id="window_component_0" name="window_component_0"
content="/uiModel/resourceModel/cioRef[@cioId='window_component_0']/resource/@content"
defaultContent="Hello world" width="470" height="255">
<gridBagBox id="grid_bag_box_1" name="grid_bag_box_1"
gridHeight="12" gridWidth="23"/>
</window>
</cuiModel>
<contextModel id="hello_world-contextModel_12" name="hello world-contextModel">
<context id="hello_world-context-en_US_12" name="hello world-context-en_US">
<userStereotype id="hello_world-sten_US_12" language="en_US"
stereotypeName="hello world-sten_US"/>
<platform id="hello_world-platform_12" name="hello world-platform"/>
<environment id="hello_world-env_12" name="hello world-env"/>
</context>
<context id="hello_world-context-fr_FR_12" name="hello world-context-fr_FR">
<userStereotype id="hello_world-stfr_FR_12" language="fr_FR"
stereotypeName="hello world-stfr_FR"/>
<platform id="hello_world-platform_12" name="hello world-platform"/>
<environment id="hello_world-env_12" name="hello world-env"/>
</context>
</contextModel>
<resourceModel id="hello_world-res_12" name="hello world-res">
<cioRef cioId="window_component_0">
<resource content="Bonjour le monde" contextId="hello_world-context-fr_FR_12"/>
<resource content="Hello world" contextId="hello_world-context-en_US_12"/>
</cioRef>
</resourceModel>
</uiModel>
And the result

More complex example
We can create a simple login window. This window will also translated in english and french.
In our gridBagBox, we want to add two labels (login and password), two text fields (login field and password field) and two buttons to login and cancel.
gridBagBox accept only constraint node. A constraint allows the developper to place a component at a certain coordinate using a grid.
<constraint gridx="integer" gridy="integer" gridwidth="integer" gridheight="integer">
<usixml component />
</constraint>
The widgets we want to add are outputText, inputText and button.
UsiXML widgets are those form
<usixml_widget id="id" name="name" [optional attributes] />
For instance:
<outputText id="id" name="your name"
content="xpath" defaultContent="Your name" isVisible="true"
isBold="true" textColor="#000000"/>
<outputText id="id" name="your password"
content="xpath" defaultContent="Your password" isVisible="true"
isBold="true" textColor="#000000"/>
<inputText id="id" name="login" maxLength="50" numberOfColumns="15"
isEditable="true"/>
<inputText id="id" name="password" maxLength="50" numberOfColumns="15"
isEditable="true" isPassword="true"/>
<button id="id" name="connect" content="xpath" defaultContent="Login"/>
<button id="id" name="cancel" content="xpath" defaultContent="Cancel"/>
We can now place those widgets.
<constraint gridx="1" gridy="1" gridwidth="8" gridheight="1">
<outputText id="output_text_component_6" name="output_text_component_6"
content="/uiModel/resourceModel/cioRef[@cioId='output_text_component_6']/resource/@content"
defaultContent="Your name" isVisible="true" isEnabled="true" isBold="true"
textColor="#000000"/>
</constraint>
<constraint gridx="1" gridy="2" gridwidth="8" gridheight="1">
<outputText id="output_text_component_7" name="output_text_component_7"
content="/uiModel/resourceModel/cioRef[@cioId='output_text_component_7']/resource/@content"
defaultContent="Your password" isVisible="true" isEnabled="true" isBold="true"
textColor="#000000"/>
</constraint>
<constraint gridx="9" gridy="1" gridwidth="8" gridheight="1">
<inputText id="input_text_component_8" name="input_text_component_8" isVisible="true"
isEnabled="true" textColor="#000000" maxLength="50" numberOfColumns="15" isEditable="true"/>
</constraint>
<constraint gridx="9" gridy="2" gridwidth="8" gridheight="1">
<inputText id="input_text_component_9" name="input_text_component_9" isVisible="true"
isEnabled="true" textColor="#000000" maxLength="50" numberOfColumns="15"
isPassword="true" isEditable="true"/>
</constraint>
<constraint gridx="6" gridy="4" gridwidth="5" gridheight="1">
<button id="button_component_10" name="button_component_10"
content="/uiModel/resourceModel/cioRef[@cioId='button_component_10']/resource/@content"
defaultContent="Login" isVisible="true" isEnabled="true" textColor="#000000"/>
</constraint>
<constraint gridx="12" gridy="4" gridwidth="5" gridheight="1">
<button id="button_component_11" name="button_component_11"
content="/uiModel/resourceModel/cioRef[@cioId='button_component_11']/resource/@content"
defaultContent="Cancel" isVisible="true" isEnabled="true" textColor="#000000"/>
</constraint>
And the result will be


