Maximize Graph Width to View Width [message #843659] |
Fri, 13 April 2012 08:46 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
Hello!
i try to write a view which contains a graph (which should fit to 100% of width of the view -> if the view gets increased the graph shall increase its size too.
i tried to create an EditPart which uses this code
@Override
protected IFigure createFigure() {
Figure figure = new FreeformLayer();
figure.setBorder(new MarginBorder(3));
figure.setLayoutManager(Utils.getLayout(1));
contentPane = new Panel();
figure.add(contentPane, new GridData(GridData.FILL_BOTH));
contentPane.setLayoutManager(new XYLayout());
return figure;
}
public IFigure getContentPane() {
return contentPane;
}
this does not resize as i expected it to do.
its also not possible to gain the width of the control itself (from the figure)
super.getParent().getViewer().getControl().getBounds();
UPDATE: i also tried:
public Dimension getViewSize() {
ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) super.getParent().getViewer();
return ((FigureCanvas)viewer.getControl()).getViewport().getSize();
}
so... how can i get those dimensions i need?
thanks in advance!
lumo
[Updated on: Fri, 13 April 2012 09:11] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02449 seconds