Position of elements on a DDiagram (Layout Provider) [message #1688385] |
Fri, 20 March 2015 11:41  |
Eclipse User |
|
|
|
Hi,
I'm trying to define the position of elements on a DDiagram.
I read the document "Provide a custom arrange-all" to define my own layout provider.
I succeeded in positioning all the elements on a Grid with a GridLayoutProvider.
Now, my aim is to define the position of Bordered Node contained in a Node Container.
Typically, in my definition, the Node Containers is are "function" and the Bordered Node are their parameters.
I'd like to have the Input parameters on the left and the output parameters on the right of each container.
Can it to be done through a Layout Provider ?
I cannot find "BorderItemAwareLayoutProviderHelper" in the example from the last chapter "Enable the bordered nodes layout on a custom LayoutProvider", so I'm not sure to have miss something.
I checked that in my "provides()", I can find out to DNodeContainerEditPart and the DNode4EditPart which are corresponding to the Node Containers and the Bordered Nodes.
Could you give some advices to achieve that?
Thank you in advance.
Franck
|
|
|
Re: Position of elements on a DDiagram (Layout Provider) [message #1690494 is a reply to message #1688385] |
Fri, 27 March 2015 11:49   |
Eclipse User |
|
|
|
Hi,
In a Diagram Description, I defined containers (which represent 'function') containing bordered nodes (which represent whever 'Input Parameters' or 'Ouput Parameters').
My aim is to define the position of the bordered nodes on the Diagram, such as 'Input Parameters' are on the left side, whereas 'Output Parameters' are on the right).
How can I do this ?
I tried to define my own layout provider, but without success.
In the document 'Provide a custom arrange-all', the last part concerning bordered node layout is not enough explicit for me.
It shows how to add a BorderItemAwareLayoutProvider, but not how to define the constrains, ie the way in which the bordered node should be placed.
Regards,
Franck
|
|
|
Re: Position of elements on a DDiagram (Layout Provider) [message #1690694 is a reply to message #1690494] |
Mon, 30 March 2015 12:13   |
Eclipse User |
|
|
|
Hi,
You can have a look at similar post [1] and a feature request that seems
to correspond to your need [2].
[1] https://www.eclipse.org/forums/index.php/t/796142/
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=440296
Regards,
Steve
Le 27/03/2015 16:49, Franck MIMET a écrit :
> Hi,
>
> In a Diagram Description, I defined containers (which represent
> 'function') containing bordered nodes (which represent whever 'Input
> Parameters' or 'Ouput Parameters').
>
> My aim is to define the position of the bordered nodes on the Diagram,
> such as 'Input Parameters' are on the left side, whereas 'Output
> Parameters' are on the right).
>
> How can I do this ?
> I tried to define my own layout provider, but without success.
> In the document 'Provide a custom arrange-all', the last part concerning
> bordered node layout is not enough explicit for me.
> It shows how to add a BorderItemAwareLayoutProvider, but not how to
> define the constrains, ie the way in which the bordered node should be
> placed.
>
> Regards,
> Franck
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: Position of elements on a DDiagram (Layout Provider) [message #1690949 is a reply to message #1690944] |
Wed, 01 April 2015 04:34   |
Eclipse User |
|
|
|
Hello Frank,
I think that you should take a look at
org.eclipse.sirius.diagram.sequence.ui.tool.internal.figure.SouthCenteredBorderItemLocator.
This BorderItemLocator is used in the sequence diagram to have the "end
of life" at the bottom of a lifeline and centered.
You will see that it overrides some methods to set the position as
PositionConstants.SOUTH and is defined in specificly provided EditPart,
by override of createBorderItemLocator.
Regards,
Steve
Le 01/04/2015 09:46, Franck MIMET a écrit :
> Thank you for help.
>
> I noticed that several people were addressing the same issue and that a
> new feature was registered in Bugzilla.
> Unfortunatly, that don't solve my problem :(
>
> From the document "Viewpoint - Provide a custom style", I created a
> StyleConfigurationProvider.
> But it is clear how to provider a BorderItemLocator, but not how to
> define it, ...
>
> The only Locator that is tunable is the NameBorderItemLocator, because
> it take a DNode and a IFigure in parameters.
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Position of elements on a DDiagram (Layout Provider) [message #1691007 is a reply to message #1690949] |
Wed, 01 April 2015 10:27   |
Eclipse User |
|
|
|
Hello Steve!
I'll have a look at org.eclipse.sirius.diagram.sequence.ui.tool.internal.figure.SouthCenteredBorderItemLocator.
I have created my own MyBorderItemLocatorProvider, greatly inspired from DefaultBorderItemLocatorProvider:
public IBorderItemLocator getBorderItemLocator(final IFigure figure,
final DDiagramElement vpElementOwner, final DDiagramElement diagramElementBorderItem) {
BorderItemLocator locator = new BorderItemLocator(figure, PositionConstants.WEST, 1);
locator.setCurrentSideOfParent(PositionConstants.EAST);
locator.setPreferredSideOfParent(PositionConstants.EAST);
return locator;
}
My container has 3 bordered nodes.
In debug, the function is called 3 times, one for each of the bordered nodes, but only the first bordered node is on the right, and the two last on the left.
Here is a picture of the result.
The green and red squares are the bordered nodes 

Have you got an explanation?
Regards,
Franck
[Updated on: Wed, 01 April 2015 10:50] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07355 seconds