Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Showing properties in compartment instead of properties view
Showing properties in compartment instead of properties view [message #214836] Thu, 08 January 2009 15:21 Go to next message
Marc Moser is currently offline Marc MoserFriend
Messages: 66
Registered: July 2009
Member
Hi,

I'm relatively new to GMF, and I couldn't figure out how to display
attributes/references of objects within the figure.

Assume I have a class A with an attribute name: String and a reference
parent: A. Now, I could create a GMF-based editor that let's me create
boxes for objects of class A. In addition, there is a properties view
where I can set the name attribute and the parent reference. What I
would like to have now, is that I can set the attribute and reference
directly inside the boxes representing my objects, instead of clicking
them and going to the properties view.

Can someone give me a hint on this?

Many thanks!
Regards,
Marc
Re: Showing properties in compartment instead of properties view [message #214904 is a reply to message #214836] Fri, 09 January 2009 12:58 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Marc,

Try reading GMF tutorials first. AFAIU all you need is LabelMapping for the
name label and link mapping to be able to connect two "A" instances with
the link.

-----------------
Alex Shatalin
Re: Showing properties in compartment instead of properties view [message #214934 is a reply to message #214904] Fri, 09 January 2009 17:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marc.moser.me.com

Hi Alex,

Thanks for your reply! :-)

Comments below:

> Try reading GMF tutorials first. AFAIU all you need is LabelMapping for
> the name label

You are right, if I have a single attribute, I can show it as a label.
But assume that I have several different attributes. In this case, I
would like the representation of my objects (the nodes) to have a
single label, but all the other attributes displayed in the compartment.

> and link mapping to be able to connect two "A" instances with the link.

Yes, I could do that, but that's not quite what I want. I would like to
have it shown as an attribute of the node, not as a link between two
nodes.

I think I was not very clear in my explanations. Imagine it like this:

Current:
Right now, I have an editor that let's me draw nodes. I can then click
on a node, and all the attributes/features of the object represented by
this node are editable in the properties view.

Goal:
My goal would be to get rid of the properties view. Basically, I want
to have an editor that let's me draw nodes, and then these nodes should
have a collapsible compartment containing all attributes/features of
the object represented by this node, editable in the same way as
before. So for example, if my class has a many=false reference called
'ref', then I would want to have a compartment that has an entry called
'ref', and if I click on it a pull-down menu appears that let's me
select the target of the reference. Ideally, I would want to have the
properties view inside the compartment of the node.

I looked at all the information I could find, but I did not see
anything like this. Anyone has an idea?

Best Regards,
Marc
Re: Showing properties in compartment instead of properties view [message #215014 is a reply to message #214934] Mon, 12 January 2009 11:34 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Marc,

> You are right, if I have a single attribute, I can show it as a label.
> But assume that I have several different attributes. In this case, I
If you have predefined number of String attributes then you can add LabelMapping
for each of them – NodeMapping can hold several LabelMappings. In case you
do not know a number of String attributes from the meta-model definition
(in meta-model you have a feature stringAttributes with multiplicity *) then
you have to use child NodeMapping(s) to model this situation (and it is not
possible to generate corresponding code for now – you have to modify generated
code manually).

> would like the representation of my objects (the nodes) to have a
> single label, but all the other attributes displayed in the
> compartment.
This can be implemented even with several LabelMappings – you just have to
define proper composite figure (a hierarchy of figures) in .gmfgraph model
and assign appropriate LabelMapping figure from this hierarchy to each of
LabelMappings.

> Yes, I could do that, but that's not quite what I want. I would like
> to have it shown as an attribute of the node, not as a link between
> two nodes.
For now I think you can do that with custom parser or (even better) by defining
+ implementing derive String attribute linkedElementName and using this attribute
in one more LabelMapping.

> the object represented by this node, editable in the same way as
> before. So for example, if my class has a many=false reference called
With string (and hopefully other primitive types) attributes you can use
LabelMapping for each attribute.

> 'ref', then I would want to have a compartment that has an entry
> called 'ref', and if I click on it a pull-down menu appears that let's me
> select the target of the reference. Ideally, I would want to have the
This control should be implemented manually. One of the option – try using
LabelMapping as much as it possible and modify generated code at the end.

-----------------
Alex Shatalin
Previous Topic:Link inheritance behavior
Next Topic:Generating Diagram Code from an Ant Script
Goto Forum:
  


Current Time: Fri Apr 26 21:32:42 GMT 2024

Powered by FUDForum. Page generated in 0.02997 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top