Understanding container shapes and selection [message #805627] |
Fri, 24 February 2012 00:54 |
Josef Pohl Messages: 82 Registered: January 2012 |
Member |
|
|
Hi there,
Well, I kind of gave up on my BoxRelativeAnchor approach. It did not seem to be going anywhere and I could not get rid of the anchor frame.
So I am back to the ChopboxAnchor...
Here is the structure I have so far (--> implies child):
ContainerShape(invisible) --> ContainerShape(polygon) --> Shape(text)
Here is the code for the first two elements:
Polygon p;
ContainerShape shapePoly;
int polyxy[] = new int[] {25,0,100,0,75,50,0,50};
{
Rectangle invisible = gaService.createInvisibleRectangle(containerShape);
gaService.setLocationAndSize(invisible, context.getX(), context.getY(), width, height+offset);
shapePoly = peCreateService.createContainerShape(containerShape, true);
p = gaService.createPolygon(shapePoly, polyxy);
p.setBackground(manageColor(CLASS_BACKGROUND));
p.setForeground(manageColor(CLASS_FOREGROUND));
p.setLineWidth(2);
// p.setParentGraphicsAlgorithm(invisible);
Graphiti.getPeService().setPropertyValue(shapePoly, "shape-type", "parallelogram");
gaService.setLocationAndSize(p, 0, 0, width, height);
// create link and wire it
link(containerShape, addedClass);
link(shapePoly, addedClass);
}
The chopboxAnchor is applied to the shapePoly ContainerShape.
I add the Shape holding the text into the shapePoly as well. When I put the text (and shape) as a child of the outer ContainerShape the polygon hides the text. Is there a way to override this behavior?
I have a corresponding layout that works well now and the connection features connect to the polygon, which is very nice.
However now I am back to the problem of trying to override the default selection behavior. Since both ContainerShapes are active I can select and move and resize them independently.
In implementing the getClickArea and getSelectionBorder what do I need to return in order to get these to act in concert with each other? Previously I have returned (in getClickArea and in getSelectionBorder) the child GA. I presume, based on earlier experiments, that I would still want to return the polygon. Is this correct?
If, in this instance, I use setParentGraphicsAlgorithm I lose the nesting of shapes from above and a few other issues crop up. Perhaps I need to try a bit harder in this direction if anyone thinks that this would be the way to go.
Thanks, as always,
Joe
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03128 seconds