Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330482 - [diagram] Support diagram editing in Sapphire UI
Summary: [diagram] Support diagram editing in Sapphire UI
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Shenxue Zhou CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2010-11-17 12:07 EST by Shenxue Zhou CLA
Modified: 2021-11-19 09:22 EST (History)
2 users (show)

See Also:


Attachments
First cut of the diagram def files (7.09 KB, patch)
2010-11-17 12:14 EST, Shenxue Zhou CLA
no flags Details | Diff
diagram def files incorporating kosta's comments (9.72 KB, patch)
2010-11-17 13:17 EST, Shenxue Zhou CLA
no flags Details | Diff
Adding connection decorator specification (12.49 KB, patch)
2010-11-17 18:51 EST, Shenxue Zhou CLA
no flags Details | Diff
diagram def files incorporating kosta's comments (12.27 KB, patch)
2010-11-18 12:11 EST, Shenxue Zhou CLA
no flags Details | Diff
A basic diagram editor based on Graphiti (111.17 KB, patch)
2010-11-30 17:49 EST, Shenxue Zhou CLA
no flags Details | Diff
A basic diagram editor based on Graphiti with save/restore (157.85 KB, patch)
2010-12-06 17:35 EST, Shenxue Zhou CLA
no flags Details | Diff
Supporting top level connections and connections embedded inside nodes (195.76 KB, text/plain)
2010-12-14 13:30 EST, Shenxue Zhou CLA
no flags Details
Support node images (209.34 KB, patch)
2010-12-20 13:28 EST, Shenxue Zhou CLA
no flags Details | Diff
The book image for the library sample (4.57 KB, patch)
2010-12-20 13:29 EST, Shenxue Zhou CLA
no flags Details | Diff
The book image for the library sample (4.15 KB, image/png)
2010-12-20 13:32 EST, Shenxue Zhou CLA
no flags Details
Support deletion of nodes and connections (219.96 KB, patch)
2010-12-21 17:42 EST, Shenxue Zhou CLA
no flags Details | Diff
Diagram Parts now listen to model events (247.42 KB, patch)
2011-01-11 12:43 EST, Shenxue Zhou CLA
no flags Details | Diff
Diagram Node switches image based on expression (255.18 KB, patch)
2011-01-13 15:31 EST, Shenxue Zhou CLA
konstantin: iplog+
Details | Diff
The book image for books with no titles for the library sample (4.87 KB, image/png)
2011-01-13 15:32 EST, Shenxue Zhou CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shenxue Zhou CLA 2010-11-17 12:07:39 EST
Build Identifier: M20100909-0800

Currently Sapphire Editor consists of form based editors and xml source editors. This bug is tracking an enhancement request to support diagram editing in Sapphire framework.

Reproducible: Always
Comment 1 Shenxue Zhou CLA 2010-11-17 12:14:12 EST
Created attachment 183320 [details]
First cut of the diagram def files
Comment 2 Konstantin Komissarchik CLA 2010-11-17 12:43:26 EST
Good start...

1. IDiagramLinkDef needs @GenerateImpl.
2. IDiagramDef should drop @XmlRootBinding. The diagram definitions will be contained inside ISapphireUiDef. Similarly to EditorPageDefs property.
3. Take a look at IEditorPageDef (which is really for form pages only, but we can rename it later). I think IDagramDef should probably be IDiagramPageDef and include Id, PageName and PageHeaderText properties.
4. All three of these need to extend ISapphirePartDef rather than IModelElement. Take a look at ISapphirePartDef. It has some built-in facilities for hints, actions, documentation that you will find useful later.
5. Looking at the IDiagramLinkDef, I think the use of the term "link" here is problematic as it can have several meanings in this context (think hyperlink, often shortened to just link). I think that the term "connection" would be less ambiguous here... IDiagramConnectionDef

I am working on Bug 329074 right now that is going to formalize label/provider/expression pattern that we discussed yesterday. I should be done later today and will post details. Hold off on trying to define the label provider interface.
Comment 3 Shenxue Zhou CLA 2010-11-17 13:17:17 EST
Created attachment 183327 [details]
diagram def files incorporating kosta's comments
Comment 4 Konstantin Komissarchik CLA 2010-11-17 13:26:02 EST
Looking at IDiagramConnectionDef, I think referencing endpoints as source and target is going to be too limiting very quickly. Let's create IDiagramConnectionEndpointDef with two properties (Property and ConnectorType). ConnectorType should be an enum. The IDiagramConnectionDef should then have two generic properties (maybe Endpoint1 and Endpoint2). I suppose this could also be modeled as a list that's validated at fixed length of 2.
Comment 5 Konstantin Komissarchik CLA 2010-11-17 15:05:41 EST
I just committed the changes for Bug 329074 that I was describing. Sync to the latest then see IMasterDetailsTreeNodeDef.Label, ILabelDef, Expression and StaticExpression classes. The last two are in the modeling plugin.

Look at MasterDetailsContentNode.initLabelExpression() to see how those are processed.

You can go ahead and merge your patch with these changes. You should use ILabelDef in IDiagramNodeDef and IDiagramConnectionDef.

The expression classes themselves are more generic, as the expression can return a value of any time. I will work to use it in place of the existing SapphireCondition class, for instance. I also starting to work on defining a expression language that can be embedded directly into sdef files and model annotations instead of implementing separate java classes.
Comment 6 Shenxue Zhou CLA 2010-11-17 18:51:14 EST
Created attachment 183361 [details]
Adding connection decorator specification

Connection's endpoints can have decorators associated with them
Comment 7 Konstantin Komissarchik CLA 2010-11-18 01:10:11 EST
1. In IDiagramConnectionDef, ConnectionEndpoint1 and ConnectionEndpoint2 properties and their xml binding are over-qualified. These can be shortened to be just "endpoint1" and "endpoint2".

