MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Hide icon in the edition panel
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Hide icon in the edition panel

 Post Reply Post Reply
Author
Message
mvilleta View Drop Down
Contributor
Contributor
Avatar

Joined: 26.Jun.2014
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mvilleta Quote  Post ReplyReply Direct Link To This Post Topic: Hide icon in the edition panel
    Posted: 02.Oct.2014 at 11:43
Good morning,

I want to ask a question related with metamodeling and the icon representation for objects.

Suppose I have a metamodel and I define a type of object 'A'. For that object, I define a symbol and icon.

After that, in the "Type browser" tab, I include, in my graph type, the object 'A' as a type of object in the metamodel. 

Then, if you open a diagram representation of a graph instance, you can see in the toolbar the icon representation for insert objects 'A' in the graph instance.

My question is, It is possible to hide this icon in the toolbar?. I want that the users can't insert this kind of objects, but I need that it be part of my metamodel (because I want to insert this objects via API)

Thank you in advance

Best regards
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: 02.Oct.2014 at 13:02
Sure: just remove A from the Types tab of the Graph Tool. The type will disappear from the toolbar, Types menu, top-left tree view of objects by type, View | Selected etc.
 
 
Another approach [in 5.1!] would be to mark the type as Abstract or Hidden, by renaming it _A or __A. Then it will appear in the toolbar etc., but if the user tries to create an instance he will be told it is not instantiable. Rather similar results can be obtained in 5.0 by Remove Type in the Type Browser, but that's probably best reserved for when a type really is removed/obsoleted.
 
All the best,
Steve


Edited by stevek - 02.Oct.2014 at 14:55
Back to Top
mvilleta View Drop Down
Contributor
Contributor
Avatar

Joined: 26.Jun.2014
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mvilleta Quote  Post ReplyReply Direct Link To This Post Posted: 02.Oct.2014 at 14:10
Hi

Thanks for the reply,

I'm not sure if it solves what I expect

With the first approach, it works ok, but, if for example I try to get a "Table representation" for the object type "A", it is not possible because it does not appear in the list of candidates.

With the second approach, when I change the name of 'A', from "Object tool", to '__A', for make it hidden, nothing happens. Simply, the name of the type is changed to __A, but nothings change (the object still appears in the toolbar).

With the third approach, I got the same than the first.

Maybe, the second approach is more near to my needs but I don't know if i'm making something wrong.

Thanks

Best regards
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: 02.Oct.2014 at 14:41
Note that in the second approach what you see is what I wrote [providing you're in 5.1]: the type still appears in the UI, but the user cannot instantiate it.
 
Of course there are all kinds of interesting questions as to whether it is a good idea to have such "API-only" objects in the model Smile - but answering that would take a more in-depth understanding of your domain and process than we can achieve in the forum. In general (and not saying anything about your case), I'd say they often look like a good idea to a programmer, but a source of potential problems to a data modeler.
 
If the API-only objects are created to mirror some existing set of components outside MetaEdit+, so that models in MetaEdit+ can use those components, another approach is to create them in MetaEdit+ as types rather than instances (e.g. by importing MXT generated from the components). For instance, if the component is a function marry(man, woman), then you would end up with a type Marry with properties Man and Woman, and an instance might be "Marry man: Charles, woman: Diana", where the properties could be strings, objects etc. depending on the needs. If you later realise you want to include a date of marriage, the type gets updated to have a new date property, and so all instances also have a new empty date (or whatever you set as the default for that property). Using types also neatly solves the issue of stopping users creating new ones - just don't give them metamodeling rights.
 
Of course, using types only works for a subset of all component approaches, and that is only a subset of all cases where you might want an API-only object. Still, it seems a common subset, and does work rather nicely, fitting in well with the idea of DSM.


Edited by stevek - 02.Oct.2014 at 14:55
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: 02.Oct.2014 at 14:58
Just to clarify: the _ or __ prefix for Abstract or Hidden only works fully as described above if you are in 5.1 (currently in beta testing). In 5.0 it only stops instantiation of objects in a property, not directly in a graph.
Back to Top
mvilleta View Drop Down
Contributor
Contributor
Avatar

Joined: 26.Jun.2014
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mvilleta Quote  Post ReplyReply Direct Link To This Post Posted: 02.Oct.2014 at 16:12
Hi!

Thanks for your answer.

The approach you mention is really interesting, however we have a very advanced development, and by the moment we can't change it.

You're right. I had misunderstood. If I include "__" to the object type name, it still appears in the toolbar, but is no possible to insert it. However, it is not useful for us, because if we include the "__" to the type object, it is not possible to insert object instances via API.

For now, we have drawn a gray icon for the object (simulating the object is disabled) but the user can click on it, and insert the object.

Best Regards


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: 02.Oct.2014 at 16:34
I just checked, and the API can create objects fine regardless of whether their type names begin with _ or __.
 
Perhaps your API program was still using the old name? If you want to make your API programs independent of the user-visible name, you can make them use the internal name. You can see the internal name from MXT/MXM output, or in the METype returned by the API type command. I'd define an METype once with the internal name hard-coded, and use that same METype wherever needed.
Back to Top
mvilleta View Drop Down
Contributor
Contributor
Avatar

Joined: 26.Jun.2014
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mvilleta Quote  Post ReplyReply Direct Link To This Post Posted: 02.Oct.2014 at 17:03
Hi Steven,

Exactly, my mistake... It was using the old name. I didn't know nothing about the use of the internal name, but we have parametrized the name of the types in the external tool.

All good except for the "Table representation". Our users will use this representation, for list all the objects "A" on the model. If we call it as "_A" or "__A" it is not possible to view a "Table representation" of "_A" or "__A" objects...

Regards
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: 02.Oct.2014 at 17:21
If the _A objects are all created by the API, maybe you could create the Table by MXM import (e.g. triggered by the API)? The downside is that the users can then create new _A instances in the table - the check to prevent that is done when creating the table, and that has now been bypassed. I suppose at the end of the day it's not surprising that asking for an "instantiable uninstantiable" type is going to lead to some contradiction somewhere, but hopefully now you've looked at all the various possibilities you can choose the closest match for your situation.
Back to Top
mvilleta View Drop Down
Contributor
Contributor
Avatar

Joined: 26.Jun.2014
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mvilleta Quote  Post ReplyReply Direct Link To This Post Posted: 02.Oct.2014 at 17:34
Ok Steven

Thanks for your help

We'll think about the situation carefully, and we'll assess all that you have proposed

Best regards
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.067 seconds.