1.6 Property Tool
 | See
also the Menu Reference, Section
3.6. |
All
other types (objects, relationships, roles and graphs) have properties that
specify what information can be attached to them. The Property
Tool
is a tool for creating and modifying these
properties. The Property Tool can be opened by selecting
Metamodel | Property
Tool in the MetaEdit+ Launcher, by pressing the Property Tool button in the
launcher, or by adding and viewing property definitions in other metamodelling
tools.
Figure 1-17 shows
a Property Tool. The structure of the window is similar to that in the Object
Tool, i.e. it contains the
Name,
Ancestor and
Description
fields. It also has the
Generate/Modify and
Help
buttons.

Figure 1-17. Property Tool.
The main difference between
other tools and the Property Tool is that in place of a property list this tool
has a
Datatype button, which enables the selection
of the type of the contents of the property. For string properties there is also
a
Widget button and field, which show how the string field will appear in
property windows. When the data type button is pressed a dialog appears and
prompts for the data type. Select the desired data type and press
OK. If
you selected a complex data type (Collection, Graph, Object, Relationship or
Role) a further selection of the type will appear. The data types are discussed
in more detail in the next section.

Figure 1-18. Data type selection dialog.
Property Tool has
also a
Filter button which allows you to restrict type selection from the
name field to properties of a specific data type or widget. If no filter is
given the type selection list dialog (
Choose Type...) shows all property
types.
1.6.1 Data types
In this section we discuss the data types available in
MetaEdit+ and how they appear in property windows.
String
The string data type is an ordinary character string without
any formatting. The initial value is an empty string, except for the Fixed List
widget, where it is the first value in the list.
The
Widget button
is used to
select among a list of possible widgets used in property dialogs for entering a
string value: Input Field, Fixed List, Overridable List, Editable List, and
External Element. The figure below shows the dialog that appears after pressing
the widget button.

Figure 1-19. Widget selection dialog.
The default selection
is Input Field, which is a single line box of approximately 30 characters by
default (it can be resized).
The next three widgets all use pull-down lists, whose
initial set of values are defined in the property type. In a Fixed
List
the user can only select among the predefined values;
the default value is the first in the list. In an Overridable List
the user can type a different value from those in the
list. In an Editable List
new values of the property that
are typed in the field will be added into the list.
Note that the Editable List’s list contents are
based on the values entered into the value list by metamodeller, but each
project which uses this property type uses its own copy of the list, and the new
items which the modellers add will only appear within that project. This is
particularly useful for selecting e.g. the stereotype of a class: different
projects have different stereotypes based on the programming language.
The External Element widget type is used when the string
represents a file, resource or command in the operating system. The widget used
is identical to that for a normal Input Field, but its menu has an extra
Execute item,
which sends the contents of the
property as a string to be run by the operating system. In Windows, this can be
e.g. a text file, a Word document, a URL (e.g.
http://www.metacase.com, or
mailto:info@metacase.com), or a
command.

