| Summary: | Refactor GEF4 Zest JFace API | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Alexander Nyßen <nyssen> |
| Component: | GEF Zest | Assignee: | gef-inbox <gef-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P1 | CC: | matthias.wienand |
| Version: | 0.1.0 | ||
| Target Milestone: | 4.0.0 (Neon) M6 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | 478944 | ||
| Bug Blocks: | |||
|
Description
Alexander Nyßen
Instead of a mere renaming, we indeed should refactor the provider infrastructure, so that explicit nodes nodes and edges (represented by input model objects) can be handled, as well as implicit ones (i.e. nodes inferred via linked edges; edges inferred via connected nodes). The api should support explicit nodes and edges by default (and make handling of this easy), but should not enforce explicit nodes or edges (and it should allow to mix both within a single viewer). With respect to content providers, an implementation could be as follows: - The existing IGraphNodeContentProvider should be renamed to IGraphContentProvider, and should offer the following methods (out of which as subset may only be implemented; we thus need to provide an Impl-Stub) 1) getNodes() (return explicit nodes) 2) getEdges() (return explicit edges) 3) getOutgoing(Object node) (return explicit outgoing edges) 4) getIncoming(Object node) (return explicit incoming edges) 5) getOutgoingConnected(Object node) (return explicit nodes connected via outgoing implicit edge, i.e. represent each implicit outgoing edge as a pair of nodes) 6) getIncomingConnected(Object node) (return explicit nodes connected via incoming implicit edge, i.e. represent each implicit incoming edge as a pair of nodes) 7) getSource(Object edge) (return explicit source node) 8) getTarget(Object edge) (return explicit target node) 9) getSourceLinked (Object edge) (returns explicit edges which are connected as incoming edge to the implicit source node, representing the implicit source node as a pair of linked edges) 10) getTargetLinked (Object edge) (returns explicit edges which are connected as outgoing edge to the implicit target node, representing the implicit target node as a pair of linked edges) - The exiting INestedGraphContentProvider should be altered to provide the following methods: 1) getNestedNodes(Object node) (returns explicit nested nodes for explicit nesting node) 2) getNestedEdges(Object node) (returns explicit nested edges for explicit nesting nodes) 3) getSourceNestedNodes(Object edge) (return explicit nested nodes for implicit nesting source node) 4) getTargetNestedNodes(Object edge) (return explicit nested nodes for implicit nesting target node) 5) getSourceNestedEdges(Object edge) (return explicit nested edges for implicit nesting source node) 6) getTargetNestedEdges(Object edge) (return explicit nested edges for implicit nesting target node) The label and dedicated 'style' providers (color, font, tooltip) need to be adjusted as follows: - The standard label provider is sufficient to infer label and image for explicit nodes and explicit edges. We need to augment dedicated label providers for implicit nodes (getSourceLabel(), getSourceImage(), getTargetLabel(), getTargetImage() and implicit edges (getLabel(Object, Object), getImage(Object, Object). - We should migrate the existing dedicated label providers (IGraphNodeLabelProvider and INestedGraphNodeLabelProvider) into mere attribute providers (not extending label provider) as follows: 1) We should introduce dedicated graph attributes providers that returns root graph attributes. 2) We should introduce attribute providers for explicit and implicit nodes and edges respectively. 3) We need providers to return nested graph attributes for nested graphs of explicit nesting nodes, and of implicit nesting nodes. - The dedicated providers for font, color, and tooltip (as well as label) should work for explicit nodes and edges only. For implicit nodes and edges, the attribute providers should be used instead, dedicated 'style' provides are not needed for these special cases. Therefore, we should remove the IEdgeDecorationProvider and use the attribute providers for this as well. I already removed the IEdgeDecorationProvider in terms of bug #478944. The remaining refactorings need deeper consideration. What should at least be cleaned up for now is: - We should merge IGraphNodeContentProvider and INestedGraphContentProvider to IGraphContentProvider. getChildren(Object) should be renamed to getNestedNodes(Object) to be more application specific. The interface should thus contain the following methods: - getNodes() - getAdjacentNodes(Object) // to infer edges - hasNestedGraph(Object) // useful for lazy evaluation - getNestedGraphNodes(Object) // the nodes of a nested subgraph - We should merge IGraphNodeLabelProvider and INestedGraphLabelProvider into IGraphAttributesProvider, removing the extension of ILabelProvider (the interface is unrelated, even it it is intended to be implemented by the label provider of the ZestContentViewer). We should rename getRootGraphAttributes() into getGraphAttributes(). The resulting interface should thus provide the following methods: - getGraphAttributes() // root graph - getNestedGraphAttributes(Object) // nested graph - getNodeAttributes(Object) - getEdgeAttributes(Object, Object) I performed the clean-ups as suggested by Alexander in comment #3. The code is published on the master branch, therefore, I resolve this ticket as fixed for 4.0.0 M6. |