Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Layout of ports
Layout of ports [message #631861] Sat, 09 October 2010 09:36 Go to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
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 07:55 Go to previous messageGo to next message
Vincent   is currently offline Vincent Friend
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 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 245
Registered: July 2009
Location: Paris Saclay, France
Senior Member
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 #632038 is a reply to message #631861] Mon, 11 October 2010 10:17 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 21
Registered: May 2010
Junior Member
Hi 123star!

Some more information and maybe a screenshot from your side would help us to fine a solution together.

As Vincent asked above, which diagram editor do you use? Is it your custom diagram editor of one of Papyrus editors (Class diagram or Component)?

Then, how do you want to display the ports - as labels in ListCompartment (like this):
http://wiki.eclipse.org/images/9/96/PortsInList.JPG
or like rectangles on the border of a Component (like this):
http://wiki.eclipse.org/images/1/18/PortsAsBorderedItems.JPG
It's important and it's not clear. Because in your message in GMF newsgroup you asked of ports as labels inside Component figure and in this posts it looks more like ports should be as Bordereditems.

Again, if you provide a screenshot with the ports 'get stack one on the other' it would be helpful.

Best wishes,
Tanya.

[Updated on: Mon, 11 October 2010 10:18]

Report message to a moderator

Re: Layout of ports [message #632077 is a reply to message #631861] Mon, 11 October 2010 13:30 Go to previous messageGo to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010
Member
Thank you all for your replies.

Tatiana, sorry I didn't explain the situation well: actually I need both the feature you posted with images.

I use the default Papyrus Component and Class editor.

In the Class diagram I need a Component to show its ports in a compartment like this:

http://wiki.eclipse.org/images/9/96/PortsInList.JPG

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:

http://wiki.eclipse.org/images/1/18/PortsAsBorderedItems.JPG

I tried this, but didn't work:
ArrangeRequest arrangeRequest = new ArrangeRequest(ActionIds.ACTION_ALIGN_RIGHT);
Command arrangeCmd = compEPart.getCommand(arrangeRequest);


Hope it's clearer now.

Thanks again, 123star
Re: Layout of ports [message #632227 is a reply to message #632077] Tue, 12 October 2010 08:20 Go to previous messageGo to next message
Vincent   is currently offline Vincent Friend
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:

http://wiki.eclipse.org/images/1/18/PortsAsBorderedItems.JPG

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 13:57 Go to previous message
Andres  is currently offline Andres Friend
Messages: 57
Registered: July 2010
Member
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
Previous Topic:Enty/Do/Exit of States
Next Topic:Selecting an element after it was created
Goto Forum:
  


Current Time: Thu Jul 02 10:37:11 GMT 2020

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

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

Back to the top