Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368398

Summary: Support Visual Effects - visual diagram properties automatically updated based on the values of semantic element(s)
Product: [Modeling] GMF-Tooling Reporter: Michael Golubev <borlander>
Component: Generation / TemplatesAssignee: Svyatoslav Kovalsky <kovalsky>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: borlander, milon_mi7
Version: 3.0Flags: borlander: juno+
Target Milestone: 3.0M6   
Hardware: PC   
OS: Windows XP   
Whiteboard: Diagram Features
Attachments:
Description Flags
initial revision - custom/color/visible pins for nodes - 100% generated
borlander: iplog+, borlander: review+
initial revision - sample model and diagram none

Description Michael Golubev CLA 2012-01-11 17:01:46 EST
There are quite common requirements to make diagram representation of the element depending on its semantic properties. 

Examples are:
- on UML diagrams the abstract classes are shown with name in italic font 
- validation-like color coding, when the element is required to be displayed in different colors when some numeric value exceeds the threshold for the value
- just a graphical way to display the boolean property of an element, say, BPMN actions that are shown as rounded rectangle with an inner shape which is specific to the action type (star, plus, mail, etc)

We are going to support this at the modeling/generation level, that is neither of use cases above should require the actual coding or generated @not code. 

The way to support it is as follows: 
- in the GMFGraph model we will define Pin's -- expressing the "capability of the graphical element to react on the set of incoming parameters". 
-- the Pin itself holds an information about the the name of corresponding 'behavior' and the types of incoming arguments
-- only primitive types of the arguments will be supported (also the number of arguments will be unlimited)
-- there will be predefined set of pin's covering the standard set of the figure properties (color, font-related properties, visibility, dimensions (?), ...)
-- in addition there will be a CustomPin's allowing to model pre-coded behavior of the CustomFigure's

- in the GMFMap model we will VisualEffect -- the binding between the OCL expression written in the context of the underlying semantic element and the pin defined for corresponding diagram element.
-- the toolsmith will provide the OCL expression that is evaluated against the diagram element and produce the value of some pin-specific type.
-- we will have a static validation that checks the applicability of the toolsmith-given OCL and the particular pin
-- we will rely on some reasonable convention on how to express the non-primitive notions like color's, dimensions etc 
-- we will rely on some reasonable convention on how to express the multi-parameter values to be passed to the custom pins

Based on that input GMFT will be able to generate the gluing code that 
- tracks the value of the OCL during the diagram runtime
- on every change of the value updates the graphical property accordingly
Comment 1 Svyatoslav Kovalsky CLA 2012-01-11 21:00:24 EST
Created attachment 209347 [details]
initial revision - custom/color/visible pins for nodes - 100% generated
Comment 2 Svyatoslav Kovalsky CLA 2012-01-11 21:05:55 EST
Created attachment 209348 [details]
initial revision - sample model and diagram
Comment 3 Michael Golubev CLA 2012-05-30 01:05:45 EDT
Delivered in M7
Comment 4 Iqbal Hossain CLA 2012-09-14 05:39:14 EDT
how can i define a PIN? can u describe in details? image will be preferred.
suppose i have a node in my diagram is NODE1 and have attribute val. if i put 1 in value the NODE1 color will be white if 2 then it become red.... how can i do it? please explain as details as possible....I am a beginner in GMF....

thnx in advance...