- 1 Overview
- 2 Install the basic modeling tool
- 3 Start create properties view for basic modeling tool
- 4 Create a Properties View Description
- 5 Add Widgets to the Group Person
This tutorial explains how to create your first properties view with Sirius.
The instructions start from the result of the Sirius Starter Tutorial, a basic modeling tool which simply allows the user to graphically represent men and women of a family and to create new men.
The advanced modeling tool that you will create is based on the same simple Domain Model which describes basic concepts about families.
Note: If you need to learn how to define such a Domain Model, just follow the Domain Model tutorial
Note: The screenshots have been created with Obeo Designer 8.1 (based on Sirius 3.1).
Install the basic modeling tool
If you have followed the Starter Tutorial already, you are ready! Directly go to next section: Start extending the basic modeling tool.
Otherwise, start by following the instructions to install the sample Domain Model:
- Import the projects containing the sample Domain Model
- Launch a new runtime from your Eclipse
- Select the Sirius perspective
- Import a sample model
Now, you should have an Eclipse runtime (started from your first Eclipse) with a sample Family model installed in your workspace.
Then, install the solution of the Starter Tutorial. It is implemented by a Viewpoint Specification Project that you need to import into your workspace.
This project can be easily installed from the provided examples (menu File > New > Example... : select Basic Family Sample Modeler Definition).
Once the modeler imported in your workspace, activate the persons viewpoint by selecting the menu Viewpoint Selection.
You must activate the persons viewpoint to be able to create the representations which are defined by this viewpoint.
Then right-click on the sample model and select the menu New Representation / new Persons diagram.
Sirius should create and open a diagram describing the men and women contained in the sample model.
Start create properties view for basic modeling tool
Let’s start creating your frist properties view.
In this tutorial, we will create a custom properties view.
The sample model imported previously will be used to test this editor.
Create a Properties View Description
The Properties View Description is available from the Viewpoint directory
The Properties View Description is composed of a Page and a Group. The page corresponding to the tab of the properties view. The group corresponding to the part in the tab of the properies view.
By default a Page and a Group is created in the Properties View Description. In the tab Advanced of the Properties View Description inform the Identifier field
Inform the fields of the Page
Inform the fields of the Group
Add Widgets to the Group Person
Create a new Text widget in the Group Person to display the name of the persons.
Add a begin in the Widget Text and create a Set to can modify person's name
Add A Conditional Style in the Widget Text to check the name is not empty. If the name is empty the backgrounf field change to red. Add a Style in the Conditional Style.
The result should be
If you delete the name of "Lea" the field is filled in red
We create a container to display a selection list of father and mother on the same line
Add a Fill Layout with HORIZONTAL properties check
Create a new Select Widget to allow change relation mother
Create a Begin and add it a Set to enabled to final user to change reference mother from a selection list
Create a style to change the selection label foreground
Do the same thing for relation father. The result should be
Create a Container for display properties for children Add A Fill Layout Horizontal as previously.
Create in the container a new Checkbox widget
Create a Begin and in, an If operation with value "aql:newValue=false" After we use a Switch for the 2 cases Man and Woman
For each children
Unset the relation mother
Do same thing for relation father.
Create a Select widget to add potential child to the selected person
Create a Begin and add it a Set Operation
Result of children container
Create a List to display children of selected person
Create an Action to add a button to the List. This button allow to create a new son to the selected person
Create a Begin and add a change context to call the service createSon
Do the same thing for createDaughter
Create an Action to unset the relation children. For this case we should manage case for Woman and Man
Do the same thing to unset a son
Create a container to display number of sisters and brothers This container is named "Sister&Brother"
Create a Label widget to display number of sisters
Create a style to display the number of sister in gray if number of sister equals 0
Create a conditional Style to display number of sister in purple if number od sister is greater than 0
Do the same thing for number of brother
Widget Radio Button
Create a Radio button to display the type (Woman of Man) of the selected person
The group validation enabled to define validation rules for properties view