Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Newbie Question Regarding The Display of Model
Newbie Question Regarding The Display of Model [message #210377] Mon, 27 February 2006 11:34 Go to next message
Eclipse UserFriend
Originally posted by: none.none.org

Hello...

I've spent a ton of time looking at examples, documentation, etc. But
nothing I have run into discusses what is minimally required to display
something representative of a simple model (a 2 nodal model with a
connection between the nodes). Although I'd eventually like edit the
model, I'd just like something displayed at this point so that I know
I'm on the right track.

Right now I've got, a model, the corresponding edit parts, and
corresponding figures (with figures extending org.eclipse.draw2d.Label).
The model is loaded, the corresponding edit parts get created by an
EditPartFactory, the overridden createFigure method in each EditPart
gets invoked, thus creating a corresponding figure, all figures are
opaque, and no errors are displayed or logged.

I'm not really sure what's next. I think I'm on the cusp of having a
model displayed, but just need a little push. Does anyone have any
suggestions?

Thanks in Advance!

Aakash
Re: Newbie Question Regarding The Display of Model [message #210385 is a reply to message #210377] Mon, 27 February 2006 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.none.org

Adding the following to the refreshVisuals method of the EditPart worked
(suggestion made elsewhere in this newsgroup by Partik Shah - Thanks)!

((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(),
new Rectangle(50, 50, -1, -1));

But I think the nodes are on top of each other now.... I'll have to work
on that... Also, I need to figure what setting layout constraints is
actually doing.


Aakash Chopra wrote:
> Hello...
>
> I've spent a ton of time looking at examples, documentation, etc. But
> nothing I have run into discusses what is minimally required to display
> something representative of a simple model (a 2 nodal model with a
> connection between the nodes). Although I'd eventually like edit the
> model, I'd just like something displayed at this point so that I know
> I'm on the right track.
>
> Right now I've got, a model, the corresponding edit parts, and
> corresponding figures (with figures extending org.eclipse.draw2d.Label).
> The model is loaded, the corresponding edit parts get created by an
> EditPartFactory, the overridden createFigure method in each EditPart
> gets invoked, thus creating a corresponding figure, all figures are
> opaque, and no errors are displayed or logged.
>
> I'm not really sure what's next. I think I'm on the cusp of having a
> model displayed, but just need a little push. Does anyone have any
> suggestions?
>
> Thanks in Advance!
>
> Aakash
Re: Newbie Question Regarding The Display of Model [message #210436 is a reply to message #210385] Tue, 28 February 2006 03:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rick.cameron.decisionscrystal.com

Hi, Aakash

The layout constraint you set is related to the layout manager used by the
parent figure. XYLayout and FreeformLayout (which subclasses XYLayout) both
use a Rectangle to control the position, and optionally the size, of the
child figure. If you use this code for both children, they will both be
positioned at (50, 50) and have their preferred sizes. (Using a width &
height of -1 causes the layout manager to use the preferred sizes of the
figures).

There's a lot of discussion about the best way to represent view-related
attributes, like position, in the model. Often they don't make sense as
properties of the model objects. However, to get going, you might want to
store position in the model objects, and use it here to set the constraint.

The next step will be creating the connection. To do this, make the edit
part class for the objects that are the source & target of the connection
implement NodeEditPart. This class should override getModelSourceConnections
and getModelTargetConnections and return the list of (model) connection
objects that have their source, resp. target, at the current model object.
Override get*Anchor from NodeEditPart and return new
ChopboxAnchor(getFigure()) for now.

Your edit part factory will have to handle the model connection class. You
can return a subclass of AbstractConnectionEditPart that just delegates to
super for everything.

Good luck!

- rick

"Aakash Chopra" <none@none.org> wrote in message
news:dtupo1$hp5$1@utils.eclipse.org...
> Adding the following to the refreshVisuals method of the EditPart worked
> (suggestion made elsewhere in this newsgroup by Partik Shah - Thanks)!
>
> ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(),
> new Rectangle(50, 50, -1, -1));
>
> But I think the nodes are on top of each other now.... I'll have to work
> on that... Also, I need to figure what setting layout constraints is
> actually doing.
>
>
> Aakash Chopra wrote:
>> Hello...
>>
>> I've spent a ton of time looking at examples, documentation, etc. But
>> nothing I have run into discusses what is minimally required to display
>> something representative of a simple model (a 2 nodal model with a
>> connection between the nodes). Although I'd eventually like edit the
>> model, I'd just like something displayed at this point so that I know I'm
>> on the right track.
>>
>> Right now I've got, a model, the corresponding edit parts, and
>> corresponding figures (with figures extending org.eclipse.draw2d.Label).
>> The model is loaded, the corresponding edit parts get created by an
>> EditPartFactory, the overridden createFigure method in each EditPart gets
>> invoked, thus creating a corresponding figure, all figures are opaque,
>> and no errors are displayed or logged.
>>
>> I'm not really sure what's next. I think I'm on the cusp of having a
>> model displayed, but just need a little push. Does anyone have any
>> suggestions?
>>
>> Thanks in Advance!
>>
>> Aakash
Re: Newbie Question Regarding The Display of Model [message #210443 is a reply to message #210436] Tue, 28 February 2006 04:26 Go to previous message
venkataramana m is currently offline venkataramana mFriend
Messages: 86
Registered: July 2009
Member
Check the thread at http://www.eclipsezone.com/eclipse/forums/m91986843.html#919 86843
That may help.

Thanks
Venkat
Previous Topic:Issue of Parent child Realtionship
Next Topic:Search connection under mouse
Goto Forum:
  


Current Time: Wed Dec 07 01:07:31 GMT 2022

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

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

Back to the top