Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Adding figure to sub panel
Adding figure to sub panel [message #219165] Sat, 08 July 2006 16:32 Go to next message
Nhu Le is currently offline Nhu LeFriend
Messages: 47
Registered: July 2009
Member
Hi,

How do I let GEF know that I would like to add a child figure to a sub
panel and not directly on the figure when I have multiple sub panel
inside the figure? By default, Gef adds all the figure to the main
figure. It is almost as if I have to overide the getContentPane() at
the correct moment and return the correct sub figure for Gef. Could you
please point me to the right direction?

Thank you.

In my Figure, I have:
class MyFigure
{
public Figure()
{
Figure sub1 = new Figure();
Figure sub2 = new Figure();

add(sub1);
add(sub2);
}
}

In my model, I have:
class MyModel
{
public LinkedList values = new LinkedList();
String one = new String("In sub1");
String two = new String("In sub2");
values.add(one);
values.add(two);
}

In my EditPart, I have:
class MyEditPart
{
protected List getModelChildren()
{
((MyModel)getModel()).values;
}
}
Re: Adding figure to sub panel [message #219174 is a reply to message #219165] Sat, 08 July 2006 17:07 Go to previous message
Nhu Le is currently offline Nhu LeFriend
Messages: 47
Registered: July 2009
Member
I found a way to do this by overiding addChildVisual method inside the
editpart class. Instead of calling getContentPane() as in the base
class (AbstractGraphicalEditPart), I used my own getSub1ContentPane()
and getSub2ContentPane() depending on the passed in argument. It seems
to work well now.

If this is not the correct way to do it, please let me know.

Thank you.



Nhu Le wrote:
> Hi,
>
> How do I let GEF know that I would like to add a child figure to a sub
> panel and not directly on the figure when I have multiple sub panel
> inside the figure? By default, Gef adds all the figure to the main
> figure. It is almost as if I have to overide the getContentPane() at
> the correct moment and return the correct sub figure for Gef. Could you
> please point me to the right direction?
>
> Thank you.
>
> In my Figure, I have:
> class MyFigure
> {
> public Figure()
> {
> Figure sub1 = new Figure();
> Figure sub2 = new Figure();
>
> add(sub1);
> add(sub2);
> }
> }
>
> In my model, I have:
> class MyModel
> {
> public LinkedList values = new LinkedList();
> String one = new String("In sub1");
> String two = new String("In sub2");
> values.add(one);
> values.add(two);
> }
>
> In my EditPart, I have:
> class MyEditPart
> {
> protected List getModelChildren()
> {
> ((MyModel)getModel()).values;
> }
> }
Previous Topic:SelectionAction and action delegates in common navigator framework
Next Topic:Editing XML based on content
Goto Forum:
  


Current Time: Thu Apr 25 03:35:21 GMT 2024

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

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

Back to the top