freeformlayer with positive coordinates only ? [message #245650] |
Tue, 23 September 2008 16:01 |
Eclipse User |
|
|
|
Originally posted by: gal.alex.agiledss.com
Hello.
In the org.eclipse.gef.examples.logic, I'm trying to constrain the node children to always be in the 'positive' part of the circuit node i.e. no
moving in the negative (vertically and horizontally). However, I'm a unsure as to how exactly to approach this. I see that the CircuitFigure class
uses a FreeFormLayer as well as a FreeformLayout. Any tips ?
Cheers,
Alex
|
|
|
Re: freeformlayer with positive coordinates only ? [message #245656 is a reply to message #245650] |
Tue, 23 September 2008 16:28 |
Eclipse User |
|
|
|
Originally posted by: gal.alex.agiledss.com
Alex wrote:
> Hello.
>
> In the org.eclipse.gef.examples.logic, I'm trying to constrain the node
> children to always be in the 'positive' part of the circuit node i.e. no
> moving in the negative (vertically and horizontally). However, I'm a
> unsure as to how exactly to approach this. I see that the CircuitFigure
> class uses a FreeFormLayer as well as a FreeformLayout. Any tips ?
>
> Cheers,
>
> Alex
This seems to have done the trick:
pane.setLayoutManager(new FreeformLayout() {
@Override
public void setConstraint(IFigure figure, Object newConstraint) {
Rectangle bounds = (Rectangle) newConstraint;
if (newConstraint != null) {
if (bounds.x < 0) {
bounds.x = 0;
}
if (bounds.y < 0) {
bounds.y = 0;
}
}
super.setConstraint(figure, bounds);
}
});
|
|
|
Powered by
FUDForum. Page generated in 0.02740 seconds