![]() |
accessing properties from other objects in Merl |
Post Reply
|
| Author | |
maximus
Member
Joined: 29.Apr.2008 Points: 6 |
Post Options
Thanks(0)
Quote Reply
Topic: accessing properties from other objects in MerlPosted: 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 |
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
janne
MetaCase
Joined: 25.Mar.2008 Points: 58 |
Post Options
Thanks(0)
Quote Reply
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). |
|
![]() |
|
maximus
Member
Joined: 29.Apr.2008 Points: 6 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
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
|
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |