MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - accessing properties from other objects in Merl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

accessing properties from other objects in Merl

 Post Reply Post Reply
Author
Message
maximus View Drop Down
Member
Member


Joined: 29.Apr.2008
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote maximus Quote  Post ReplyReply Direct Link To This Post Topic: accessing properties from other objects in Merl
    Posted: 21.May.2008 at 11:51
Hej,

I want to create a 'title' object. The title object shows information about the author, version, model name, etc. All kind of useful things, when you print your model.

I created a 'title' object, and now in the Symbol Editor, I would like to access properties from the Graph. For example, by creating the Graph, the user has to specify a name and a project name, and by placing a title object, all those information will be visible. So I need to 'generate' strings to display, but if I select the property 'name' from the Graph in the generator editor, it doesn't work. (if unclear: I got the idea of a title box from PowerDesigner: http://manuals.sybase.com/onlinebooks/group-pd/pdd0900e/bwug/@Generic__BookTextView/29344;pt=29344#X)

Another question (little bit related): I also want to have somewhere the possibility to specify if I have an extended view of a minimized view of my model (for example with a checkbox). In an extended view I want to show properties of my object. This is done for example in the UML example, where you can choose to show/hide the attributes of the class. But in this UML example, you have to specify this for everyclass. I would like to have a general checkbox 'show extended' and based on that property showing some properties of my object.

My idea was to make such a property in the title object (or in the graph) (or is there a better way to do this), but how to access that property from the individual objects? And what if there are more instances of the title object, how can I express that the instance on the same diagram should be used?

Thanks in advance,
Max
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 21.May.2008 at 12:16

The name and other properties of the graph are available in symbol generators as id;1, :Name;1 etc. If you just have id or :Name, that would be the name of the current object. MERL keeps a stack of how you have navigated to the current element, and the number in id;N tells it to look N levels back on the stack from the current element. See 5.3.1 Getting started with MERL and Level number in 5.3.2 for more details.

For your second question, the answer is yes: you can put a property in the graph, and then define your symbols to be conditional on it. E.g. rather than having the Simple Symbol property in the Class [UML] object type, it could have been in the Class Diagram [UML] graph type. The Class [UML] object type symbol would then have elements that grab the value from the graph with a condition whose source is a generator, :Simple Symbol;1.
 
As you can see, there's plenty of power there to determine what to display and how! Enjoy playing around with it, but do remember that a good metamodel is the foundation for everything. If you get the metamodel right, the work of the modeler and metamodeler is made much easier. Rather than having to do extra work to check and display information from somewhere else, the information is stored just where it is needed. A good tactic is to try to avoid adding large amounts of generator code in symbols early on: stick with something simple, you can always come back later to add the finer touches.


Edited by stevek - 21.May.2008 at 12:16
Back to Top
janne View Drop Down
MetaCase
MetaCase
Avatar

Joined: 25.Mar.2008
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote janne Quote  Post ReplyReply Direct Link To This Post Posted: 21.May.2008 at 12:27
About the second question: please see the sample of "Mobile Application Specification" (http://www.metacase.com/cases/dsm_examples.html) (click the diagram to enlarge it).

There the Mobile Application Specification graph has a property field "View" (fixed list with two values: 'User view' and the 'Detail view') When user sets the view 'User view', the more colourful symbols will be presented and details were hide and when the view is set 'Detail view' it goes vice versa, model is the same in the both options. The metamodeller had to define two different overlapping symbols for both of these options and set the condition(s) for displaying them, e.g. :View;1 = 'User view' (refering to the graph's View property field value). 
Back to Top
maximus View Drop Down
Member
Member


Joined: 29.Apr.2008
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote maximus Quote  Post ReplyReply Direct Link To This Post Posted: 21.May.2008 at 12:39
Thanks for your quick replies! It seems to work! Do you know if there is a way to display the current date in my object?


Edited by maximus - 21.May.2008 at 12:39
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 21.May.2008 at 12:52
Dates and times are a pain because of the locale, formatting, internationalization and timezone issues, and MERL doesn't feel like the right place to try to solve those problems. You can get the current date from DOS, but that's not a good idea for a symbol.
 
Actually, are you sure you want the current date - it's not like you want to animate the symbol to show the right time Smile! What is often more useful is a field where the modeler can enter a list of version comments. If each comment is an object, it can be timestamped with a property of datatype Creation Timestamp, or then you can allow free entry of a date (Ctrl-D or Alt-D will type the current date for you).
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.023 seconds.