Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 114228 Details for
Bug 186249
[GraphLayout] DirectedGraphLayout reassigns width and height
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
fix patch + problems that follows from constant size
Draw2D_GraphLayout_ConstSize (text/plain), 5.97 KB, created by
Alex Boyko
on 2008-10-03 17:04:39 EDT
(
hide
)
Description:
fix patch + problems that follows from constant size
Filename:
MIME Type:
Creator:
Alex Boyko
Created:
2008-10-03 17:04:39 EDT
Size:
5.97 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/graph/Rank.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/graph/Rank.java,v >retrieving revision 1.8 >diff -u -r1.8 Rank.java >--- src/org/eclipse/draw2d/graph/Rank.java 14 Feb 2006 20:19:44 -0000 1.8 >+++ src/org/eclipse/draw2d/graph/Rank.java 3 Oct 2008 21:01:05 -0000 >@@ -75,7 +75,9 @@ > for (int i = 0; i < size(); i++) { > Node n = getNode(i); > n.y = location; >- n.height = rowHeight; >+ if (!n.isConstantSize()) { >+ n.height = rowHeight; >+ } > } > } > >Index: src/org/eclipse/draw2d/graph/Node.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/graph/Node.java,v >retrieving revision 1.12 >diff -u -r1.12 Node.java >--- src/org/eclipse/draw2d/graph/Node.java 31 Mar 2008 15:57:53 -0000 1.12 >+++ src/org/eclipse/draw2d/graph/Node.java 3 Oct 2008 21:01:05 -0000 >@@ -83,6 +83,11 @@ > */ > public int incomingOffset = -1; > >+/** >+ * Specifies whether nodes should keep their size untouched by the layout algorithm >+ */ >+boolean constantSize; >+ > // A non-decreasing number given to consecutive nodes in a Rank. > int index; > >@@ -315,4 +320,25 @@ > return right; > } > >+/** >+ * Checks if node preserves its size. >+ * >+ * @return <code>true</code> if node has constant size >+ * @since 3.5 >+ */ >+public boolean isConstantSize() { >+ return constantSize; >+} >+ >+/** >+ * Sets the flag on the node for the layout algorithm that specifies whether >+ * the layout algorithm is allowed to modify the size of the node or not, >+ * >+ * @param constantSize >+ * @since 3.5 >+ */ >+public void setConstantSize(boolean constantSize) { >+ this.constantSize = constantSize; >+} >+ > } >Index: src/org/eclipse/draw2d/GridLayout.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/GridLayout.java,v >retrieving revision 1.1 >diff -u -r1.1 GridLayout.java >--- src/org/eclipse/draw2d/GridLayout.java 21 Mar 2007 19:54:48 -0000 1.1 >+++ src/org/eclipse/draw2d/GridLayout.java 3 Oct 2008 21:01:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -197,6 +197,13 @@ > size.width = wHint; > if (hHint != SWT.DEFAULT) > size.height = hHint; >+ >+ /* >+ * Adjust for the size of the border >+ */ >+ size.expand(container.getInsets().getWidth(), >+ container.getInsets().getHeight()); >+ size.union(getBorderPreferredSize(container)); > > return size; > } >#P org.eclipse.draw2d.examples >Index: src/org/eclipse/draw2d/examples/graph/GraphTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/examples/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/GraphTests.java,v >retrieving revision 1.5 >diff -u -r1.5 GraphTests.java >--- src/org/eclipse/draw2d/examples/graph/GraphTests.java 14 Feb 2006 20:20:25 -0000 1.5 >+++ src/org/eclipse/draw2d/examples/graph/GraphTests.java 3 Oct 2008 21:01:05 -0000 >@@ -779,4 +779,92 @@ > > } > >+public static DirectedGraph constantSizeNodes1() { >+ Node a,b,c,d,e,f,g; >+ NodeList nodes = new NodeList(); >+ EdgeList edges = new EdgeList(); >+ >+ nodes.add(a = new Node("node a")); >+ nodes.add(b = new Node("node b")); >+ nodes.add(c = new Node("node c")); >+ nodes.add(d = new Node("node d")); >+ nodes.add(e = new Node("node e")); >+ nodes.add(f = new Node("node f")); >+ nodes.add(g = new Node("node g")); >+ a.setConstantSize(true); >+ b.setConstantSize(true); >+ c.setConstantSize(true); >+ d.setConstantSize(true); >+ e.setConstantSize(true); >+ f.setConstantSize(true); >+ g.setConstantSize(true); >+ a.width = 30; a.height = 60; >+ b.width = 40; b.height = 20; >+ c.width = c.height = 80; >+ d.width = d.height = 40; >+ e.width = 70; e.height = 20; >+ f.width = f.height = 40; >+ g.width = 70; g.height = 60; >+ >+ edges.add(new Edge(a, d)); >+ edges.add(new Edge(b, d)); >+ edges.add(new Edge(c, d)); >+ edges.add(new Edge(d, e)); >+ edges.add(new Edge(d, f)); >+ edges.add(new Edge(d, g)); >+ edges.add(new Edge(c, g)); >+ >+ DirectedGraph graph = new DirectedGraph(); >+ graph.nodes = nodes; >+ graph.edges = edges; >+ >+ new DirectedGraphLayout() >+ .visit(graph); >+ return graph; >+} >+ >+public static DirectedGraph constantSizeNodes_Problems() { >+ Node a,b,c,d,e,f,g; >+ NodeList nodes = new NodeList(); >+ EdgeList edges = new EdgeList(); >+ >+ nodes.add(a = new Node("node a")); >+ nodes.add(b = new Node("node b")); >+ nodes.add(c = new Node("node c")); >+ nodes.add(d = new Node("node d")); >+ nodes.add(e = new Node("node e")); >+ nodes.add(f = new Node("node f")); >+ nodes.add(g = new Node("node g")); >+ a.setConstantSize(true); >+ b.setConstantSize(true); >+ c.setConstantSize(true); >+ d.setConstantSize(true); >+ e.setConstantSize(true); >+ f.setConstantSize(true); >+ g.setConstantSize(true); >+ a.width = 40; a.height = 40; >+ b.width = b.height = 150; >+ c.width = c.height = 40; >+ d.width = d.height = 40; >+ e.width = 40; e.height = 20; >+ f.width = f.height = 40; >+ g.width = 100; g.height = 60; >+ >+ edges.add(new Edge(a, d)); >+ edges.add(new Edge(b, d)); >+ edges.add(new Edge(c, d)); >+ edges.add(new Edge(d, e)); >+ edges.add(new Edge(d, f)); >+ edges.add(new Edge(d, g)); >+ edges.add(new Edge(c, g)); >+ >+ DirectedGraph graph = new DirectedGraph(); >+ graph.nodes = nodes; >+ graph.edges = edges; >+ >+ new DirectedGraphLayout() >+ .visit(graph); >+ return graph; >+} >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 186249
: 114228