Displaying elements from another object
So far, you have limited yourselves to display of data obtained directly from the object of the Properties sheet, the display of other objects only being possible by means of:
- TreeView, which allows display of only the name
- ListView, which limits display to columns of attributes, excluding for example the representation of comments.
You can however display in a page elements from other objects, on condition that there is a MetaAssociationEnd or a query allowing you to reach these objects from the main object.
Two possibilities are available:
- The MetaAssociationEnd (or Query) has maximum cardinality 1.
In this case only one object is visible, and it is possible to include attributes of this object in the same way as for attributes of the main object.
- The MetaAssociationEnd (or Query) accesses a collection of objects. In this case we must have available in the page an element enabling selection of an object from this collection. This object having been selected, elements relating to the attributes of this object can be supplied.
In both cases, you must indicate in page configuration that the element does not relate to the main object, but to another object. To do this, use the Map concept, which will include access to this other object.
Direct display of an associated object
You will first configure a page on the Department MetaClass in which you will include the name and comment of the Firm of the department.
The Firm being unique for a department, you will not require a selector element. To do this, you must:
• declare a Map specifying the browsed element, here the Firm MetaAssociationEnd
Firm=Map(~(hmSXaOYEryC[Firm])
• declare the two elements.
The keyword From(map) indicates which object will use the element.
Name=Item(~210000000900[Nom]),From(Firm)
Comment=Item(~f10000000b20[Comment]),From(Firm),Control(Text)
When the page has been created, you obtain:

When you display the Properties sheet of a Department, you obtain:

Instead of displaying elements of the Firm, you can directly display a Properties page of Firm, for example the Characteristics page.
To do this, you must use an element of SubPage type. The Template becomes:
[Template]
Firm=Map(~(hmSXaOYEryC[Firm])
Page=Item(~ZPhytJ)cE5k1[Firm.Characteristics]),From(Firm),Control(SubPage)
Warning:
In the above example, Firm.Characteristics has an IDabs different from that which you have created. To copy the correct IDAbs:
1. Open the Properties page of the Firm MetaClass.
2. Select the User Interface tab, then the MetaAttributeGroup subtab.
3. Under the MetaPropertyPage folder, copy Firm.Characteristics and paste it in the above Template.
The “Firm” tab now displays the Characteristics page of the Firm.

Displaying an object from a selection
We will now consider the case of a multiple collection; in this case you must be able to select an element from the list. This selection will be made by means of an element.
In this context, the identifier of the collection used to define the Map is not used: the Map is ‘passive' and only knows its current object through the selection. However, by convention we associate with it, if possible, the browsed collection.
A dedicated element enables achievement of this objective: it takes the form of a drop-down list. To declare it, associate it with the browsed collection and the map concerned.
To illustrate this configuration, you will create an Employee page on the Firm MetaClass, enabling display of the Characteristics page of an Employee:
1. You will configure the element which enables selection of the Employee, by means of the Abstract Employee MetaAssociationEnd. In the configuration considered, declare a Map named Employee and its controller:
[Template]
Employee=Map(~f7mZ(UQYEHTI[Abstract Employee])
CurrentEmployee=Item(~f7mZ(UQYEHTI[Abstract Employee]),Remoting(Employee)

• The keyword ‘Remoting' defines the dependency relationship between the ‘Employee' Map and the "CurrentEmployee" element.
• The browsed collection is defined in the CurrentEmployee item; we define the Map by means of the same collection, but this parameter is not used in the Map.
Thus defined, CurrentEmployee is displayed in the following way:

2. You will define the subpage which describes the characteristic page.
There is an additional difficulty here, since you cannot directly cite the absolute identifier of the page to be displayed. In fact:
• the Characteristics page does not physically exist
• above all, the association used being generic, the objects listed can be either Employee or Manager, and the page to be displayed therefore differs according to the object selected
You will use the following specific configuration for the SubPage:
EmployeePage=Item(~UZlkzjxjtO00[Characteristics]),From(Employee),Control(SubPage),Param(Computed,Type)
• The keyword ‘Computed' indicates that the page must be calculated, and therefore that the identifier of the Item() is not a MetaPropertyPage.
• The keyword ‘Type' indicates the calculation mode. In this case, the identifier of Item() is the type to be used: here we request page display of ‘Characteristics' type of the selected object.

Modifying customized page appearance
In previous chapters, we covered the problem of populating Properties pages and specification of their content, leaving the responsibility of organization and appearance of elements to be displayed to page implementation. It is possible that the resulting appearance is not satisfactory in terms of:
- element title
- grouping
- order in which elements appear
- size and position
- displayed control not suitable
These parameters can be redefined to achieve the required appearance.
Modifying element title
For a given element, you can define the presence, position and name of its title, by means of keywords Title and Name.
• The keyword Title enables definition of the presence or position of an element title using parameters Up, Left or No.
• The keyword Name enables definition of the title name. You can directly cite the name to be used, or a system repository occurrence (MetaAttribute, CodeTemplate for example): in this case you can manage multilingualism.
You will apply these configurations to the "Current Employee" element of your previous example, of which the name is not totally satisfactory.
- Deletion of title:
CurrentEmployee=Item(~f7mZ(UQYEHTI[Abstract Employee]),Remoting(Employee),Title(No)

- Renaming ‘static':
CurrentEmployee=Item(~f7mZ(UQYEHTI[Abstract Employee]),Remoting(Employee),Name(Employee)

- Renaming by occurrence:
CurrentEmployee=Item(~f7mZ(UQYEHTI[Abstract Employee]),Remoting(Employee),Name(~ThmSy)NYEzzB[Employee])
Here the title ‘Employee' is calculated from the name of the ~ThmSy)NYEzzB[Employee] - system object, in this case the Employee MetaClass.
- Title positioned at top (by default for this type of control, the title is positioned at left: Title(Left)
CurrentEmployee=Item(~f7mZ(UQYEHTI[Abstract Employee]),Remoting(Employee),Name(~ThmSy)NYEzzB[Employee]),Title(Up)

Regrouping elements
To group elements of a Properties page. use the Group concept.
The following exercise will allow you to use this concept in the Characteristics page of a Manager, in which you will group personal elements (date of birth, gender, email).
To do this, you will overload the Characteristics page by means of a Characteristics MetaAttributeGoup associated with a MetaPropertyPage.
In the Template paragraph of this page, you will cite the elements you wish to group.

[Template]
Details=Group(Bar),Pos(Middle)
Birth=Item(~XFIiLwhZE5PJ[date of birth]),In(Details)
Email=Item(~8DIipwhZEfTJ[private Email]),In(Details)
Gender=Item(~6emSkyNYETjB[gender]),In(Details)
This template defines a group represented by a bar (‘Bar') and positioned in the "middle" of the page.
Note that it is possible in any case to include in the [template] of a page the attributes it contains; in this case the element included in the template simply overloads standard behavior of the attribute.
In the resulting page, elements concerned are grouped and separated from other elements by a bar. They appear at bottom of the page since no other group has been defined (therefore ‘middle' is the only available position for ‘bottom').

Replace Group(Bar) by Group(Hidden) to regroup the elements, but without separator.

Replace Group(Bar) by Group(Frame) to surround group elements by a frame.

To name the group similarly as for an element, add Name(<Group Name>):
Details=Group(Bar),Pos(Middle),Name(Details)

Note that a certain number of implicit groups are available, in particular the “Name” group you can see in the Characteristics page, and that you can insert elements in these groups.
Modifying element order
It is possible to modify the order of elements within the same group.
When elements are explicitly defined in a group, the order of their definition in the Template corresponds to display order (from MEGA 2009 SP4). To redefine order of elements, it may only be sufficient to define a Group.
For implicit elements, we use the order of attributes in the link with the MetaClass, that is (MetaClass/MetaAttribute), (MetaClass/TaggedValue), (MetaClass/_LegAttribute) according to the attribute type.
Complete classification of attributes is calculated by consolidating values of the Order attribute on each of these links. For example, a TaggedValue connected to a MetaClass by order number 25 will appear between the MetaAttributes connected to this same MetaClass (or Abstract class if the MetaAttribute is inherited) which have numbers 20 and 30.
To sort elements, it may only be sufficient to reorder them relating to their respective MetaClasses; this sort order will then be valid in all entries.
In no case is sort according to MetaAttributeGroup used.
Modifying element size
You can redefine size of an element; this is particularly useful for elements of ListView or TreeView type. For information, all ‘multiline' elements (ListView, TreeView, Text, Viewer, HelpComment, SubPage…) use all space remaining in the page when they appear last. Otherwise they have a default height which you can modify.
To illustrate this possibility, you will define on Firm a Properties page displaying two lists.

A default height is assigned to the "Deps" list, while the "Users" list, positioned at bottom of the page, will occupy the remaining space:

In redefining a size for the Department area (keywordSize())
Deps=Item(~)hmSXaOYEvyC[Department]),Control(ListView),Size(2000,50)
You obtain the following result:

Width 2000 is deliberately exaggerated to indicate that the ListView should occupy all available horizontal space; height 50 includes the complete listview, that is its title, toolbar, header and the list itself.
Sizes are expressed in "dialog units", a unit in which a medium character of the font used to draw the page measures 5x8. 50 therefore represents approximately 5 lines (a line can equal 10 dialog units including two separation units)
Modifying element positioning and resizing
For even more detailed configurations, you can specify the exact size and position of elements in the same group. Position is expressed in dialog units and is relative to the Group. Elements without coordinates are added at bottom of the group.
Returning to the previous example, you can position elements so that ‘gender' is positioned alongside ‘date of birth'. The keyword At() enables definition of element position.
[Template]
Details=Group(Bar),Pos(Middle),Name(Details)
Email=Item(~8DIipwhZEfTJ[private Email]),In(Details),At(1,10)
Birth=Item(~XFIiLwhZE5PJ[date of birth]),In(Details),At(1,25),Size(115,13)
Gender=Item(~6emSkyNYETjB[gender]),In(Details),At(120,25),Size(70,13)

Finally you can define resizing laws for a Properties page when its size is modified.
To do this, you must define basic dimensions for the page to define initial docking. It is on this basic dimension that areas must be positioned in the [Template] paragraph.
To apply this principle, you will customize the Department and User page so that both lists can be extended, and not just the second.
[Template] Deps=Item(~)hmSXaOYEvyC[Department]),Control(ListView),At(1,1),Size(2000,100),VClip(TopToCenter)
Users=Item(~f7mZ(UQYEHTI[Abstract Employee]),Control(ListView),At(1,115),Size(2000,100),VClip(CenterToBottom)
[Page]
MinHeight = 225
The keyword VClip() enables definition of movement of the element, attaching it at (top), (bottom), or (center) of the page. An element attached at two points (for example TopToCenter) will therefore be distorted. In our example, the two lists will be enlarged each to half of page enlargement.


Horizontal clipping uses keyword HClip(), and requires definition of page width ([Page] MinWidth)
Modifying element appearance and behavior
Deactivating an element
The following will enable modification of the type, or of the ability to update a control displayed for an attribute.
To do this, you will take the first version of the Department.Firm MetaPropertyPage on the Department MetaClass. In this example, the page Template is:
[Template]
Firm=Map(~(hmSXaOYEryC[Firm])
Name=Item(~210000000900[Nom]),From(Firm)
Comment=Item(~f10000000b20[Comment]),From(Firm),Control(Text)
In this page, you do not wish the name of the Firm to be modifiable.
To do this, deactivate entry of the element:
Name=Item(~210000000900[Nom]),From(Firm),DisabledOn(Always)
The effect of this is to gray the area and prohibit its modification:
.You can also replace the ‘Edit' control used by default for the name by a ‘Static' control:
Name=Item(~210000000900[Nom]),From(Firm),Control(Static)
The appearance of the area changes:

Forcing an entry
To make it mandatory to enter gender of a Manager in the Manager.Properties customized Properties page define previously, use the keyword Mandatory.
Gender=Item(~6emSkyNYETjB[gender]),In(Details),At(120,25),Size(70,13),Mandatory(Yes)
With this configuration, you cannot assign value (None) to gender.
Hiding a standard element
In this same page, you now want to hide gender. This attribute being derived from MetaAttributeGroup, we must hide it explicitly. To do this, we use the keyword Visibility.
Gender=Item(~6emSkyNYETjB[gender]),In(Details),At(120,25),Size(70,13),Visibility(Hidden)

With:
• Visibility(Hidden): the attribute is never visible.
• Visibility(Admin): the attribute is hidden to users who do not have ‘Expert' metamodel access.
• Visibility(Always): the attribute normally restricted to experts or advanced users can be made visible to all users.