Skip to main content



      Home
Home » Modeling » Graphiti » Inherit from PolygonImpl(Why is it discouraged?)
Inherit from PolygonImpl [message #990575] Thu, 13 December 2012 04:25 Go to next message
Eclipse UserFriend
Hello,

I'm currently designing a GUI based on Graphiti that will use triangular shapes for different purposes.

The problem I have with polygons is that they do not provide a "simple" way to resize them. By simple, I mean that using the GaService.setSize() has no apparent effect on Polygons.

I saw a few topics on this issue on this forum, where the advised solution is usually to create a specific "ResizeFeature" to change the size of the Polygon. However, since I'm planning to use triangles in many places, I fear that this will result in creating specific ResizeFeature for each triangle use. Moreover, I think is would be more natural to resize my triangles using the same methods as the one used to resize a Rectangle or an Ellipse.

Consequently, I created a Triangle class that inherits from the "PolygonImpl" class, and that implements the setWidth and setHeight methods.
The code of this class is attached to this post.

My class seems to work correctly, despite the following warning:
Discouraged access: The type PolygonImpl is not accessible due to restriction on required library.


What is the reason for discouraging the inheritance to PolygonImpl while authorizing the custom implementation of the Polygon interface?

What do you think would be the best solution for this issue?

Best Wishes,

Karol
Re: Inherit from PolygonImpl [message #990719 is a reply to message #990575] Thu, 13 December 2012 08:30 Go to previous messageGo to next message
Eclipse UserFriend
Karol,

right, this is not really consistent. In fact all the Graphiti EMF model
object interfaces should not be implemented by clients. This is also
suggested by EMF itsself.

The getters and setters on the model object are and should be really simple
plain methods, without any calculation logic inside. That's the part where
the Graphiti service layer comes into the game. Maybe it would make sense to
add this logic to the setSize service in case a polygon is passed in. Would
you please open an enhancement bugzilla for this if you would like to see
that in the framework?

Michael
Re: Inherit from PolygonImpl [message #990724 is a reply to message #990719] Thu, 13 December 2012 15:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

while I see the API-based approach for Graphiti, we have been testing and trying an approach based on inheriting from the Graphiti meta-model. I have presented that at the last Eclipse Demo Camp in Munich and made a blog post out of the presentation:

http://5ise.quanxinquanyi.de/2012/12/13/the-way-we-use-graphiti/

We also use the generation gap pattern for this approach:

http://5ise.quanxinquanyi.de/2012/11/09/generation-gap-pattern-ecore-graphiti-and-nice-pieces-of-mwextext/

Best Regards,

Andreas

Re: Inherit from PolygonImpl [message #991297 is a reply to message #990724] Tue, 18 December 2012 07:11 Go to previous message
Eclipse UserFriend
Andreas,

cool ideas, thanks for sharing that!

Michael
Previous Topic:Scrollbar
Next Topic:Non-EMF Diagram Saving (only view information)
Goto Forum:
  


Current Time: Thu Jul 24 20:56:22 EDT 2025

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

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

Back to the top