Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » (New to GEF) Tweaking Shapes Example with Labels(Adding a Label to the Shapes)
(New to GEF) Tweaking Shapes Example with Labels [message #667399] Thu, 28 April 2011 10:17 Go to next message
Saurabh  is currently offline Saurabh
Messages: 8
Registered: April 2011
Junior Member
Hi,

I am new to GEF/draw2D. I read the Shapes Editor Example Tutorial, and used its source to build the plugin.

I now want to tweak it, to understand some other concepts.
(I've understood the Basic M-V-C model)

I want a simple label, to be shown in the Middle of each figure I draw, to start with, say a label "Rectangle" added in every drawn Rectangle, and a Label "Ellipse" added to every Ellipse drawn.

(I don't really know whether its an easy task or not, but is it possible that I get a choice to Edit those labels on the fly?)

I saw some examples on the net, explaining the Concept of Labels and EditableLabels, but I am not able to understand how it works.

With my knowledge till now, I think I'll need to make changes in the Edit Parts for the Shapes (the RectangularShape and EllipticalShape classes in the Shapes Example) as well as create some "figures" (something which is not a part of Basic tutorial).

Can anyone guide me how should I go about doing it?

(If putting up code is not possible, please try explaining the logic step wise)

Thanks in advance
Saurabh
Re: (New to GEF) Tweaking Shapes Example with Labels [message #670611 is a reply to message #667399] Sun, 15 May 2011 04:02 Go to previous message
Girish Kumar is currently offline Girish Kumar
Messages: 22
Registered: May 2011
Junior Member
Hi Saurabh,

All those queries you had put here are possible to do..

First of all i think you are familiar with MVC model

In the Editpart, you can see the createFigure() Method, where you are returning the EllipseFigure/Rectangle figure based on the model type rite ...

Ex : Figure ellipse = new EllipseFigure();
ellipse.add(new Label("Ellipse"))
ellipse.setLayoutManager(/*your desired layout Manager */);

before returning this, create a figure Label and add that to Ellipse or Rectangle(and set the Layout Manager of the parent fig (Ellipse/rectangle))

Then add the entry name in the model , now Create the custom Figure(refer draw2d official website ), install directEditpolicy on the EditPart for Label...
Previous Topic:[ZEST] node shape
Next Topic:graph nodes and connections
Goto Forum:
  


Current Time: Wed Jul 30 11:24:10 EDT 2014

Powered by FUDForum. Page generated in 0.03042 seconds