Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Questions: GUI designer with GMF
Questions: GUI designer with GMF [message #193097] Tue, 17 June 2008 14:56 Go to next message
Eclipse UserFriend
Originally posted by: divis1969.mail.ru

Hi,

I’m going to create my first GMF project which should implement some kind
of (simplified) GUI designer. I’ve got few questions regarding this
project but was unable to find the answers in tutorials/docs quickly. I
will appreciate if you could point me where can I find the required info.

So, let’s assume I have a model for UI elements. Among them (no surprise):
Form which is a container, different Containers which are widgets and can
contain other containers/widgets, some simple widgets like Text and Image.
All of these items are classes in the model derived from Widget.

1. Should I define Widget as an Interface/Abstract class? On my mind this
is what I should do, but perhaps this will prevent me from having some
useful GMF features. For example, I will not be able to use some kind of
Feature Seq Initializer (if all the containers/widgets can be
differentiated by ‘type’ attribute in Widget class).

2. In case of inheritance (Text->Widget, so on), creation of .gmfmap seems
to me becoming a nightmare. For example, if I have few containers with
different layout rules, I will need to
a. Create Nodes for each container under the Form Node
b. Create Nodes for each Container and Simple Widget under container
Nodes
c. … so on for each container???

3. It is unclear for me how Compartment is linked to the figure it is
associated with? Does it means that Compartment is occupying all the area
below all the sub-figures of this figure? [ BTW, I did not understand the
purpose of the ‘ThreadItems’ Rectangle in mindmap tutorial (step 2,
Compartments). ]
I need to create a figure that have a Text on top, a Text on bottom and a
Container between Texts. How to implement this? Should I place Container
and bottom Text into Compartment?

4. How to set some figure properties from model properties? It is very
simple for text (Feature Label Mapping). What about background color, for
instance?


WBR,
Dmitry
Re: Questions: GUI designer with GMF [message #193777 is a reply to message #193097] Thu, 19 June 2008 15:54 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Dmitry,

> 1. Should I define Widget as an Interface/Abstract class? On my mind
It's up to you. You have to design domain model keeping in mind omain itself,
but not the diagram.. ;-)

> kind of Feature Seq Initializer (if all the containers/widgets can be
> differentiated by ‘type’ attribute in Widget class).
Currently you can define FeatureSequenceInitializer only below Node/LinkMappings,
so you have to create Node/LinkMappings for each concrete class of the model
+ put FeatureSequenceInitializers there.

> 2. In case of inheritance (Text->Widget, so on), creation of .gmfmap
> seems to me becoming a nightmare. For example, if I have few containers
with
> different layout rules, I will need to
> a. Create Nodes for each container under the Form Node
> b. Create Nodes for each Container and Simple Widget under container
> Nodes
> c. … so on for each container???
Unfortunately yes. Good point is: it's still much easy then write diagramming
code by hands. ;-) In addition you can generate these thousands of similar
mappings by using java code having domain model as an input - this can simplify
the process.

> 3. It is unclear for me how Compartment is linked to the figure it is
> associated with? Does it means that Compartment is occupying all the
> area
No. You can create NodeFigure using standard Draw2D figures + layouts. Somewhere
in this figures tree you can place a rectangle and mark it as a compartment
figure. As a result actual compartment figure will be located inside this
rectangle. So, compartment figure is just a figure inside NodeFigure and
will be layouted in accordance with normal Draw2D rules.

> I need to create a figure that have a Text on top, a Text on bottom
> and a Container between Texts. How to implement this? Should I place
> Container and bottom Text into Compartment?
You can create in .gmfgraph model following elements:
1. FigureDescriptor
2. Top-level rectangle figure + specify some layout for it + create following
child figures in it:
- create TopLabel
- create Rectangle (compartment container)
- create BotoomLabel
3. create 3 accessors inside this FigureDescriptor for each of three figures.
4. create Compartment element in this Canvas, specify FigureDescriptor as
a figure element for this compartment + point to the proper accessor using
accessor field of Compartment object.

Similar process have to be performed for inner labels (Top/Bottom).

> 4. How to set some figure properties from model properties? It is very
> simple for text (Feature Label Mapping). What about background color,
> for instance?
You have to perform synchronization between visual model values and underlying
domain model one or just use domain model to store/load corresponding visual
properties see org.eclipse.gmf.graphdef.editor plugin with WYSIWYG diagram
editor for .gmfgraph models as an example. I think this editor is quite similar
to the application you are going to develop.

-----------------
Alex Shatalin
Previous Topic:get diagram from resource
Next Topic:Creating a link without a reference in the semantic model
Goto Forum:
  


Current Time: Fri Apr 26 11:01:33 GMT 2024

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

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

Back to the top