Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsInherit from PolygonImpl
https://www.eclipse.org/forums/index.php/mv/msg/441480/990575/#msg_990575
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]]>Karol Desnos2012-12-13T09:25:15-00:00Re: Inherit from PolygonImpl
https://www.eclipse.org/forums/index.php/mv/msg/441480/990719/#msg_990719
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]]>Michael Wenz2012-12-13T13:30:34-00:00Re: Inherit from PolygonImpl
https://www.eclipse.org/forums/index.php/mv/msg/441480/990724/#msg_990724
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: