Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Custom Bordered Node Styling / Positioning
Custom Bordered Node Styling / Positioning [message #1478372] Tue, 18 November 2014 16:26 Go to next message
Stéphane Seyvoz is currently offline Stéphane SeyvozFriend
Messages: 21
Registered: October 2014
Junior Member
The issue

I have Container Nodes representing components, hosting provided and required interfaces represented as bordered nodes. I want to force the required interfaces on the right/east side of components, and provided on the left/west side. I tried different things, but none worked. Here is a recapitulation of my tentatives and their result.

Tentative 1: The "org.eclipse.sirius.diagram.ui.styleConfigurationProvider" Sirius extension point

Inspired from:
Sirius Provide custom style
and
Sirius >> Problem with Bordered Nodes

I tried to use the org.eclipse.sirius.diagram.ui.styleConfigurationProvider extension point with my custom class implementing org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.IStyleConfigurationProvider, to match my components viewpoint mappings in the provides and createStyleConfiguration methods, and returning a custom class implementing org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.StyleConfiguration, to have my own getBorderItemLocator method, itself served by a factory class implementing org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.BorderItemLocatorProvider.

The latter custom factory class getBorderItemLocator method returns different GMF's "new BorderItemLocator(figure, PositionConstants.EAST/WEST/LEFT/RIGHT)" according to the "DDiagramElement diagramElementBorderItem" argument to match my provided/required interfaces, and I use the standard "new DBorderItemLocator(figure, PositionConstants.NSEW)" otherwise as default case, like in Sirius' DefaultBorderItemLocatorProvider class (line 55 in the link below).

When I enable breakpoints on the corresponding lines, it stops and everything is called. The problem is: It has no effect on the representation whatsoever... I don't know what to do.

Quick resources links for convenience (may not be up-to-date):
- BorderItemLocatorProvider.java
- DefaultBorderItemLocatorProvider

Tentative 2: GMF's "org.eclipse.gmf.runtime.diagram.ui.editpartProviders" extension point

Not being able to make the first tentative work according to the "provide custom style" documentation, I continued down the Sirius Provide custom style documentation page, and thought I would try the GMF way.

I created my own EditPartProvider extending GMF's AbstractEditPartProvider, matching my components thanks to the view.getElement() DNodeSpec/DNodeContainerSpec and its "actual mapping" for filtering, and then returning a custom EditPart class for my specific case.

I made my EditPart class extend Sirius' DNodeContainer2EditPart (since it was the kind of element I could find for my elements at debug time), and overriding its createBorderItemLocator method, using the same "BorderItemLocator factory" as in Tentative 1.

This time, I obtained a weird representation where all my components are displayed as a "double" graphical entity (I believe the original EditPart and graphical element is still created), and even if my BorderItemLocator code was called (breakpoints prove it), the Bordered Nodes interfaces are still not on any good side.

Conclusion:

What can I do to make my bordered nodes stick on the desired side if all this did not work...? Any idea/suggestion would be welcome Smile

Thank you !
Re: Custom Bordered Node Styling / Positioning [message #1479389 is a reply to message #1478372] Wed, 19 November 2014 11:45 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 300
Registered: July 2009
Senior Member
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,


Le 18/11/2014 17:26, Stéphane Seyvoz a écrit :
> The issue
>
> I have Container Nodes representing components, hosting provided and
> required interfaces represented as bordered nodes. I want to force the
> required interfaces on the right/east side of components, and provided
> on the left/west side. I tried different things, but none worked. Here
> is a recapitulation of my tentatives and their result.
>
> Tentative 1: The
> "org.eclipse.sirius.diagram.ui.styleConfigurationProvider" Sirius
> extension point
>
> Inspired from:
> https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html
>
> and
> https://www.eclipse.org/forums/index.php/t/796142/
>
> I tried to use the
> org.eclipse.sirius.diagram.ui.styleConfigurationProvider extension point
> with my custom class implementing
> org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.IStyleConfigurationProvider,
> to match my components viewpoint mappings in the provides and
> createStyleConfiguration methods, and returning a custom class
> implementing
> org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.StyleConfiguration,
> to have my own getBorderItemLocator method, itself served by a factory
> class implementing
> org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.BorderItemLocatorProvider.
>
>
> The latter custom factory class getBorderItemLocator method returns
> different GMF's "new BorderItemLocator(figure,
> PositionConstants.EAST/WEST/LEFT/RIGHT)" according to the
> "DDiagramElement diagramElementBorderItem" argument to match my
> provided/required interfaces, and I use the standard "new
> DBorderItemLocator(figure, PositionConstants.NSEW)" otherwise as default
> case, like in Sirius' DefaultBorderItemLocatorProvider class (line 55
> in the link below).
>
> When I enable breakpoints on the corresponding lines, it stops and
> everything is called. The problem is: It has no effect on the
> representation whatsoever... I don't know what to do.
>
> Quick resources links for convenience (may not be up-to-date):
> -
> https://eclipse.googlesource.com/sirius/org.eclipse.sirius/+/c0f93c3da99fbc2023d0d5cbbe4fbf7b3e5b5c9a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/api/graphical/edit/styles/BorderItemLocatorProvider.java
>
> -
> https://eclipse.googlesource.com/sirius/org.eclipse.sirius/+/0745304c5dcfd33794d483b3de844eaa02024b10/plugins/org.eclipse.sirius.diagram/specific/org/eclipse/sirius/diagram/tools/api/graphical/edit/styles/DefaultBorderItemLocatorProvider.java
>
>
> Tentative 2: GMF's
> "org.eclipse.gmf.runtime.diagram.ui.editpartProviders" extension point
>
> Not being able to make the first tentative work according to the
> "provide custom style" documentation, I continued down the
> https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html
> documentation page, and thought I would try the GMF way.
>
> I created my own EditPartProvider extending GMF's
> AbstractEditPartProvider, matching my components thanks to the
> view.getElement() DNodeSpec/DNodeContainerSpec and its "actual mapping"
> for filtering, and then returning a custom EditPart class for my
> specific case.
>
> I made my EditPart class extend Sirius' DNodeContainer2EditPart (since
> it was the kind of element I could find for my elements at debug time),
> and overriding its createBorderItemLocator method, using the same
> "BorderItemLocator factory" as in Tentative 1.
>
> This time, I obtained a weird representation where all my components are
> displayed as a "double" graphical entity (I believe the original
> EditPart and graphical element is still created), and even if my
> BorderItemLocator code was called (breakpoints prove it), the Bordered
> Nodes interfaces are still not on any good side.
>
> Conclusion:
>
> What can I do to make my bordered nodes stick on the desired side if all
> this did not work...? Any idea/suggestion would be welcome :)
>
> Thank you !


