Resizing of While loop

Hi
Problem Description:

The current implementation of the While and Scope modeling elements in my project allows the user to do the following:

<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Drag the object to the canvas

Expand the object

Drag and drop Activities and other objects into the while or scope

Connect the various objects together using links

As the user performs these actions, the While and Scope automatically resize by accommodating the extra objects. The upper left is locked in a location and the box expands to the right and down as necessary.

The only way to increase the size of the box is to grab an object within and move it within the box to effectively push out the boundaries.

Objective:

To improve the usability of this object, we should implement the ability to grab any corner, side, or the top/bottom and expand/contract the box in the appropriate direction.

For instance – if any corner is selected, the appropriate directional arrow should appear to indicate the directions the user can drag the corner. In this case the arrow would indicate the corner can be dragged in horizontal and vertical directions, as well as at a 45 degree angle in or out.

What I did is:

To achieve the Objective,I have created 8 handles in gainedSelection() using createResizeHandle( ---, ---,--- ,--- ) method and I have overridden handleResize()

as follows:

protected Rectangle handleResize(Graphics2D g, JGoView view, Rectangle origRect,
Point newPoint, int whichHandle, int event,
int minWidth, int minHeight)
{
Rectangle newRect = new Rectangle(origRect.x, origRect.y,
origRect.width, origRect.height);

switch (whichHandle) {
case TopLeft:
newRect.x = Math.min(newPoint.x, origRect.x + origRect.width - minWidth);
newRect.y = Math.min(newPoint.y, origRect.y + origRect.height - minHeight);
newRect.width += origRect.x - newRect.x;
newRect.height += origRect.y - newRect.y;
break;

case TopMiddle:
newRect.y = Math.min(newPoint.y, origRect.y + origRect.height - minHeight);
newRect.height += origRect.y - newRect.y;
break;

case SideLeft:
newRect.x = Math.min(newPoint.x, origRect.x + origRect.width - minWidth);
newRect.width += origRect.x - newRect.x;
break;

case TopRight:
newRect.y = Math.min(newPoint.y, origRect.y + origRect.height - minHeight);
newRect.width = Math.max(newPoint.x - origRect.x, minWidth);
newRect.height += origRect.y - newRect.y;
break;

case BottomLeft:
newRect.x = Math.min(newPoint.x, origRect.x + origRect.width - minWidth);
newRect.width += origRect.x - newRect.x;
newRect.height = Math.max(newPoint.y - origRect.y, minHeight);
break;

case SideRight:
newRect.width = Math.max(newPoint.x - origRect.x, minWidth);
break;

case BottomMiddle:
newRect.height = Math.max(newPoint.y - origRect.y, minHeight);
break;

case BottomRight:
newRect.width = Math.max(newPoint.x - origRect.x, minWidth);
newRect.height = Math.max(newPoint.y - origRect.y, minHeight);
break;
}

// only on EventMouseUp do we actually change the bounding rect
if (event == JGoView.EventMouseUp) {
setBoundingRect(newRect);
}
return newRect;
}

My problem is:when I copy 2 objects into the while loop and created a link between them and Now selected the while loop.8 handles are created,but when I drag any one of the handle,the objects are also

getting larger and larger.I want the contents(objects) of the while loop should be fixed,eventhough I drag any of those 8 handles to any direction.

what method I have to override ?

Thnaks,

kiks

Call JGoObject.setAutoRescale(false) on each of your objects.

Hi
where exactly I have to use JGoObject.setAutoRescale(false)?
in initialize() or layoutChildren() or layoutFixedObjects() or getFixedLocationObjects() or createInvisibleObject() or geometryChangeChild() or geometryChange() or shiftChildren()?
Because I set JGoObject.setAutoRescale(false) ,but the problem remains same.

Thanks,kiks

On each of the child objects, when you initialize them.