|
Re: Layout of ports [message #632005 is a reply to message #631861] |
Mon, 11 October 2010 07:55 |
Vincent Messages: 35 Registered: December 2009 |
Member |
|
|
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 #632008 is a reply to message #631861] |
Mon, 11 October 2010 08:06 |
|
In the framework gmf, it is exist only a default place to put borderItemelement. if you want to display uniformely ports, you need after creating this kind of view element to execute a command that look for all ports in your class and display it uniformaly.
Patrick
|
|
|
|
|
Re: Layout of ports [message #632227 is a reply to message #632077] |
Tue, 12 October 2010 08:20 |
Vincent Messages: 35 Registered: December 2009 |
Member |
|
|
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()
|
|
|
|
Powered by
FUDForum. Page generated in 0.07045 seconds