--
Laurent - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Custom Bordered Node Styling / Positioning [message #1479636 is a reply to message #1479389] Wed, 19 November 2014 15:54 Go to previous messageGo to next message
Stéphane Seyvoz is currently offline Stéphane SeyvozFriend
Messages: 21
Registered: October 2014
Junior Member
Done !

Thanks for the fast answer.
Re: Custom Bordered Node Styling / Positioning [message #1651275 is a reply to message #1479636] Thu, 05 March 2015 07:57 Go to previous messageGo to next message
Martin Schreiber is currently offline Martin SchreiberFriend
Messages: 10
Registered: March 2015
Junior Member
Hi,

I try to do the same thing. I created my own StyleConfiguration by extending the SimpleStyleConfiguration class and override the method "getNameBorderItemLocator" and "getBorderItemLocatorProvider". The "getNameBorderItemLocator" is called and there everything works fine, but the "getBorderItemLocatorProvider" is never called and so I am not able to provide a custom implementation there.
Any ideas why "getBorderItemLocatorProvider" is never called?

thanks
martin
Re: Custom Bordered Node Styling / Positioning [message #1651830 is a reply to message #1651275] Thu, 05 March 2015 14:37 Go to previous message
Martin Schreiber is currently offline Martin SchreiberFriend
Messages: 10
Registered: March 2015
Junior Member
Sorry, was my fault, I missed to change my StyleConfigurationProvider.provides to also provide the StyleConfiguration for the element which contains the bordered items.
Previous Topic:Integration with EMF Compare
Next Topic:Element-Based Edges
Goto Forum:
  


Current Time: Thu May 09 23:01:08 GMT 2024

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

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

Back to the top