[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [gef-dev] how to create view for model...some code will be appreciated
|
Hi Gunjan,
using a new technology is always a little bit frustrating because of the need
for big amount information in short time.
As I see you know the three pillars of GEF Model View Controller or in GEF MFE
for Model Figure EditPart. You say you got the model, i.e. Person with
bounded properties. All you need is the Figure and the EditPart. Your Figure
must implement IFigure, in this Figure you can do some drawing which
represents your Person. The EditPart connects Figure and Model, the EditPart
is the only one who knows about the other two (model and figure).
After you created a figure for your person, maybe PersonFigure you need to
create the corresponding EditPart, maybe PersonEditPart. This class maybe
named PersonEditPart must inherit from AbstractGraphicalEditPart, implement
the methods and override the method createFigure(). In this method you create
your Figure ... instance your PersonFigure and return it. Further you need to
override the refreshVisuals() method. In this method you have to do your
positioning via setting the layout constraint setLayoutConstraint(EditPart,
IFigure, bounds) notify the model about changes.
But thats not all! To get your application working you need a Factory class
which maps the model to the corresponding EditPart.
For some really helpful and good documentation take a look here:
http://www.eclipse.org/gef/reference/articles.html?cvsroot=Tools_Project
Check out the documentation there and you will get an working GEF application!
For further misunderstandings contact me or this mail list.
best regards
Andreas
Am Montag, 14. März 2005 15:59 schrieb GUNJAN SINGH:
> Hi! All
> Im very, very new to GEF world and i facing lot of problem.
> Im devloping application where im using GEF,SWT and Draw2d.
> The problem is, uptill now in my application i've been using rectanlge
> constraint to draw the figure,but now i have to use IFigure to create the
> view. That is the corrosponding Edit Part of the model should implement
> IFigure to create view.
>
> Now take this scenario , if my model is Person having some bound properties
> , how do is create a view for it. My PersonEditPart should implements
> IFigure thats all i know.
> But wht all i should i have no idea....
> Any suggestion will be realy appreciated and looking forward for some
> suggestion as i'm in dire straits If possible sum code will be great along
> with the explanation...
> Many Regards
>
>
>
> Ved Gunjan
> SCJP1.4
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
Attachment:
pgpd7dlhhJRwJ.pgp
Description: PGP signature