Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » FlowLayout & resizing figures?
FlowLayout & resizing figures? [message #529091] Thu, 22 April 2010 22:09 Go to next message
Alain is currently offline AlainFriend
Messages: 20
Registered: March 2010
Junior Member
In a GEF project, when I installed a FlowLayoutEditPolicy on an EditPart whose figures use FlowLayout as Layoutmanager.
I can't resize my figures. I tried to solve the problem by installing another editpolicy : resizableeditpolicy, then I remark that I can move and resize figures, but they don't stay in place and return to their original place.
Do you have any Idea how to resize figures in this case?
Thank you in advance.
Re: FlowLayout & resizing figures? [message #535570 is a reply to message #529091] Mon, 24 May 2010 15:53 Go to previous message
Alain is currently offline AlainFriend
Messages: 20
Registered: March 2010
Junior Member
I finally find a way to resize figures with FlowLayout:
the idea is that, on the concerned editpart (which inherits from FlowLayoutEditPolicy) I override this method this way:

protected EditPolicy createChildEditPolicy(EditPart child) {

FlowResizableEditPolicy policy = new FlowResizableEditPolicy();
policy.setResizeDirections(PositionConstants.WEST
| PositionConstants.EAST
| PositionConstants.NORTH
| PositionConstants.SOUTH
);
return policy;
}

then, inside the FlowResizableEditPolicy class I overrided this method this way:

protected Command getResizeCommand(ChangeBoundsRequest request){

ChangeConstraintCommand cmd= new ChangeConstraintCommand();
//this is just for setting the model whose constaints will change
cmd.setPageElement((PageElement)getHost().getModel());
// this is just for setting new constraint of the passed model element
cmd.setConstraint(new Rectangle(
getHostFigure().getBounds().x,
getHostFigure().getBounds().y,
getHostFigure().getBounds().width+request.getSizeDelta().wid th,
getHostFigure().getBounds().height+request.getSizeDelta().he ight));
return cmd;
}

Previous Topic:How to dynamically add new items to the palette
Next Topic: forbiden icon while resizing
Goto Forum:
  


Current Time: Thu Apr 25 16:16:02 GMT 2024

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

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

Back to the top