Login | Register
My pages Projects Community openCollabNet

Discussions > users > [gef-users] MVC trouble or how to create edges

gef
Discussion topic

Hide all messages in topic

All messages in topic

Re: [gef-users] MVC trouble or how to create edges

Reply

Author bobtarling
Full name Bob Tarling
Date 2005-02-09 08:10:13 PST
Message > Thank you again. This is another demo as the one coming with GEF, I
> didn't recognized that. The more examples the better.
Sounds like I should make gefdemo more obvious on the GEF homepage.
The demo inside GEF itself is likely to be removed in time. GEF is not
itself a drawing application but is the framework some other drawing
application.


> Yes... that's a good example. I'm implementing a very simple diagram
> editor as mentioned in my initial mail for "testing" and learning the
> frameworks. Maybe I could send you this example including some
> documentation, too.
Contributions and criticisms gratefully received.
I'd be curious to see how GEF compares to its alternatives. I haven't
had time to investigate these myself.

Regards

Bob.

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ge​f.tigris.org
For additional commands, e-mail: users-help at gef dot tigris dot org

Re: [gef-users] MVC trouble or how to create edges

Reply

Author jevopi
Full name Jens v. P.
Date 2005-02-09 07:55:33 PST
Message Bob,

Am 09.02.2005 um 15:14 schrieb Bob Tarling:

> It sounds like you should not be using NetNode/NetEdge.

I'm not using these classes. I'm only looking inside these classes like
a monkey (monkey sees, monkey does) ;)

> These are for
> projects where the underlying model has GEF knowledge built in,
> something that is convenient if you are using GEF to write a drawing
> tool and are designing a model specifically for that purpose only. If
> you are reusing an existing model then that is not the way to go.
>

Thank you! That's what I thought, but I wasn't sure.


> I apologise for the lack of documentation. It's something that does
> have to be tackled but I am currently swamped with the need to make
> coding improvements and bug fixes in GEF and various GEF based
> projects.

No problem. I'm writing a thesis about graphical frameworks comparing
JHotdraw, Eclipse GEF and (Tigris) GEF. Maybe I can send you some of my
diagrams when I've finished my work.

>
> I have however put together a demo project using GEF with a completely
> seperate model. See http://gefdemo.tigris.org
>

Thank you again. This is another demo as the one coming with GEF, I
didn't recognized that. The more examples the better.

> Within this you will find org/gefdemo/uml/model. The classes in here
> are an extremely simplified version of the UML model. These classes
> know nothing about GEF or the rest of the demo application.
>

Yes... that's a good example. I'm implementing a very simple diagram
editor as mentioned in my initial mail for "testing" and learning the
frameworks. Maybe I could send you this example including some
documentation, too.

Regards,

Jens


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ge​f.tigris.org
For additional commands, e-mail: users-help at gef dot tigris dot org

Re: [gef-users] MVC trouble or how to create edges

Reply

Author jevopi
Full name Jens v. P.
Date 2005-02-09 06:17:31 PST
Message Hi,

answering myself (parts of my questions):

Use Layer.presentationFor(Object) for retrieving a figure associated
with a model object.
So it's possible to set source- and destination ports (and nodes):

     public FigEdge getFigEdgeFor(GraphModel i_gm, Layer i_lay, Object
i_edge,
             Map i_attributesMap) {
         MyEdge e = (MyEdge) i_edge;
         MyEdgeFigure fig = new MyEdgeFigure();
         fig.setOwner(i_edge);

         FigNode figNode = (FigNode)
i_lay.presentationFo​r(e.getSource());
         fig.setSourceFigNode(figNode);
         fig.setSourcePortFig(figNode);
         figNode = (FigNode) i_lay.presentationFo​r(e.getTarget());
         fig.setDestFigNode(figNode);
         fig.setDestPortFig(figNode);

         return fig;

     }

Regards,

Jens


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ge​f.tigris.org
For additional commands, e-mail: users-help at gef dot tigris dot org

Re: [gef-users] MVC trouble or how to create edges

Reply

Author bobtarling
Full name Bob Tarling
Date 2005-02-09 06:14:54 PST
Message It sounds like you should not be using NetNode/NetEdge. These are for
projects where the underlying model has GEF knowledge built in,
something that is convenient if you are using GEF to write a drawing
tool and are designing a model specifically for that purpose only. If
you are reusing an existing model then that is not the way to go.

I apologise for the lack of documentation. It's something that does
have to be tackled but I am currently swamped with the need to make
coding improvements and bug fixes in GEF and various GEF based
projects.

I have however put together a demo project using GEF with a completely
seperate model. See http://gefdemo.tigris.org

I would recommend taking the latest CVS of both GEF and GEFDemo when
looking at this.

There are various demo applications in GEFDemo, the one that would
interest you is the uml demo. I use this as a test space for new ideas
I plan to bring into ArgoUML.

So look at CVS/gefdemo/uml/src

Within this you will find org/gefdemo/uml/model. The classes in here
are an extremely simplified version of the UML model. These classes
know nothing about GEF or the rest of the demo application.

The UML GEFDemo application currently demonstrates a seperate model,
multiple diagrams, split diagrams (there is a splitter bar at the
bottom of each window), and XML based connection constrainers.

Please let me know if I can be of further help.

Regards

