Question

I have a model where one model object is represented multiple times in the displayed graph. Consider the following model:

  1. There are many Partitions
  2. Every partition has x SourcePorts and y DestinationPorts
  3. Every SourcePort may be connected to a DestinationPort
  4. One Partition is selected

I want to visualize this such that the selected Partition is in the center:

  1. On the left there are all Partitions visible with all the SourcePorts painted
  2. In the center there is the selected Partition with all Ports painted
  3. On the right there are all Partitions visible with all the DestinationPorts painted
  4. All connections between Ports are painted
  5. The user could manipulation the Ports and Connections (Add/Remove Ports and Connections)

So my model of a Partition maps to multiple figures. An ordinary Partition is painted twice (one time on the left and one time on the right) and the selected Partition three times.

How to implement this in GEF? Should I create one EditPart per Partition and let it return a IFigure for all graphical representations? Or should every instance that is drawn to the screen have it's own EditPart? Or is it benificial to create an extra model where one Partition is represented through multiple model instances?

Was it helpful?

Solution

I suggest to create a different model which contains all the visualizazion data: in this way you could link an element of the data model to multiple instance of eleemnts of the visualization model and solve your problem in a simple and elegant way. Moreover you don't "pollute" the data model with all the data needed for the visualization, i.e. the coordinate of the elements in the diagram.

Saluti

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top