Skip to main content


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 14:17 Go to next message
Saurabh  is currently offline Saurabh Friend
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 08:02 Go to previous message
Girish Kumar is currently offline Girish KumarFriend
Messages: 48
Registered: May 2011
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: Fri May 10 23:26:29 GMT 2024

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

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

Back to the top