Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Best Practices - associate UI to EObject creation
Best Practices - associate UI to EObject creation [message #1196587] Tue, 19 November 2013 13:42
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
I need to associate a custom piece of UI (usually a custom dialog) to several model items (I have a complex model where most of my EObjects derive from a single EObject class (Identifiable), either directly or through a more complex dependency chain).
This should be used at EObject creation to initialize it.

My current solution is to add a couple of custom methods to the base class:
- public Pane getPane() {} returning the actual graphic object (JavaFX).
- public void setFields() {} applying the values from UI to EObject.
I then override these two methods in derived classes needing more complex UI for initialization.

This works.
Problem (an aesthetic one, if you wish) is I am mixing badly Model with UI.
Side problem is I am unable to model the above as Operation since it seems unable to return an arbitrary Object (Pane).

I would not like to keep a separate UI tree mimicking the Model because it's too easy to get out of sync.

Also an "adapter(EObject o)" method filed with "if (o instanceof Xxxx) ..." seems much less readable than current solution.

What is the "Right Way" to implement this?

Note: I am using just the Standalone Model, no edit, no editor; I use plain databinding to connect to my UI, even after EObject creation.
Previous Topic:[EMF] Required XML Attributes with only one value
Next Topic:EMF/Xtext resource handling
Goto Forum:

Current Time: Thu Oct 01 05:12:36 GMT 2020

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

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

Back to the top