Figure 1-20. Property Tool for a string property with an editable list widget.
For
the list types a
Value list appears below the widget list. The Value
list
contains the predefined values for this type. The
list pop-up menu allows addition, removal and changing the order of the values.
Note that for Editable Lists, this value list is often empty: the contents of
the list are built up separately for each project.
Text
Text is used for longer descriptions. The text can contain
carriage returns, tabs etc., and also basic text formatting (fonts, bold, italic
etc.). The text widget
is shown as a multi-line text box
with a vertical scroll bar
. Text properties can also be
opened in a Text Editor, useful for text formatting or longer texts.
Number
Number can contain any integer, scientific or real number. The
widget
for number is a single line box with initial value
0.
Boolean
A Boolean data type holds the value true or false. The
widget
for Boolean value is a check box: the initial value
is false.
Collection
The Collection data type defines a list of strings or objects,
initially empty, in which the user can add and delete items. When this data type
is selected a dialog appears asking you to specify the data type of the contents
of the list. The widget
for Collection is a list box with
a vertical scroll bar.
An example of a collection can be found from
object-oriented methods in type Class, which includes among its properties
collections of attributes and of methods, and each attribute or method can
itself have one or more properties. Some of these properties could again be
lists, e.g. a Class has a collection of Operations, each of which has a
collection of Parameters. MetaEdit+ does not limit the number of such levels of
complex properties.
Selecting the Collection data type adds a List
member field to the Property Tool window, showing the data type of the
members of this list. The list members can be strings, graphs, objects, roles or
relationships.
If one of the latter types is chosen the list members can
always be not only of the type specified in the list member field, but also of
any type which inherits from that type. For example, suppose that there is a
list property type ClassList with list member type Class (an object type). If we
suppose that Class&Object is a subtype of Class, we can add any Class or
Class&Object to the ClassList. In some exceptional circumstances it may be
desirable to specify the supertype of all the types of that metatype, e.g.
Object: you can do this by selecting the metatype and pressing OK with
shift held down, and Object will then be included in the list of types to select
from.
Graph, Object, Relationship, Role
An individual graph, object, relationship or role can also be
used as the value of a property. In this section we discuss object types, but
the same applies for the other non-property types as well.
The Object data type allows you to specify a data type
field, whose content will be an object of a selected type. When you select this
data type, the tool further asks you to specify the object type, which is the
type of the objects that can be attached to this field. Again, instances of
subtypes of this type are also allowed as values for this kind of property. In
some exceptional circumstances it may be desirable to specify the supertype of
all the types of that metatype, e.g. Object: you can do this by selecting the
metatype and pressing OK with shift held down, and Object will then be
included in the list of types to select from.
The widget
for the Object data type
is similar to a String property’s Input Field, except that the background
is grey, showing that you cannot type directly there. The box shows the
identifying property of the currently attached object. In place of the normal
text editing operations in the pop-up menu, there are operations for editing the
attached object, or opening its representation.

Figure 1-21. Property Tool with a Process object as the data type.
This
data type — containing other non-property instances — is a very
powerful tool for several purposes. It can be used for attaching whole objects
or graphs into one property of another object or graph type and thus allowing
complex data structures.
1.6.2 Defining new property types
If you want to create a new property type:
1) | Select
Metamodel | Property Tool or the Property Tool button in the MetaEdit+
Launcher. |
2) | Enter
the name of the property in the Name field. In
Figure 1-21 the name of the property is
‘Process
reference’. |
3) | Select
the project for the new property type by pressing the Project button and
selecting it from the list of loaded projects. If the project you want is not
yet open, you can open it from the MetaEdit+ Launcher (Repository | Open
Project...). |
4) | Select
a data type by pressing the Datatype button and
choosing the right type from the list
(Figure 1-18). |
5) | Enter
information about the property type in the Description
field. |
6) | Press
the Generate
button. |
1.6.3 Modifying existing property types
The Property Tool works similarly to other method development
tools. For example, to view specifications of a property type:
1) | Open
the Name field pop-up
menu. |
2) | Select
Choose Type....
|
3) | Select the
property type you want to view from the
dialog. |
Property types have limited
modification possibilities. Their type name can be changed afterwards, and list
members can be added and removed from lists, but otherwise the property types
cannot be changed much.
For example, modifying the data type could lead to some
instances of the property being strings, and others being collections of
objects. Similarly, changing the data type or widget will invalidate any
existing custom property dialogs for non-property types that use this property.
Default property dialogs will adjust automatically, but you must change others
yourself: see Section
1.7.
However, it is possible to change the data type of the
property if there are no instances of that property type, and no non-property
types using it with custom property dialogs. Whilst MetaEdit+ will check and
warn you if there are any such instances or types loaded, it cannot check
instances or types in unopened projects, or instances that have not yet been
loaded. You are therefore responsible for knowing whether such instances or
types exist.