Home » Eclipse Projects » Sirius » Custom Bordered Node Styling / Positioning
Custom Bordered Node Styling / Positioning [message #1478372] |
Tue, 18 November 2014 16:26 |
Stéphane Seyvoz 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
Thank you !
|
|
|
Re: Custom Bordered Node Styling / Positioning [message #1479389 is a reply to message #1478372] |
Wed, 19 November 2014 11:45 |
|
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
|
|
| | | |
Goto Forum:
Current Time: Thu Sep 26 02:07:06 GMT 2024
Powered by FUDForum. Page generated in 0.04079 seconds
|