Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Understanding container shapes and selection
Understanding container shapes and selection [message #805627] Fri, 24 February 2012 00:54 Go to next message
Josef Pohl is currently offline Josef PohlFriend
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




Re: Understanding container shapes and selection [message #805937 is a reply to message #805627] Fri, 24 February 2012 10:18 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1916
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Joe,

did you have a look into the tutorial? The shape displaying the class uses a
probably similiar visualization (except for a rectangle instead of a
polygon). There the outer invisible rectangle belongs to the containerShape
and the rectangle (your polygon does not belong to a an own container shape;
intead it is a child GA of the invisible rectangle.

By doing it that way you avoid having two active shapes that are complicated
to deal with and you appearently don't need both being active (trying to set
the inner one to inactive would also be a option).

Michael
Re: Understanding container shapes and selection [message #806170 is a reply to message #805937] Fri, 24 February 2012 16:29 Go to previous message
Josef Pohl is currently offline Josef PohlFriend
Messages: 82
Registered: January 2012
Member
Hi Michael,

I have tried to implement the solution in accordance with the tutorial. The problem that arises is that the connection features connect to the outer invisible rectangle and not to the polygon itself.

index.php/fa/7287/0/

I have not been able to find any way around this issue. Sadly this is somewhat of a requirement for me as when the diagram get very crowded and the nodes become larger in size the connections can get misconstrued.

Unfortunately setting the referencedGraphicsAlgorithm on the chop box does not seem to help either.

In a previous instantiation I noted how I tried to use a BoxRelativeAnchor on another invisible polygon that lays on top of the visible polygon. There I was unable to avoid the selection of the frame surrounding the BoxRelativeAnchor. (The odd black box.)

Do you, or does anyone, have any thoughts on how I can proceed with this?

Thanks for your response and time,
Joe
Previous Topic:Connection decorators do not get deleted
Next Topic:Start graphiti from an own newWizard
Goto Forum:
  


Current Time: Wed May 27 00:53:57 GMT 2020

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

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

Back to the top