Community
Participate
Working Groups
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
Created attachment 183320 [details] First cut of the diagram def files
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.
Created attachment 183327 [details] diagram def files incorporating kosta's comments
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.
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.
Created attachment 183361 [details] Adding connection decorator specification Connection's endpoints can have decorators associated with them
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.
Created attachment 183403 [details] diagram def files incorporating kosta's comments name changes
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
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.
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?
(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.
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.
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.
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.
Created attachment 185573 [details] Support node images
Created attachment 185574 [details] The book image for the library sample
Created attachment 185576 [details] The book image for the library sample Add this png file to [org.eclipse.sapphire.samples]/images dir
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.
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.
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.
Created attachment 186777 [details] The book image for books with no titles for the library sample
Comment on attachment 185576 [details] The book image for the library sample Image not accepted as contribution as its provenance is not clear.
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.
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.
verified on 0.3.0.201105261624 using map.xml
Closing.