Non-EMF Domain Objects

By deafult Graphiti supports domain models from the EMF world and offers automated support for reacting to changes and updating the editor. Since not only EObjects but simple POJOs can be passed top all relevant framework APIs, it is also possible to use non-EMF domain objects with Graphiti.

Of course the framework cannot support automated notification to changes in such domain models, so the tool builder needs to hook an appropriate listener into the framework. Here's the process how to do this:

  1. Create an appropriate specific domain listener class. As an example you can have a look at DomainModelChangeListener in the Graphiti framework; this class does this job for EMF models.
  2. Subclass DiagramEditor and override its method registerBOListener. In that method create an instance of your listener from step 1 and register it.
  3. Create an appropriate notification service class by subclassing DefaultNotificationService or implementing its interface. An instance of this class is used by the framework to get the connection between domain objects and their graphical representation (method calculateLinkedPictogramElements) and triggers the actual update of the graphical representation in the diagram (method updatePictogramElements) unsing the appropriate update features. The class DeafultNotificationService does the job for EMF models.
  4. In your Diagram Type Provider implementation create and return an instance of the class from step 3 within the method getNotificationService.

 


Copyright (c) SAP AG 2005, 2010.