Statemachine autosize/resize problem (not just programmatically) [message #1629856] |
Sun, 22 February 2015 23:26 |
András Dobreff Messages: 9 Registered: September 2014 |
Junior Member |
|
|
Hi!
I'm working on creating StateMachines programmatically, and now I'm facing a problem.
If I have more than one region as I want to resize (bigger), the Statemachine gets bigger, but the regions stay small.
I thought that I'm making something wrong, but found out that right click->format->autosize behaves the same way.
Programmatically I tried 2 ways
1st:
public void resizeStateMachine(DiagramEditPart diagep) {
GraphicalEditPart stateMachineEP = (GraphicalEditPart) diagep.getChildren().get(0);
Dimension dim = new Dimension(400, 300);
Rectangle constraint = new Rectangle(new Point(0,0), dim);
ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
request.setEditParts(stateMachineEP);
request.setConstrainedResize(true);
request.setSizeDelta(dim);
EditPolicy Epoli = diagep.getEditPolicy(EditPolicy.LAYOUT_ROLE);
Command com = ((CustomPackageXYLayoutEditPolicy) Epoli).createChangeConstraintCommand(request, stateMachineEP, new Rectangle());
com.execute();
}
2nd:
public static void resizeGraphicalEditPart(GraphicalEditPart graphEP, int new_width, int new_height){
Dimension figuredim = graphEP.getFigure().getSize();
ChangeBoundsRequest resize_req = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
resize_req.setSizeDelta(new Dimension(new_width-figuredim.width(), new_height-figuredim.height()));
resize_req.setEditParts(graphEP);
Command cmd = graphEP.getCommand(resize_req);
if(cmd != null){
cmd.execute();
}
}
I'm fearing that it's a bug, but if not, please help.
Thanks,
András Dobreff
|
|
|
|
Powered by
FUDForum. Page generated in 0.03243 seconds