2. In IDiagramConnectionEndpointDef, ConnectionDecoratorType is over-qualified. I think this can be shortened to just "type".

3. ConnectionDecoratorType enum's name feels ambiguous. Let's rename it to ConnectionEndpointType.

Also, take a look at the changes that I just committed for Bug 329074. They shouldn't directly impact this patch, but will influence future implementation of this feature.
Comment 8 Shenxue Zhou CLA 2010-11-18 12:11:48 EST
Created attachment 183403 [details]
diagram def files incorporating kosta's comments

name changes
Comment 9 Shenxue Zhou CLA 2010-11-30 17:49:31 EST
Created attachment 184197 [details]
A basic diagram editor based on Graphiti

A basic diagram editor based on Graphiti plus a simple Map sample. It fixes node and connection shapes
Comment 10 Shenxue Zhou CLA 2010-11-30 17:56:29 EST
To run the simple map sample:

1. Update your target platform to include EMF transaction and Graphiti
2. Create a file named "map.xml" in your sample project
3. It'll open up a three page editor with the first page being the diagram page
4. Drag two Destination nodes to the diagram canvas
5. Invoke direct edit on the two Destination nodes to name the first node "stopA" and second node "stopB"
6. Select "Route" connection tool
7. Click on the first node to start a connection and then click on the second node to finish the connection and you should be able to see an arrowed line created between these two nodes.
8. If you direct-edit the first node, you should be able to see the Route element changed in the form editor or the source editor.
Comment 11 Konstantin Komissarchik CLA 2010-12-01 14:49:11 EST
Checked out the latest patch. Very nice progress. I was able to go through the outlined steps without any issues.

Could you outline the objectives for the next week? Perhaps save/restore?
Comment 12 Shenxue Zhou CLA 2010-12-01 15:34:58 EST
(In reply to comment #11)
> Checked out the latest patch. Very nice progress. I was able to go through the
> outlined steps without any issues.
> 
> Could you outline the objectives for the next week? Perhaps save/restore?

Yes that's a good target for the next week.
Comment 13 Konstantin Komissarchik CLA 2010-12-03 15:56:34 EST
Let's target the first cut of this for 0.3 release, which is scheduled for 2011-03-14 to coincide with EclipseCon 2011. The 0.4 release will likely be scheduled to coincide with Eclipse Indigo release train in June of 2011. Iterative work over on what doesn't fit into 0.3 can go into 0.4, etc.
Comment 14 Shenxue Zhou CLA 2010-12-06 17:35:12 EST
Created attachment 184669 [details]
A basic diagram editor based on Graphiti with save/restore

Additional functionality:

1. You can save/restore diagrams
2. You can move nodes around in the diagram, add/remove/move bendpoints on connections and they will be saved.
3. You can now edit the connection label (in the sample, it's the distance of a route.
Comment 15 Shenxue Zhou CLA 2010-12-14 13:30:15 EST
Created attachment 185156 [details]
Supporting top level connections and connections embedded inside nodes

Added support for connections embedded inside nodes. The library sample demonstrates this functionality.
Comment 16 Shenxue Zhou CLA 2010-12-20 13:28:59 EST
Created attachment 185573 [details]
Support node images
Comment 17 Shenxue Zhou CLA 2010-12-20 13:29:58 EST
Created attachment 185574 [details]
The book image for the library sample
Comment 18 Shenxue Zhou CLA 2010-12-20 13:32:12 EST
Created attachment 185576 [details]
The book image for the library sample

Add this png file to [org.eclipse.sapphire.samples]/images dir
Comment 19 Shenxue Zhou CLA 2010-12-21 17:42:48 EST
Created attachment 185679 [details]
Support deletion of nodes and connections

Now you can delete nodes and connections by selecting nodes or connections on the diagram canvas and hit the "Del" key. When deleting a node, all the connections associated with the node are also deleted.
Comment 20 Shenxue Zhou CLA 2011-01-11 12:43:10 EST
Created attachment 186532 [details]
Diagram Parts now listen to model events

Diagram node parts, diagram node template, diagram connection parts, and diagram connection templates now listen to sapphire model events. so when the model is changed outside the diagram editor, the diagram editor will be updated accordingly through the model event listeners in various diagram parts.
Comment 21 Shenxue Zhou CLA 2011-01-13 15:31:05 EST
Created attachment 186776 [details]
Diagram Node switches image based on expression

In the library editor sample, the book node switches images between when the book title is empty and when the book title is not empty.
Comment 22 Shenxue Zhou CLA 2011-01-13 15:32:43 EST
Created attachment 186777 [details]
The book image for books with no titles for the library sample
Comment 23 Konstantin Komissarchik CLA 2011-01-13 20:38:14 EST
Comment on attachment 185576 [details]
The book image for the library sample

Image not accepted as contribution as its provenance is not clear.
Comment 24 Konstantin Komissarchik CLA 2011-01-13 20:38:30 EST
Comment on attachment 186777 [details]
The book image for books with no titles for the library sample

Image not accepted as contribution as its provenance is not clear.
Comment 25 Konstantin Komissarchik CLA 2011-01-13 20:40:12 EST
Committed changes to HEAD. I did include the library sample, but without the images. Further work to improve the samples and resolve the images issue will be tracked separately.
Comment 26 Raj Alagumalai CLA 2011-06-01 13:16:53 EDT
verified on 0.3.0.201105261624 using map.xml
Comment 27 Konstantin Komissarchik CLA 2011-06-03 13:13:10 EDT
Closing.