### Eclipse Workspace Patch 1.0 #P org.eclipse.mylyn.zest.core Index: src/org/eclipse/mylyn/zest/core/widgets/Graph.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.zest.core/src/org/eclipse/mylyn/zest/core/widgets/Graph.java,v retrieving revision 1.35 diff -u -r1.35 Graph.java --- src/org/eclipse/mylyn/zest/core/widgets/Graph.java 4 Sep 2007 21:50:23 -0000 1.35 +++ src/org/eclipse/mylyn/zest/core/widgets/Graph.java 10 Sep 2007 20:44:10 -0000 @@ -21,8 +21,10 @@ import org.eclipse.draw2d.FreeformLayer; import org.eclipse.draw2d.FreeformLayout; import org.eclipse.draw2d.FreeformViewport; +import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.LayoutAnimator; +import org.eclipse.draw2d.MouseListener; import org.eclipse.draw2d.MouseMotionListener; import org.eclipse.draw2d.SWTEventDispatcher; import org.eclipse.draw2d.ScalableFigure; @@ -101,6 +103,7 @@ LayoutAlgorithm layoutAlgorithm = null; private Dimension preferredSize = null; int style = 0; + private boolean antiAliasing; private ScalableFreeformLayeredPane rootlayer; private ZestRootLayer zestRootLayer; @@ -161,7 +164,7 @@ }); this.setContents(createLayers()); - DragSupport dragSupport = new DragSupport(this); + IDragSupport dragSupport = createDragSupport(); this.getLightweightSystem().getRootFigure().addMouseListener(dragSupport); this.getLightweightSystem().getRootFigure().addMouseMotionListener(dragSupport); @@ -465,10 +468,18 @@ } + public interface IDragSupport extends MouseMotionListener, MouseListener { + + } + + protected IDragSupport createDragSupport() { + return new DragSupport(this); + } + // ///////////////////////////////////////////////////////////////////////////////// // PRIVATE METHODS. These are NON API // ///////////////////////////////////////////////////////////////////////////////// - class DragSupport implements MouseMotionListener, org.eclipse.draw2d.MouseListener { + class DragSupport implements IDragSupport { /** * */ @@ -1043,7 +1054,15 @@ } private ScalableFigure createLayers() { - rootlayer = new ScalableFreeformLayeredPane(); + rootlayer = new ScalableFreeformLayeredPane() { + public void paint(Graphics graphics) { + if (isAntiAliasing()) { + graphics.setAntialias(SWT.ON); + } + + super.paint(graphics); + } + }; rootlayer.setLayoutManager(new FreeformLayout()); zestRootLayer = new ZestRootLayer(); @@ -1164,8 +1183,15 @@ return GraphItem.GRAPH; } - GraphItem getGraphItem(IFigure figure) { + public GraphItem getGraphItem(IFigure figure) { return (GraphItem) figure2ItemMap.get(figure); } + public boolean isAntiAliasing() { + return antiAliasing; + } + + public void setAntiAliasing(boolean antiAliasing) { + this.antiAliasing = antiAliasing; + } } Index: src/org/eclipse/mylyn/zest/examples/uml/UMLExample.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.zest.core/src/org/eclipse/mylyn/zest/examples/uml/UMLExample.java,v retrieving revision 1.3 diff -u -r1.3 UMLExample.java --- src/org/eclipse/mylyn/zest/examples/uml/UMLExample.java 1 Sep 2007 00:31:19 -0000 1.3 +++ src/org/eclipse/mylyn/zest/examples/uml/UMLExample.java 10 Sep 2007 20:44:10 -0000 @@ -16,7 +16,6 @@ import org.eclipse.mylyn.zest.core.widgets.GraphConnection; import org.eclipse.mylyn.zest.core.widgets.GraphContainer; import org.eclipse.mylyn.zest.core.widgets.GraphNode; -import org.eclipse.mylyn.zest.core.widgets.IContainer; import org.eclipse.mylyn.zest.core.widgets.ZestStyles; import org.eclipse.mylyn.zest.layouts.LayoutStyles; import org.eclipse.mylyn.zest.layouts.algorithms.SpringLayoutAlgorithm; @@ -80,21 +79,6 @@ return classFigure; } - static class UMLNode extends GraphNode { - - IFigure customFigure = null; - - public UMLNode(IContainer graphModel, int style, IFigure figure) { - super(graphModel, style); - this.customFigure = figure; - } - - protected IFigure createFigureForModel() { - return customFigure; - } - - } - /** * @param args */ @@ -109,10 +93,22 @@ g.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED); GraphContainer c = new GraphContainer(g, SWT.NONE); c.setText("A UML Container"); - UMLNode n = new UMLNode(c, SWT.NONE, createClassFigure1()); + GraphNode n = new GraphNode(c, SWT.NONE) { + protected IFigure createFigureForModel() { + return createClassFigure1(); + } + }; - GraphNode n1 = new UMLNode(g, SWT.NONE, createClassFigure1()); - GraphNode n2 = new UMLNode(g, SWT.NONE, createClassFigure2()); + GraphNode n1 = new GraphNode(g, SWT.NONE) { + protected IFigure createFigureForModel() { + return createClassFigure1(); + } + }; + GraphNode n2 = new GraphNode(g, SWT.NONE) { + protected IFigure createFigureForModel() { + return createClassFigure2(); + } + }; new GraphConnection(g, SWT.NONE, n1, n2); new GraphConnection(g, SWT.NONE, n, n1); Index: src/org/eclipse/mylyn/zest/core/viewers/GraphViewer.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.zest.core/src/org/eclipse/mylyn/zest/core/viewers/GraphViewer.java,v retrieving revision 1.5 diff -u -r1.5 GraphViewer.java --- src/org/eclipse/mylyn/zest/core/viewers/GraphViewer.java 20 Aug 2007 21:09:31 -0000 1.5 +++ src/org/eclipse/mylyn/zest/core/viewers/GraphViewer.java 10 Sep 2007 20:44:10 -0000 @@ -19,6 +19,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.mylyn.zest.core.widgets.ConstraintAdapter; import org.eclipse.mylyn.zest.core.widgets.Graph; import org.eclipse.mylyn.zest.core.widgets.GraphItem; import org.eclipse.mylyn.zest.core.widgets.ZestStyles; @@ -73,6 +74,11 @@ hookControl(this.graph); } + public GraphViewer(Graph graphModel) { + super(graphModel.getStyle()); + setControl(graphModel); + } + public void setControl(Graph graphModel) { this.graph = graphModel; hookControl(this.graph); @@ -296,4 +302,45 @@ return graph.getLayoutAlgorithm(); } + /* (non-Javadoc) + * @see org.eclipse.mylyn.zest.core.viewers.internal.AbstractStructuredGraphViewer#addConstraintAdapter(org.eclipse.mylyn.zest.core.widgets.ConstraintAdapter) + */ + public void addConstraintAdapter(ConstraintAdapter constraintAdapter) { + super.addConstraintAdapter(constraintAdapter); + } + + /* (non-Javadoc) + * @see org.eclipse.mylyn.zest.core.viewers.internal.AbstractStructuredGraphViewer#addNode(java.lang.Object) + */ + public void addNode(Object element) { + super.addNode(element); + } + + /* (non-Javadoc) + * @see org.eclipse.mylyn.zest.core.viewers.internal.AbstractStructuredGraphViewer#addRelationship(java.lang.Object) + */ + public void addRelationship(Object connection) { + super.addRelationship(connection); + } + + /* (non-Javadoc) + * @see org.eclipse.mylyn.zest.core.viewers.internal.AbstractStructuredGraphViewer#removeNode(java.lang.Object) + */ + public void removeNode(Object element) { + super.removeNode(element); + } + + /* (non-Javadoc) + * @see org.eclipse.mylyn.zest.core.viewers.internal.AbstractStructuredGraphViewer#removeRelationship(java.lang.Object) + */ + public void removeRelationship(Object connection) { + super.removeRelationship(connection); + } + + /* (non-Javadoc) + * @see org.eclipse.mylyn.zest.core.viewers.AbstractZoomableViewer#zoomTo(int, int, int, int) + */ + public void zoomTo(int x, int y, int width, int height) { + super.zoomTo(x, y, width, height); + } }