Bob.

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ge​f.tigris.org
For additional commands, e-mail: users-help at gef dot tigris dot org

[gef-users] MVC trouble or how to create edges

Reply

Author jevopi
Full name Jens v. P.
Date 2005-02-09 05:33:33 PST
Message Hi all,

I'm trying to build a very simple diagram editor for directed graphs.
A graph is my model consiting of the following classes:

          +---------+
    +-----| MyGraph |---------------+
    | +---------+ |
    | |
    | |
   *|+nodes *|+veteces
+------+ 1 +sourceVertex +-----------+
|MyEdge|------------​-----------| MyVertex |
+------+ +sourceEdges *+-----------+
    |1 +targetVertex |+ x |
    +---------------------------|+ y |
     +targetEdges *|+width |
                               |+height |
                                +-----------+

(anyone knows about an ASCII export plugin for Argo/UML ;) )

Now I've implemented a GraphNodeRenderer and a GraphEdgeRenderer:

MyVertexRenderer creating MyVertexFigures (subclass of FigNode) and
MyEdgeRenderer creating MyEdgeFigures (subclass of FigEdgeLine).

MyGraphModel is a subclass of MutableGraphSupport. This class is the
first one I don't understand. On the one hand its methods are called by
the framework (Hollywood principle aka Inversion of Control). On the
other hand I have to "call back", e.g. by calling the super methods or
firing an event. Is this correct?

Now I could succesfully create a Node, i.e. a pair of MyVertex with its
figure MyVertexFigure. The model object (MyVertex) is created by the
command, MyGraphModel.addNode(..) is called and
MyVertexRenderer.getFigFor(..) is called. Everything is fine.
Except the fact that I don't know how to retrieve the position of the
mouse. The object model is created by the command, and there's no
information about the position when the GraphModel is called.
How do I set the position inside the model?

My most serious problem is that I can't create an edge, that is MyEdge
and MyEdgeFigure here. Dragging a rubber band from one node (or vertex)
to another is working fine. When releasing the mouse button,
MyGraphModel:connect(..) is called. There I can create an instance of
MyEdge. This is how my connect method (and addNode/Edge) looks like:

----------8X--------​--8X----------8X----​------8X----------8X​----------
public class MyGraphModel extends MutableGraphSupport {

     public Object connect(Object i_fromPort, Object i_toPort) {
         MyEdge e = new MyEdge();
         e.setSource((MyVerte​x)i_fromPort);
         e.setTarget((MyVerte​x)i_toPort);
         addEdge(e);
         return e;
     }

     public void addEdge(Object i_edge) {
         m_graph.addEdge((MyE​dge)i_edge);
         super.addEdge(i_edge);
     }

     public void addNode(Object i_node) {
         m_graph.addVertex((M​yVertex)i_node);
         super.addNode(i_node);
     }

     ...
  }
----------8X--------​--8X----------8X----​------8X----------8X​----------
(as you see my model doesn't support ports - verteces are the ports
themselves).

After that, MyEdgeRenderer is called creating a new MyEdgeFigure (which
is a FigEdgeLine).

And then an exception occurs in FigEdgeLine.computeRoute(). This method
is called from LayerPerspective after the model and view object were
created. The problem is:

FigEdgeLine expects property "sourceportfig" to be set, but it isn't.
Where do I have to set this property? My model objects don't know
anything about the views. Thus it's not possibe to "ask" the model
object about its view. I think this is one principle of the MVC
paradim. But exectly that is what NetNode is doing in
NetNode.presentationFor(Layer lay). I guess I'm missunderstanding
something. What is NetNode? Is it part of the model? Or part of the
controller? I'm confused. Maybe I need something like a map, mapping
model objects to figures. Is this the way to solve the problem?

Summary: All I want to do is create a simple editor for verteces and
edges, with an underlying model which doen't know anything about the
graphical editor. The GraphEdgeRenderer, GraphNodeRenderer and
GraphModel seems to be mediators between the model and GEF. What did I
miss?

Regards,

Jens



BTW: I was looking for tutorials and documentations about GEF. Since
there are no links on the web page, maybe this list will be helpful for
others -- and maybe somebody can add some links I didn't found:

Robbins, J. E. (1999): Cognitive Support Features for Software
Development Tools. Dissertation University of California. URL:
http://argouml.tigris.org/docs/ (GEF: pages 184-192)

Skinner, M. (2001): Enhancing an Open Source UML Editor by
Context-Based Constraints for Components. Thesis TU Berlin. URL:
http://www.cocons.or​g/publications/CCL_p​lugin_for_ArgoUML.pd​f (GEF:
pages 42-48)

Zhang, G. (2002): CASE support For Modeling Web Applications. Thesis
LMU Munich. URL:
http://www.pst.infor​matik.uni-muenchen.d​e/projekte/argouwe/a​rgouwe
-0.8.1a.pdf (GEF: pages 39-49)

Steinbrueckner, F. (2002) Analyse von Software Systemen - Projekt
Argo-UML. Seminararbeit TU Cottbus. URL:
http://www.informati​k.tu-cottbus.de/~rus​t/ws2001-2002/openSo​urce/
steinbrueckner0.pdf (German language only, GEF: pages 9-10)



--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ge​f.tigris.org
For additional commands, e-mail: users-help at gef dot tigris dot org
Messages per page: