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:Correct Procedure for Refreshing Children/Parents
Next Topic:Any swt/draw2d based chart component?
Goto Forum:
  


Current Time: Fri Dec 09 06:31:55 GMT 2022

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

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

Back to the top