Domain model and figure hierarchy out of sync [message #204405] |
Thu, 04 September 2008 16:16 |
Zsolt Török Messages: 22 Registered: July 2009 |
Junior Member |
|
|
Hi All,
We're developing a GMF-based diagram editor, and we're in the lucky
position of being able to slightly influence the underlying domain model
structure. However, the rules for visual representation are clearly
defined. We have created our domain model earlier in the development
process, and now we're having difficulties mapping the domain model to the
visualization. Since we have model transformations and lots of code
relying on the current structure, I'm quite hesitant to change the domain
model just to make visualization easier.Sso we've been trying to customize
some of our diagram code, but it quickly got very complex...
Let me give you a simplified example and ask for your advice:
* We have three classes: Model, Element, and Choice.
* Model contains Elements and Choices, so this is the equivalent of the
diagram canvas. Elements and Choices are displayed as nodes on the canvas.
* Choices are _referencing_ Elements, but do not _contain_ them. However
on the diagram the Elements referenced by a Choice must be represented as
child nodes inside a compartment of the Choice node.
In the GMF Mapping model I can't set up the compartment to allow this,
since I can only select from the containment features of Choice when
configuring a child reference, and not the containment feature of Model.
After generating some code ignoring Mapping model validation error, we
tried to modify some methods to implement the above functionality:
* XXXVisualIDRegistry.canCreateNode() and .getNodeVisualID()
* ChoiceItemSemanticEditPióolicy.addDestroyChildNodeCommand() (to delete
children when deleting Choice from diagram)
* ChoiceCompartmentItemSemanticEditPolicy.getCreateCommand() (to enable
creating Elements inside the comparment)
* XXXDiagramUpdater.getChoiceCompartmentSemanticChildren()
After days of work we got a bit closer, but we're still having problems
and can't quite get it right. I tried searching the web for people with
similar problems (different visualization and domain model structure), but
found nothing. Is there a preferred way of implementing this, or do I
really have to modify my domain model so that Choice _contains_ its child
Elements?
Thanks in advance,
Zsolt
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.53249 seconds