Problem with Figure and ScrollPane! [message #145604] |
Fri, 30 July 2004 08:18 |
Eclipse User |
|
|
|
Originally posted by: mastr.arcor.de
Hello!
I want to let my EditPart return a Figure/ScrollPane which will contain
the figures of the EditPart's children.
Problem is, that I or GEF can't add a new figure to the ScrollPane because
this has to provide a view. Only adding figures to the view will show them
inside the ScrollPane.
So how can I convince GEF to put the child figures inside the ScrollPane.
Hope someone can help.
Thanks in advance, Martin.
|
|
|
Re: Problem with Figure and ScrollPane! [message #145677 is a reply to message #145604] |
Fri, 30 July 2004 11:25 |
Eclipse User |
|
|
|
Originally posted by: mastr.arcor.de
Martin S. wrote:
> I want to let my EditPart return a Figure/ScrollPane which will contain
> the figures of the EditPart's children.
> Problem is, that I or GEF can't add a new figure to the ScrollPane because
> this has to provide a view. Only adding figures to the view will show them
> inside the ScrollPane.
> So how can I convince GEF to put the child figures inside the ScrollPane?
Ok, I got it myself.
public class RelationFigure extends Figure {
private final Figure contents;
public RelationFigure() {
contents = new Figure();
createContents();
}
protected void createContents() {
setOpaque(false);
setBackgroundColor(ColorConstants.white);
contents.setLayoutManager(new FlowLayout(false));
ScrollPane scroll = new ScrollPane();
scroll.setView(contents);
this.add(scroll);
}
public IFigure getContentPane() {
return contents;
}
}
In the EditPart you have to override the getContentPane() method and
return the figure's getContentPane() method.
CU, Martin.
|
|
|
Powered by
FUDForum. Page generated in 0.03261 seconds