Layout of ports [message #631861] |
Sat, 09 October 2010 05:36  |
Eclipse User |
|
|
|
Hi,
finally I managed to show the programmatically created ports in the diagram ( if someone wants to know how, just ask ), but when added in the Component they get stack one on the other:
is there a method to place them uniformly?
Thanks in advance, 123star
|
|
|
Re: Layout of ports [message #632005 is a reply to message #631861] |
Mon, 11 October 2010 03:55   |
Eclipse User |
|
|
|
123star wrote on Sat, 09 October 2010 05:36 | Hi,
finally I managed to show the programmatically created ports in the diagram ( if someone wants to know how, just ask ), but when added in the Component they get stack one on the other:
is there a method to place them uniformly?
|
Yes, there are methods in the locator class. The locator class is in charge of handling all the location related aspects of the border node.
See
org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator .calculateNextNonConflictingPosition(Point, int, int, IFigure, Rectangle)
and
org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator .getConflictingBorderItemFigure(Point, IFigure)
Though, when I am reading your post, I'm not sure whether you are working on an existing diagram or whether you are creating your own one.
- In case you are working on an existing one : this locator class should be part of the diagram plugin. Post a bug, since it should handle this situation. You may of course read the other case and suggest a patch.
- In case you are developping your own diagram : ou can add a specific locator from the gmfgen file : in "Papyrus Extensions" node, add a "Specific Locator" child node. The specific locator should extend org.eclipse.papyrus.diagram.common.locator.AdvancedBorderIte mLocator or at least implement org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator
|
|
|
|
|
|
Re: Layout of ports [message #632227 is a reply to message #632077] |
Tue, 12 October 2010 04:20   |
Eclipse User |
|
|
|
123star wrote on Mon, 11 October 2010 09:30 |
In the Component diagram I create some ports and show in the Component, but the rectangles representing the ports are all at the same position in the top left corner ( sorry I have no image ), so the names of the ports cannot be read.
There must be some distance between the rectangles and if possible align the rectangles on one side of the border of the Component, it's ok even in this way:

I tried this, but didn't work:
ArrangeRequest arrangeRequest = new ArrangeRequest(ActionIds.ACTION_ALIGN_RIGHT);
Command arrangeCmd = compEPart.getCommand(arrangeRequest);
|
I guess you're talking about the composite diagram.
The behavior you are describing happens because the org.eclipse.papyrus.diagram.composite.custom.locators.PortPo sitionLocator.getValidLocation(Rectangle, IFigure) method does not take in account existing ports to avoid conflicts.
I really think it should and that this is a bug. In my opinion, representing ports on each other, even if the user seemed to ask so, doesn't make sense.
You can post a bug on this aspect.
For information, correct behavior, is implemented in a lot of other locators, using the two methods I talked about in my previous post. At least, I'm sure it is in :
- org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator
- org.eclipse.papyrus.diagram.activity.locator.PinPositionLoca tor
- org.eclipse.papyrus.diagram.activity.locator.ActivityParamet erNodePositionLocator
As for aligning on one side, this is still manageable in the locator.
Though, this one may be intended.
See the method : org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator .getPreferredSideOfParent()
|
|
|
Re: Layout of ports [message #650550 is a reply to message #631861] |
Tue, 25 January 2011 08:57  |
Eclipse User |
|
|
|
Hi 123star,
Can you explain me how do you "managed to show the programmatically created ports"?...i am interested in it because i want to do a similar task, im not very sure about the class and package that I should work.
Im need that programatically, I can edit the label of the port
when a class is applicated to it...
Can you help me?
Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.18461 seconds