Re: UML Sequence diagramm for activating a figure in a graphical editor
Friday, June 10, 2005 03:13 AM
First of all we should know that these type of applications use objects to represent each shape in the graphic diagram. Second, each shape occupies some area on the screen. Third, in your case, we want to use MVC.
Make three Object Lifelines with labels "Window", "Control" and "Model".
The event handle "Page/Control_Click", would be the event which would be called when user would click on the screen. Draw a message between "Window" and "Control" to show this Event.
Now, from this method you would call IsShapClick(x, y): Object. This method would take (x, y) coordinates of the mouse click and go to search in the Shapes Collection of the current diagram. If this method would find (x, y) coordinates laying in an object's rectangle then it would return the object reference other wise it would return the Null. Draw a return message between "Control" and "Model" to show this method.
Now, place a condition ( like [IsShapClick(x, y) <> Null] ) to check the return value. If the return value is not null then call ActivateShape(Object) method of Model Layer. This method would deactivate the current object (if any) and activate the object received as parameter. Draw a message between "Control" and "Model" to show this method.
This is your diagram, which is implementing MVC. And the shape become activated on user click on a shape. But if user click on surface nothing would happen. Moreover, if there is some shape which is already activated then it would become deactivated.
S. Haider Raza,