diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java
index dc2deb976..72ff811ee 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java
@@ -29,6 +29,10 @@
*/
public class CompoundGraphTests {
+ private static final String EDITOR = "Editor"; //$NON-NLS-1$
+ private static final String SUBGRAPH_2 = "Subgraph 2"; //$NON-NLS-1$
+ private static final String SUBGRAPH_1 = "Subgraph 1"; //$NON-NLS-1$
+
public static CompoundDirectedGraph aaaapull(int direction) {
Subgraph s1, s2;
Node a, b, e, j, m;
@@ -36,17 +40,17 @@ public static CompoundDirectedGraph aaaapull(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- s1 = new Subgraph("Subgraph 1");
- s2 = new Subgraph("Subgraph 2");
+ s1 = new Subgraph(SUBGRAPH_1);
+ s2 = new Subgraph(SUBGRAPH_2);
- nodes.add(r = new Node("r", s2));
- nodes.add(t = new Node("t", s2));
+ nodes.add(r = new Node("r", s2)); //$NON-NLS-1$
+ nodes.add(t = new Node("t", s2)); //$NON-NLS-1$
- nodes.add(a = new Node("a", s1));
- nodes.add(b = new Node("b", s1));
- nodes.add(e = new Node("e", s1));
- nodes.add(j = new Node("j", s1));
- nodes.add(m = new Node("m", s1));
+ nodes.add(a = new Node("a", s1)); //$NON-NLS-1$
+ nodes.add(b = new Node("b", s1)); //$NON-NLS-1$
+ nodes.add(e = new Node("e", s1)); //$NON-NLS-1$
+ nodes.add(j = new Node("j", s1)); //$NON-NLS-1$
+ nodes.add(m = new Node("m", s1)); //$NON-NLS-1$
edges.add(new Edge(a, b));
@@ -76,14 +80,14 @@ public static CompoundDirectedGraph aaaflowEditor(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(diagram = new Subgraph("Editor"));
- nodes.add(flow = new Subgraph("Flow", diagram));
- nodes.add(subflow1 = new Subgraph("Sub1", flow));
- nodes.add(subflow2 = new Subgraph("Sub2", flow));
+ nodes.add(diagram = new Subgraph(EDITOR));
+ nodes.add(flow = new Subgraph("Flow", diagram)); //$NON-NLS-1$
+ nodes.add(subflow1 = new Subgraph("Sub1", flow)); //$NON-NLS-1$
+ nodes.add(subflow2 = new Subgraph("Sub2", flow)); //$NON-NLS-1$
- nodes.add(a1 = new Node("a1", diagram));
- nodes.add(a2 = new Node("a2", subflow1));
- nodes.add(a3 = new Node("a3", subflow2));
+ nodes.add(a1 = new Node("a1", diagram)); //$NON-NLS-1$
+ nodes.add(a2 = new Node("a2", subflow1)); //$NON-NLS-1$
+ nodes.add(a3 = new Node("a3", subflow2)); //$NON-NLS-1$
a1.width = a2.width = a3.width = 200;
a1.outgoingOffset = 1;
@@ -107,10 +111,10 @@ public static CompoundDirectedGraph chains(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(s1 = new Subgraph("S1"));
- nodes.add(s2 = new Subgraph("S2"));
- nodes.add(s3 = new Subgraph("S3"));
- nodes.add(sb = new Subgraph("SB"));
+ nodes.add(s1 = new Subgraph("S1")); //$NON-NLS-1$
+ nodes.add(s2 = new Subgraph("S2")); //$NON-NLS-1$
+ nodes.add(s3 = new Subgraph("S3")); //$NON-NLS-1$
+ nodes.add(sb = new Subgraph("SB")); //$NON-NLS-1$
s1.setPadding(new Insets(10));
s1.innerPadding = new Insets(1);
@@ -120,24 +124,24 @@ public static CompoundDirectedGraph chains(int direction) {
edges.add(new Edge(sb, s3));
edges.add(new Edge(s2, s3));
- nodes.add(n0 = new Node("0", s1));
- nodes.add(nx = new Node("x", s1));
- nodes.add(n1 = new Node("1", s1));
- nodes.add(n2 = new Node("2", s1));
+ nodes.add(n0 = new Node("0", s1)); //$NON-NLS-1$
+ nodes.add(nx = new Node("x", s1)); //$NON-NLS-1$
+ nodes.add(n1 = new Node("1", s1)); //$NON-NLS-1$
+ nodes.add(n2 = new Node("2", s1)); //$NON-NLS-1$
edges.add(new Edge(nx, n2));
edges.add(new Edge(n0, n2));
edges.add(new Edge(n1, n2));
- nodes.add(n3 = new Node("3", s2));
- nodes.add(n4 = new Node("4", s2));
+ nodes.add(n3 = new Node("3", s2)); //$NON-NLS-1$
+ nodes.add(n4 = new Node("4", s2)); //$NON-NLS-1$
edges.add(new Edge(n3, n4));
- nodes.add(n5 = new Node("5", s3));
- nodes.add(n6 = new Node("6", s3));
+ nodes.add(n5 = new Node("5", s3)); //$NON-NLS-1$
+ nodes.add(n6 = new Node("6", s3)); //$NON-NLS-1$
edges.add(new Edge(n5, n6));
- nodes.add(na = new Node("a", sb));
- nodes.add(nb = new Node("b", sb));
+ nodes.add(na = new Node("a", sb)); //$NON-NLS-1$
+ nodes.add(nb = new Node("b", sb)); //$NON-NLS-1$
edges.add(new Edge(na, nb));
n1.width = 60;
@@ -160,21 +164,21 @@ public static CompoundDirectedGraph flowChart(int direction) {
Subgraph diagram, s1, s2, s3, s4, s5, s6, s7, s8;
- nodes.add(diagram = new Subgraph("diagram"));
+ nodes.add(diagram = new Subgraph("diagram")); //$NON-NLS-1$
- nodes.add(s1 = new Subgraph("s1", diagram));
- nodes.add(s2 = new Subgraph("s2", s1));
- nodes.add(s3 = new Subgraph("s3", s1));
- nodes.add(s4 = new Subgraph("s4", s1));
- nodes.add(s5 = new Subgraph("s5", s1));
- nodes.add(s6 = new Subgraph("s6", s1));
- nodes.add(s7 = new Subgraph("s7", s1));
- nodes.add(s8 = new Subgraph("s8", s1));
+ nodes.add(s1 = new Subgraph("s1", diagram)); //$NON-NLS-1$
+ nodes.add(s2 = new Subgraph("s2", s1)); //$NON-NLS-1$
+ nodes.add(s3 = new Subgraph("s3", s1)); //$NON-NLS-1$
+ nodes.add(s4 = new Subgraph("s4", s1)); //$NON-NLS-1$
+ nodes.add(s5 = new Subgraph("s5", s1)); //$NON-NLS-1$
+ nodes.add(s6 = new Subgraph("s6", s1)); //$NON-NLS-1$
+ nodes.add(s7 = new Subgraph("s7", s1)); //$NON-NLS-1$
+ nodes.add(s8 = new Subgraph("s8", s1)); //$NON-NLS-1$
Node outer1, outer2, outer3;
- nodes.add(outer1 = new Node("asdf", diagram));
- nodes.add(outer2 = new Node("asfasdf", diagram));
- nodes.add(outer3 = new Node("a3", diagram));
+ nodes.add(outer1 = new Node("asdf", diagram)); //$NON-NLS-1$
+ nodes.add(outer2 = new Node("asfasdf", diagram)); //$NON-NLS-1$
+ nodes.add(outer3 = new Node("a3", diagram)); //$NON-NLS-1$
edges.add(new Edge(s3, s6));
edges.add(new Edge(s4, s7));
@@ -185,41 +189,41 @@ public static CompoundDirectedGraph flowChart(int direction) {
edges.add(new Edge(outer2, s1));
Node s2a, s2b, s2c;
- nodes.add(s2a = new Node("BMW", s2));
- nodes.add(s2b = new Node("Hawking", s2));
- nodes.add(s2c = new Node("Smurfy", s2));
+ nodes.add(s2a = new Node("BMW", s2)); //$NON-NLS-1$
+ nodes.add(s2b = new Node("Hawking", s2)); //$NON-NLS-1$
+ nodes.add(s2c = new Node("Smurfy", s2)); //$NON-NLS-1$
edges.add(new Edge(s2a, s2b));
edges.add(new Edge(s2a, s2c));
Node s3a, s3b;
- nodes.add(s3a = new Node("Jammin", s3));
- nodes.add(s3b = new Node("This is it", s3));
+ nodes.add(s3a = new Node("Jammin", s3)); //$NON-NLS-1$
+ nodes.add(s3b = new Node("This is it", s3)); //$NON-NLS-1$
edges.add(new Edge(s3a, s3b));
- nodes.add(new Node("catDog", s4));
+ nodes.add(new Node("catDog", s4)); //$NON-NLS-1$
Node s5a, s5b;
- nodes.add(s5a = new Node("a1", s5));
- nodes.add(s5b = new Node("a2", s5));
+ nodes.add(s5a = new Node("a1", s5)); //$NON-NLS-1$
+ nodes.add(s5b = new Node("a2", s5)); //$NON-NLS-1$
edges.add(new Edge(s5a, s5b));
Node s6a, s6b, s6c;
- nodes.add(s6a = new Node("Hoop it up", s6));
- nodes.add(s6b = new Node("Streeball", s6));
- nodes.add(s6c = new Node("Downtown", s6));
+ nodes.add(s6a = new Node("Hoop it up", s6)); //$NON-NLS-1$
+ nodes.add(s6b = new Node("Streeball", s6)); //$NON-NLS-1$
+ nodes.add(s6c = new Node("Downtown", s6)); //$NON-NLS-1$
edges.add(new Edge(s6b, s6c));
edges.add(new Edge(s6a, s6b));
Node s7a, s7b;
- nodes.add(s7a = new Node("Thing 1", s7));
- nodes.add(s7b = new Node("Thing 2", s7));
+ nodes.add(s7a = new Node("Thing 1", s7)); //$NON-NLS-1$
+ nodes.add(s7b = new Node("Thing 2", s7)); //$NON-NLS-1$
edges.add(new Edge(s7a, s7b));
Node s8a, s8b, s8c, s8d, s8e;
- nodes.add(s8a = new Node("a1", s8));
- nodes.add(s8b = new Node("a2", s8));
- nodes.add(s8c = new Node("a3", s8));
- nodes.add(s8d = new Node("a4", s8));
- nodes.add(s8e = new Node("a5", s8));
+ nodes.add(s8a = new Node("a1", s8)); //$NON-NLS-1$
+ nodes.add(s8b = new Node("a2", s8)); //$NON-NLS-1$
+ nodes.add(s8c = new Node("a3", s8)); //$NON-NLS-1$
+ nodes.add(s8d = new Node("a4", s8)); //$NON-NLS-1$
+ nodes.add(s8e = new Node("a5", s8)); //$NON-NLS-1$
edges.add(new Edge(s8a, s8c));
edges.add(new Edge(s8a, s8d));
edges.add(new Edge(s8b, s8c));
@@ -227,24 +231,24 @@ public static CompoundDirectedGraph flowChart(int direction) {
edges.add(new Edge(s8c, s8e));
Node inner1, inner2, inner3, inner4, inner5, inner6, inner7, inner8, inner9, inner10, inner11, inner12, inner13,
- inner14, inner15, inner16;
-
- nodes.add(inner1 = new Node("buckyball", s1));
- nodes.add(inner2 = new Node("d", s1));
- nodes.add(inner3 = new Node("cheese", s1));
- nodes.add(inner4 = new Node("dingleberry", s1));
- nodes.add(inner5 = new Node("dinosaur", s1));
- nodes.add(inner6 = new Node("foobar", s1));
- nodes.add(inner7 = new Node("t30", s1));
- nodes.add(inner8 = new Node("a21", s1));
- nodes.add(inner9 = new Node("katarina", s1));
- nodes.add(inner10 = new Node("zig zag", s1));
- nodes.add(inner11 = new Node("a16", s1));
- nodes.add(inner12 = new Node("a23", s1));
- nodes.add(inner13 = new Node("a17", s1));
- nodes.add(inner14 = new Node("a20", s1));
- nodes.add(inner15 = new Node("a19", s1));
- nodes.add(inner16 = new Node("a24", s1));
+ inner14, inner15, inner16;
+
+ nodes.add(inner1 = new Node("buckyball", s1)); //$NON-NLS-1$
+ nodes.add(inner2 = new Node("d", s1)); //$NON-NLS-1$
+ nodes.add(inner3 = new Node("cheese", s1)); //$NON-NLS-1$
+ nodes.add(inner4 = new Node("dingleberry", s1)); //$NON-NLS-1$
+ nodes.add(inner5 = new Node("dinosaur", s1)); //$NON-NLS-1$
+ nodes.add(inner6 = new Node("foobar", s1)); //$NON-NLS-1$
+ nodes.add(inner7 = new Node("t30", s1)); //$NON-NLS-1$
+ nodes.add(inner8 = new Node("a21", s1)); //$NON-NLS-1$
+ nodes.add(inner9 = new Node("katarina", s1)); //$NON-NLS-1$
+ nodes.add(inner10 = new Node("zig zag", s1)); //$NON-NLS-1$
+ nodes.add(inner11 = new Node("a16", s1)); //$NON-NLS-1$
+ nodes.add(inner12 = new Node("a23", s1)); //$NON-NLS-1$
+ nodes.add(inner13 = new Node("a17", s1)); //$NON-NLS-1$
+ nodes.add(inner14 = new Node("a20", s1)); //$NON-NLS-1$
+ nodes.add(inner15 = new Node("a19", s1)); //$NON-NLS-1$
+ nodes.add(inner16 = new Node("a24", s1)); //$NON-NLS-1$
edges.add(new Edge(inner1, inner3));
edges.add(new Edge(inner2, inner4));
edges.add(new Edge(inner2, inner3));
@@ -277,20 +281,20 @@ public static CompoundDirectedGraph flowChart(int direction) {
public static CompoundDirectedGraph flowEditor1(int direction) {
Subgraph diagram, flow;
- Node a1, a2, a4, a5, a6, a7, a8, x, y;
+ Node a1, a2, a4, a5, a6, x, y;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(diagram = new Subgraph("Editor"));
- nodes.add(flow = new Subgraph("Flow", diagram));
+ nodes.add(diagram = new Subgraph(EDITOR)); // $NON-NLS-1$
+ nodes.add(flow = new Subgraph("Flow", diagram)); //$NON-NLS-1$
- nodes.add(a1 = new Node("a1", diagram));
- nodes.add(a2 = new Node("a2", diagram));
- nodes.add(a4 = new Node("a4", diagram));
- nodes.add(a5 = new Node("a5", diagram));
- nodes.add(a6 = new Node("a6", diagram));
- nodes.add(a7 = new Node("a7", diagram));
- nodes.add(a8 = new Node("a8", diagram));
+ nodes.add(a1 = new Node("a1", diagram)); //$NON-NLS-1$
+ nodes.add(a2 = new Node("a2", diagram)); //$NON-NLS-1$
+ nodes.add(a4 = new Node("a4", diagram)); //$NON-NLS-1$
+ nodes.add(a5 = new Node("a5", diagram)); //$NON-NLS-1$
+ nodes.add(a6 = new Node("a6", diagram)); //$NON-NLS-1$
+ nodes.add(new Node("a7", diagram)); //$NON-NLS-1$
+ nodes.add(new Node("a8", diagram)); //$NON-NLS-1$
edges.add(new Edge(a1, a2));
edges.add(new Edge(a2, a4));
@@ -298,8 +302,8 @@ public static CompoundDirectedGraph flowEditor1(int direction) {
edges.add(new Edge(a2, a6));
edges.add(new Edge(a6, flow));
- nodes.add(x = new Node("x", flow));
- nodes.add(y = new Node("y", flow));
+ nodes.add(x = new Node("x", flow)); //$NON-NLS-1$
+ nodes.add(y = new Node("y", flow)); //$NON-NLS-1$
edges.add(new Edge(x, y));
CompoundDirectedGraph graph = new CompoundDirectedGraph();
@@ -317,13 +321,13 @@ public static CompoundDirectedGraph flowEditor2(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(diagram = new Subgraph("Editor"));
- nodes.add(flow = new Subgraph("Flow", diagram));
+ nodes.add(diagram = new Subgraph(EDITOR)); // $NON-NLS-1$
+ nodes.add(flow = new Subgraph("Flow", diagram)); //$NON-NLS-1$
- nodes.add(a1 = new Node("a1", diagram));
- nodes.add(a2 = new Node("a2", diagram));
- nodes.add(a3 = new Node("a3", flow));
- nodes.add(a4 = new Node("a4", flow));
+ nodes.add(a1 = new Node("a1", diagram)); //$NON-NLS-1$
+ nodes.add(a2 = new Node("a2", diagram)); //$NON-NLS-1$
+ nodes.add(a3 = new Node("a3", flow)); //$NON-NLS-1$
+ nodes.add(a4 = new Node("a4", flow)); //$NON-NLS-1$
edges.add(new Edge(a1, a2));
edges.add(new Edge(a2, a4));
@@ -342,17 +346,17 @@ public static CompoundDirectedGraph ShortestPassCase(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- Subgraph p = new Subgraph("parent");
+ Subgraph p = new Subgraph("parent"); //$NON-NLS-1$
nodes.add(p);
- Node a = new Node("a", p);
+ Node a = new Node("a", p); //$NON-NLS-1$
nodes.add(a);
- Node b = new Node("b", p);
+ Node b = new Node("b", p); //$NON-NLS-1$
nodes.add(b);
- Node c = new Node("c", p);
+ Node c = new Node("c", p); //$NON-NLS-1$
nodes.add(c);
- Node d = new Node("d", p);
+ Node d = new Node("d", p); //$NON-NLS-1$
nodes.add(d);
- Node e = new Node("e", p);
+ Node e = new Node("e", p); //$NON-NLS-1$
nodes.add(e);
edges.add(new Edge(a, d));
@@ -379,28 +383,28 @@ public static CompoundDirectedGraph tangledSubgraphs(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(A = new Subgraph("Subgraph A"));
- nodes.add(B = new Subgraph("Subgraph B"));
- nodes.add(C = new Subgraph("Subgraph C"));
- nodes.add(D = new Subgraph("Subgraph D"));
+ nodes.add(A = new Subgraph("Subgraph A")); //$NON-NLS-1$
+ nodes.add(B = new Subgraph("Subgraph B")); //$NON-NLS-1$
+ nodes.add(C = new Subgraph("Subgraph C")); //$NON-NLS-1$
+ nodes.add(D = new Subgraph("Subgraph D")); //$NON-NLS-1$
// C.rowOrder = 2;
// B.rowOrder = 3;
- nodes.add(a1 = new Node("a1", A));
- nodes.add(a2 = new Node("a2", A));
+ nodes.add(a1 = new Node("a1", A)); //$NON-NLS-1$
+ nodes.add(a2 = new Node("a2", A)); //$NON-NLS-1$
edges.add(new Edge(a1, a2));
- nodes.add(b1 = new Node("b1", B));
- nodes.add(b2 = new Node("b2", B));
+ nodes.add(b1 = new Node("b1", B)); //$NON-NLS-1$
+ nodes.add(b2 = new Node("b2", B)); //$NON-NLS-1$
edges.add(new Edge(b1, b2));
- nodes.add(c1 = new Node("c1", C));
- nodes.add(c2 = new Node("c2", C));
+ nodes.add(c1 = new Node("c1", C)); //$NON-NLS-1$
+ nodes.add(c2 = new Node("c2", C)); //$NON-NLS-1$
edges.add(new Edge(c1, c2));
- nodes.add(d1 = new Node("d1", D));
- nodes.add(d2 = new Node("d2", D));
+ nodes.add(d1 = new Node("d1", D)); //$NON-NLS-1$
+ nodes.add(d2 = new Node("d2", D)); //$NON-NLS-1$
edges.add(new Edge(d1, d2));
CompoundDirectedGraph graph = new CompoundDirectedGraph();
@@ -422,16 +426,16 @@ public static CompoundDirectedGraph test1(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- s1 = new Subgraph("Subgraph 1");
- s2 = new Subgraph("Subgraph 2");
+ s1 = new Subgraph(SUBGRAPH_1);
+ s2 = new Subgraph(SUBGRAPH_2);
- nodes.add(n1 = new Node("1", s1));
- nodes.add(n2 = new Node("2", s1));
- nodes.add(n3 = new Node("3", s1));
- nodes.add(n4 = new Node("4", s2));
- nodes.add(n5 = new Node("5", s2));
- nodes.add(n6 = new Node("6", s2));
- nodes.add(n7 = new Node("7", s2));
+ nodes.add(n1 = new Node("1", s1)); //$NON-NLS-1$
+ nodes.add(n2 = new Node("2", s1)); //$NON-NLS-1$
+ nodes.add(n3 = new Node("3", s1)); //$NON-NLS-1$
+ nodes.add(n4 = new Node("4", s2)); //$NON-NLS-1$
+ nodes.add(n5 = new Node("5", s2)); //$NON-NLS-1$
+ nodes.add(n6 = new Node("6", s2)); //$NON-NLS-1$
+ nodes.add(n7 = new Node("7", s2)); //$NON-NLS-1$
n1.width = 60;
n2.width = 70;
@@ -465,22 +469,22 @@ public static CompoundDirectedGraph test2(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- s1 = new Subgraph("Subgraph 1");
- s2 = new Subgraph("Subgraph 2");
- s1_1 = new Subgraph("Subgraph 1.1", s1);
+ s1 = new Subgraph(SUBGRAPH_1);
+ s2 = new Subgraph(SUBGRAPH_2);
+ s1_1 = new Subgraph("Subgraph 1.1", s1); //$NON-NLS-1$
nodes.add(s1);
nodes.add(s2);
nodes.add(s1_1);
- nodes.add(n1 = new Node("1", s1));
- nodes.add(n2 = new Node("2", s1));
- nodes.add(n3 = new Node("3", s1));
- nodes.add(n4 = new Node("4", s2));
- nodes.add(n5 = new Node("5", s2));
- nodes.add(n6 = new Node("6", s2));
- nodes.add(n7 = new Node("7", s2));
- nodes.add(n8 = new Node("8", s1_1));
+ nodes.add(n1 = new Node("1", s1)); //$NON-NLS-1$
+ nodes.add(n2 = new Node("2", s1)); //$NON-NLS-1$
+ nodes.add(n3 = new Node("3", s1)); //$NON-NLS-1$
+ nodes.add(n4 = new Node("4", s2)); //$NON-NLS-1$
+ nodes.add(n5 = new Node("5", s2)); //$NON-NLS-1$
+ nodes.add(n6 = new Node("6", s2)); //$NON-NLS-1$
+ nodes.add(n7 = new Node("7", s2)); //$NON-NLS-1$
+ nodes.add(n8 = new Node("8", s1_1)); //$NON-NLS-1$
n8.width = 80;
n1.width = 60;
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/GraphTests.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/GraphTests.java
index b55952a95..098d2427e 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/GraphTests.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/GraphTests.java
@@ -26,22 +26,71 @@
* @since 2.1
*/
public class GraphTests {
+ private static final String ROOT = "root"; //$NON-NLS-1$
+ private static final String HEAD = "Head"; //$NON-NLS-1$
+ private static final String TOP_1 = "Top 1"; //$NON-NLS-1$
+ private static final String TOP_2 = "Top 2"; //$NON-NLS-1$
+ private static final String BOTTOM_1 = "Bottom 1"; //$NON-NLS-1$
+ private static final String BOTTOM_2 = "Bottom 2"; //$NON-NLS-1$
+
+ private static final String NODE_A = "node a"; //$NON-NLS-1$
+ private static final String NODE_A0 = "node a0"; //$NON-NLS-1$
+ private static final String NODE_A1 = "node a1"; //$NON-NLS-1$
+ private static final String NODE_A2 = "node a2"; //$NON-NLS-1$
+ private static final String NODE_A3 = "node a3"; //$NON-NLS-1$
+ private static final String NODE_A4 = "node a4"; //$NON-NLS-1$
+ private static final String NODE_B = "node b"; //$NON-NLS-1$
+ private static final String NODE_B0 = "node b0"; //$NON-NLS-1$
+ private static final String NODE_B1 = "node b1"; //$NON-NLS-1$
+ private static final String NODE_B2 = "node b2"; //$NON-NLS-1$
+ private static final String NODE_B3 = "node b3"; //$NON-NLS-1$
+ private static final String NODE_B4 = "node b4"; //$NON-NLS-1$
+ private static final String NODE_B5 = "node b5"; //$NON-NLS-1$
+ private static final String NODE_B6 = "node b6"; //$NON-NLS-1$
+ private static final String NODE_C = "node c"; //$NON-NLS-1$
+ private static final String NODE_C0 = "node c0"; //$NON-NLS-1$
+ private static final String NODE_C1 = "node c1"; //$NON-NLS-1$
+ private static final String NODE_C2 = "node c2"; //$NON-NLS-1$
+ private static final String NODE_C3 = "node c3"; //$NON-NLS-1$
+ private static final String NODE_C4 = "node c4"; //$NON-NLS-1$
+ private static final String NODE_D = "node d"; //$NON-NLS-1$
+ private static final String NODE_E = "node e"; //$NON-NLS-1$
+ private static final String NODE_F = "node f"; //$NON-NLS-1$
+ private static final String NODE_G = "node g"; //$NON-NLS-1$
+ private static final String NODE_I = "node i"; //$NON-NLS-1$
+ private static final String NODE_J = "node j"; //$NON-NLS-1$
+ private static final String NODE_K = "node k"; //$NON-NLS-1$
+ private static final String NODE_H = "node h"; //$NON-NLS-1$
+ private static final String H1 = "h1"; //$NON-NLS-1$
+ private static final String H2 = "h2"; //$NON-NLS-1$
+ private static final String H3 = "h3"; //$NON-NLS-1$
+ private static final String H4 = "h4"; //$NON-NLS-1$
+ private static final String NODE_X = "node X"; //$NON-NLS-1$
+
public static DirectedGraph offsetTest(int direction) {
- Node head, a1, a2, a3, a4, b1, b2, b3, b4;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(head = new Node("Head")); //$NON-NLS-1$
+ Node head = new Node(HEAD);
+ nodes.add(head);
head.width = 100;
- nodes.add(a1 = new Node("node a1")); //$NON-NLS-1$
- nodes.add(a2 = new Node("node a2")); //$NON-NLS-1$
- nodes.add(a3 = new Node("node a3")); //$NON-NLS-1$
- nodes.add(a4 = new Node("node a4")); //$NON-NLS-1$
-
- nodes.add(b1 = new Node("node b1")); //$NON-NLS-1$
- nodes.add(b2 = new Node("node b2")); //$NON-NLS-1$
- nodes.add(b3 = new Node("node b3")); //$NON-NLS-1$
- nodes.add(b4 = new Node("node b4")); //$NON-NLS-1$
+ Node a1 = new Node(NODE_A1);
+ nodes.add(a1);
+ Node a2 = new Node(NODE_A2);
+ nodes.add(a2);
+ Node a3 = new Node(NODE_A3);
+ nodes.add(a3);
+ Node a4 = new Node(NODE_A4);
+ nodes.add(a4);
+
+ Node b1 = new Node(NODE_B1);
+ nodes.add(b1);
+ Node b2 = new Node(NODE_B2);
+ nodes.add(b2);
+ Node b3 = new Node(NODE_B3);
+ nodes.add(b3);
+ Node b4 = new Node(NODE_B4);
+ nodes.add(b4);
Edge e = new Edge(head, a1);
e.setSourceOffset(10);
@@ -64,7 +113,8 @@ public static DirectedGraph offsetTest(int direction) {
edges.add(new Edge(b3, b4));
edges.add(new Edge(a1, a2));
- edges.add(e = new Edge(a2, a3));
+ e = new Edge(a2, a3);
+ edges.add(e);
e.setSourceOffset(10);
e.setTargetOffset(40);
edges.add(new Edge(a3, a4));
@@ -96,19 +146,19 @@ public static DirectedGraph anotherTour(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- Node row[], firstRow[];
- firstRow = new Node[4];
- firstRow[1] = new Node("h1"); //$NON-NLS-1$
- firstRow[2] = new Node("h2"); //$NON-NLS-1$
- firstRow[3] = new Node("h3"); //$NON-NLS-1$
+ Node[] firstRow = new Node[4];
+ firstRow[1] = new Node(H1);
+ firstRow[2] = new Node(H2);
+ firstRow[3] = new Node(H3);
addNodes(nodes, firstRow);
- row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2, 1, 3, 2, 3, 2, 4, 3, 3, 3, 4 });
+
+ Node[] row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2, 1, 3, 2, 3, 2, 4, 3, 3, 3, 4 });
row = joinRows(nodes, edges, row, new int[] { 1, 1, 3, 4, 2, 1, 2, 3, 3, 2, 4, 4 });
row = joinRows(nodes, edges, row, new int[] { 1, 1, 1, 2, 2, 1, 2, 4, 3, 3, 3, 4, 4, 3, 4, 5 });
- row = joinRows(nodes, edges, row, new int[] { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2, 4, 3, 5, 4 });
+ joinRows(nodes, edges, row, new int[] { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2, 4, 3, 5, 4 });
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -121,21 +171,31 @@ public static DirectedGraph anotherTour(int direction) {
}
public static DirectedGraph balanceThis1(int direction) {
- Node a, b1, b2, b3, b4, b5, c, d, e, f, g;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(b1 = new Node("node b1")); //$NON-NLS-1$
- nodes.add(b2 = new Node("node b2")); //$NON-NLS-1$
- nodes.add(b3 = new Node("node b3")); //$NON-NLS-1$
- nodes.add(b4 = new Node("node b4")); //$NON-NLS-1$
- nodes.add(b5 = new Node("node b5")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
- nodes.add(e = new Node("node e")); //$NON-NLS-1$
- nodes.add(f = new Node("node f")); //$NON-NLS-1$
- nodes.add(g = new Node("node g")); //$NON-NLS-1$
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
+ Node b1 = new Node(NODE_B1);
+ nodes.add(b1);
+ Node b2 = new Node(NODE_B2);
+ nodes.add(b2);
+ Node b3 = new Node(NODE_B3);
+ nodes.add(b3);
+ Node b4 = new Node(NODE_B4);
+ nodes.add(b4);
+ Node b5 = new Node(NODE_B5);
+ nodes.add(b5);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
+ Node e = new Node(NODE_E);
+ nodes.add(e);
+ Node f = new Node(NODE_F);
+ nodes.add(f);
+ Node g = new Node(NODE_G);
+ nodes.add(g);
+ Node a = new Node(NODE_A);
+ nodes.add(a);
b3.width = b2.width = 90;
@@ -153,7 +213,6 @@ public static DirectedGraph balanceThis1(int direction) {
edges.add(new Edge(b4, f));
edges.add(new Edge(a, c));
- // edges.add(new Edge(b, g));
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -165,19 +224,27 @@ public static DirectedGraph balanceThis1(int direction) {
}
public static DirectedGraph balanceThis2(int direction) {
- Node a, b2, b3, b4, c, d, e, f, g;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(b2 = new Node("node b2")); //$NON-NLS-1$
- nodes.add(b3 = new Node("node b3")); //$NON-NLS-1$
- nodes.add(b4 = new Node("node b4")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
- nodes.add(e = new Node("node e")); //$NON-NLS-1$
- nodes.add(f = new Node("node f")); //$NON-NLS-1$
- nodes.add(g = new Node("node g")); //$NON-NLS-1$
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
+ Node b2 = new Node(NODE_B2);
+ nodes.add(b2);
+ Node b3 = new Node(NODE_B3);
+ nodes.add(b3);
+ Node b4 = new Node(NODE_B4);
+ nodes.add(b4);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
+ Node e = new Node(NODE_E);
+ nodes.add(e);
+ Node f = new Node(NODE_F);
+ nodes.add(f);
+ Node g = new Node(NODE_G);
+ nodes.add(g);
+ Node a = new Node(NODE_A);
+ nodes.add(a);
edges.add(new Edge(d, c));
edges.add(new Edge(e, c));
@@ -191,7 +258,6 @@ public static DirectedGraph balanceThis2(int direction) {
edges.add(new Edge(f, b4));
edges.add(new Edge(c, a));
- // edges.add(new Edge(b, g));
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -203,40 +269,52 @@ public static DirectedGraph balanceThis2(int direction) {
}
public static DirectedGraph balanceThis3(int direction) {
- Node top1, top2;
- Node a1, a2, a3, a4;
- Node b1, b2, b3, b4, b5, b6;
- Node c1, c2, c3, c4;
- Node bottom1, bottom2;
-
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(top1 = new Node("Top 1")); //$NON-NLS-1$
+ Node top1 = new Node(TOP_1);
+ nodes.add(top1);
top1.width = 400;
- nodes.add(top2 = new Node("Top 2")); //$NON-NLS-1$
+ Node top2 = new Node(TOP_2);
+ nodes.add(top2);
top2.width = 400;
- nodes.add(a1 = new Node("a1")); //$NON-NLS-1$
- nodes.add(a2 = new Node("a2")); //$NON-NLS-1$
- nodes.add(a3 = new Node("a3")); //$NON-NLS-1$
- nodes.add(a4 = new Node("a4")); //$NON-NLS-1$
- nodes.add(b1 = new Node("b1")); //$NON-NLS-1$
- nodes.add(b2 = new Node("b2")); //$NON-NLS-1$
- nodes.add(b3 = new Node("b3")); //$NON-NLS-1$
- nodes.add(b4 = new Node("b4")); //$NON-NLS-1$
- nodes.add(b5 = new Node("b5")); //$NON-NLS-1$
- nodes.add(b6 = new Node("b6")); //$NON-NLS-1$
- nodes.add(c1 = new Node("c1")); //$NON-NLS-1$
- nodes.add(c2 = new Node("c2")); //$NON-NLS-1$
- nodes.add(c3 = new Node("c3")); //$NON-NLS-1$
- nodes.add(c4 = new Node("c4")); //$NON-NLS-1$
-
- nodes.add(bottom1 = new Node("Bottom 1")); //$NON-NLS-1$
+ Node a1 = new Node(NODE_A1);
+ nodes.add(a1);
+ Node a2 = new Node(NODE_A2);
+ nodes.add(a2);
+ Node a3 = new Node(NODE_A3);
+ nodes.add(a3);
+ Node a4 = new Node(NODE_A4);
+ nodes.add(a4);
+ Node b1 = new Node(NODE_B1);
+ nodes.add(b1);
+ Node b2 = new Node(NODE_B2);
+ nodes.add(b2);
+ Node b3 = new Node(NODE_B3);
+ nodes.add(b3);
+ Node b4 = new Node(NODE_B4);
+ nodes.add(b4);
+ Node b5 = new Node(NODE_B5);
+ nodes.add(b5);
+ Node b6 = new Node(NODE_B6);
+ nodes.add(b6);
+ Node c1 = new Node(NODE_C1);
+ nodes.add(c1);
+ Node c2 = new Node(NODE_C2);
+ nodes.add(c2);
+ Node c3 = new Node(NODE_C3);
+ nodes.add(c3);
+ Node c4 = new Node(NODE_C4);
+ nodes.add(c4);
+
+ Node bottom1 = new Node(BOTTOM_1);
+ nodes.add(bottom1);
bottom1.width = 400;
- nodes.add(bottom2 = new Node("Bottom 2")); //$NON-NLS-1$
+ Node bottom2 = new Node(BOTTOM_2);
+ nodes.add(bottom2);
bottom2.width = 400;
edges.add(new Edge(top1, a1));
@@ -272,16 +350,15 @@ public static DirectedGraph fourLevelBinaryTree(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- Node row[], firstRow[];
- firstRow = new Node[2];
- firstRow[1] = new Node("root"); //$NON-NLS-1$
+ Node[] firstRow = new Node[2];
+ firstRow[1] = new Node(ROOT);
addNodes(nodes, firstRow);
- row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2 });
+ Node[] row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2 });
row = joinRows(nodes, edges, row, new int[] { 1, 1, 1, 2, 2, 3, 2, 4 });
- row = joinRows(nodes, edges, row, new int[] { 1, 1, 1, 2, 2, 3, 2, 4, 3, 5, 3, 6, 4, 7, 4, 8 });
+ joinRows(nodes, edges, row, new int[] { 1, 1, 1, 2, 2, 3, 2, 4, 3, 5, 3, 6, 4, 7, 4, 8 });
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -297,12 +374,11 @@ public static DirectedGraph graph1(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- Node row[], firstRow[];
- firstRow = new Node[3];
- firstRow[1] = new Node("h1"); //$NON-NLS-1$
- firstRow[2] = new Node("h2"); //$NON-NLS-1$
+ Node[] firstRow = new Node[3];
+ firstRow[1] = new Node(H1);
+ firstRow[2] = new Node(H2);
addNodes(nodes, firstRow);
- row = joinRows(nodes, edges, firstRow,
+ Node[] row = joinRows(nodes, edges, firstRow,
new int[] { 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 2, 7, 2, 8, 2, 9, 2, 10 });
row = joinRows(nodes, edges, row,
@@ -323,7 +399,7 @@ public static DirectedGraph graph1(int direction) {
row = joinRows(nodes, edges, row, new int[] { 1, 2, 2, 1, 3, 2, 4, 2, 4, 3, 5, 4 });
// Row 8->9
- row = joinRows(nodes, edges, row, new int[] { 1, 1, 2, 1, 3, 1, 4, 1 });
+ joinRows(nodes, edges, row, new int[] { 1, 1, 2, 1, 3, 1, 4, 1 });
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -339,21 +415,20 @@ public static DirectedGraph graph2(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- Node row[], firstRow[];
- firstRow = new Node[5];
- firstRow[1] = new Node("h1"); //$NON-NLS-1$
- firstRow[2] = new Node("h2"); //$NON-NLS-1$
- firstRow[3] = new Node("h3"); //$NON-NLS-1$
- firstRow[4] = new Node("h4"); //$NON-NLS-1$
+ Node[] firstRow = new Node[5];
+ firstRow[1] = new Node(H1);
+ firstRow[2] = new Node(H2);
+ firstRow[3] = new Node(H3);
+ firstRow[4] = new Node(H4);
firstRow[1].width = firstRow[2].width = firstRow[3].width = firstRow[4].width = 160;
addNodes(nodes, firstRow);
- row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5 });
+ Node[] row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5 });
row = joinRows(nodes, edges, row, new int[] { 1, 1, 3, 3, 5, 2 });
row = joinRows(nodes, edges, row, new int[] { 1, 1, 2, 2 });
- row = joinRows(nodes, edges, row, new int[] { 1, 1, 1, 2, 2, 2, 2, 1 });
+ joinRows(nodes, edges, row, new int[] { 1, 1, 1, 2, 2, 2, 2, 1 });
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -369,20 +444,19 @@ public static DirectedGraph graph3(int direction) {
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- Node row[], firstRow[];
- firstRow = new Node[4];
- firstRow[1] = new Node("h1"); //$NON-NLS-1$
- firstRow[2] = new Node("h2"); //$NON-NLS-1$
- firstRow[3] = new Node("h3"); //$NON-NLS-1$
+ Node[] firstRow = new Node[4];
+ firstRow[1] = new Node(H1);
+ firstRow[2] = new Node(H2);
+ firstRow[3] = new Node(H3);
firstRow[1].width = firstRow[2].width = firstRow[3].width = 120;
addNodes(nodes, firstRow);
- row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2, 1, 3, 2, 3, 2, 4, 3, 3, 3, 4 });
+ Node[] row = joinRows(nodes, edges, firstRow, new int[] { 1, 1, 1, 2, 1, 3, 2, 3, 2, 4, 3, 3, 3, 4 });
row = joinRows(nodes, edges, row, new int[] { 1, 1, 3, 4, 2, 1, 2, 3, 3, 2, 4, 4 });
row = joinRows(nodes, edges, row, new int[] { 1, 1, 1, 2, 2, 1, 2, 4, 3, 3, 3, 4, 4, 3, 4, 5 });
- row = joinRows(nodes, edges, row, new int[] { 1, 1, 2, 2, 4, 4, 5, 5, 1, 2, 4, 3, 5, 4 });
+ joinRows(nodes, edges, row, new int[] { 1, 1, 2, 2, 4, 4, 5, 5, 1, 2, 4, 3, 5, 4 });
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -403,11 +477,10 @@ public static DirectedGraph graph3(int direction) {
*/
private static Node[] joinRows(NodeList nodes, EdgeList edges, Node[] firstRow, int[] conns) {
shuffleConnections(conns);
- Node secondRow[] = new Node[20];
- Node head, tail;
+ Node[] secondRow = new Node[20];
for (int i = 0; i < conns.length; i += 2) {
- head = firstRow[conns[i]];
- tail = secondRow[conns[i + 1]];
+ Node head = firstRow[conns[i]];
+ Node tail = secondRow[conns[i + 1]];
if (tail == null) {
tail = secondRow[conns[i + 1]] = new Node("node" + conns[i + 1]); //$NON-NLS-1$
tail.width = 78;
@@ -423,7 +496,7 @@ private static Node[] joinRows(NodeList nodes, EdgeList edges, Node[] firstRow,
*/
private static void shuffleConnections(int[] conns) {
for (int i = 0; i < conns.length; i += 2) {
- int swap = ((int) (rand.nextFloat() * conns.length) % conns.length) / 2;
+ int swap = (rand.nextInt() * conns.length % conns.length) / 2;
swap *= 2;
int temp = conns[i];
conns[i] = conns[swap];
@@ -436,21 +509,29 @@ private static void shuffleConnections(int[] conns) {
}
public static DirectedGraph simpleGraph(int direction) {
- Node a, b, c, d, e, f, g, h, i, x;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
- nodes.add(e = new Node("node e")); //$NON-NLS-1$
- nodes.add(b = new Node("node b")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
- nodes.add(x = new Node("node X")); //$NON-NLS-1$
- nodes.add(f = new Node("node f")); //$NON-NLS-1$
- nodes.add(g = new Node("node g")); //$NON-NLS-1$
- nodes.add(h = new Node("node h")); //$NON-NLS-1$
- nodes.add(i = new Node("node i")); //$NON-NLS-1$
- // nodes.add(j = new Node("node j"));
+ Node a = new Node(NODE_A);
+ nodes.add(a);
+ Node e = new Node(NODE_E);
+ nodes.add(e);
+ Node b = new Node(NODE_B);
+ nodes.add(b);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
+ Node x = new Node(NODE_X);
+ nodes.add(x);
+ Node f = new Node(NODE_F);
+ nodes.add(f);
+ Node g = new Node(NODE_G);
+ nodes.add(g);
+ Node h = new Node(NODE_H);
+ nodes.add(h);
+ Node i = new Node(NODE_I);
+ nodes.add(i);
edges.add(new Edge(a, i));
edges.add(new Edge(i, g));
@@ -463,7 +544,6 @@ public static DirectedGraph simpleGraph(int direction) {
edges.add(new Edge(d, x));
edges.add(new Edge(x, e));
edges.add(new Edge(a, f));
- // f.incoming.getEdge(0).weight = 4;
edges.add(new Edge(f, g));
edges.add(new Edge(f, h));
edges.add(new Edge(g, e));
@@ -471,7 +551,6 @@ public static DirectedGraph simpleGraph(int direction) {
edges.add(new Edge(b, g));
edges.add(new Edge(f, d));
- // edges.add(new Edge(c, h)); //This will force h onto the rank with d
DirectedGraph graph = new DirectedGraph();
graph.setDirection(direction);
@@ -483,17 +562,23 @@ public static DirectedGraph simpleGraph(int direction) {
}
public static DirectedGraph test1(int direction) {
- Node a, b, c, d, e, f, g;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
- nodes.add(b = new Node("node b")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
- nodes.add(e = new Node("node e")); //$NON-NLS-1$
- nodes.add(f = new Node("node f")); //$NON-NLS-1$
- nodes.add(g = new Node("node g")); //$NON-NLS-1$
+ Node a = new Node(NODE_A);
+ nodes.add(a);
+ Node b = new Node(NODE_B);
+ nodes.add(b);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
+ Node e = new Node(NODE_E);
+ nodes.add(e);
+ Node f = new Node(NODE_F);
+ nodes.add(f);
+ Node g = new Node(NODE_G);
+ nodes.add(g);
edges.add(new Edge(a, d));
edges.add(new Edge(b, d));
@@ -513,22 +598,21 @@ public static DirectedGraph test1(int direction) {
}
public static DirectedGraph test2(int direction) {
- Node a, b, c, d, e, f, g, h, i, j, k, l;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
- nodes.add(b = new Node("node b")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
- nodes.add(e = new Node("node e")); //$NON-NLS-1$
- nodes.add(f = new Node("node f")); //$NON-NLS-1$
- // nodes.add(g = new Node("node g"));
- // nodes.add(h = new Node("node h"));
- // nodes.add(i = new Node("node i"));
- // nodes.add(j = new Node("node j"));
- // nodes.add(k = new Node("node k"));
- // nodes.add(l = new Node("node l"));
+ Node a = new Node(NODE_A);
+ nodes.add(a);
+ Node b = new Node(NODE_B);
+ nodes.add(b);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
+ Node e = new Node(NODE_E);
+ nodes.add(e);
+ Node f = new Node(NODE_F);
+ nodes.add(f);
edges.add(new Edge(a, b));
edges.add(new Edge(a, c));
@@ -547,14 +631,17 @@ public static DirectedGraph test2(int direction) {
}
public static DirectedGraph test3(int direction) {
- Node a, b, c, d;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
- nodes.add(b = new Node("node b")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
+ Node a = new Node(NODE_A);
+ nodes.add(a);
+ Node b = new Node(NODE_B);
+ nodes.add(b);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
a.width = 80;
d.width = 75;
@@ -573,25 +660,31 @@ public static DirectedGraph test3(int direction) {
}
public static DirectedGraph test4(int direction) {
- Node a;
- Node b, c, d;
- Node e, f, g;
- Node h, i, j;
- Node k;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
- nodes.add(b = new Node("node b")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
- nodes.add(e = new Node("node e")); //$NON-NLS-1$
- nodes.add(f = new Node("node f")); //$NON-NLS-1$
- nodes.add(g = new Node("node g")); //$NON-NLS-1$
- nodes.add(h = new Node("node h")); //$NON-NLS-1$
- nodes.add(i = new Node("node i")); //$NON-NLS-1$
- nodes.add(j = new Node("node j")); //$NON-NLS-1$
- nodes.add(k = new Node("node k")); //$NON-NLS-1$
+ Node a = new Node(NODE_A);
+ nodes.add(a);
+ Node b = new Node(NODE_B);
+ nodes.add(b);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
+ Node e = new Node(NODE_E);
+ nodes.add(e);
+ Node f = new Node(NODE_F);
+ nodes.add(f);
+ Node g = new Node(NODE_G);
+ nodes.add(g);
+ Node h = new Node(NODE_H);
+ nodes.add(h);
+ Node i = new Node(NODE_I);
+ nodes.add(i);
+ Node j = new Node(NODE_J);
+ nodes.add(j);
+ Node k = new Node(NODE_K);
+ nodes.add(k);
edges.add(new Edge(a, b));
edges.add(new Edge(a, c));
@@ -622,26 +715,28 @@ public static DirectedGraph test4(int direction) {
}
public static DirectedGraph tinyGraph(int direction) {
- Node a, b, c, d, e, f, g;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(a = new Node("node a")); //$NON-NLS-1$
- nodes.add(b = new Node("node b")); //$NON-NLS-1$
- nodes.add(c = new Node("node c")); //$NON-NLS-1$
- nodes.add(d = new Node("node d")); //$NON-NLS-1$
- nodes.add(e = new Node("node e")); //$NON-NLS-1$
- // nodes.add(f = new Node("node f"));
- nodes.add(g = new Node("node g")); //$NON-NLS-1$
+ Node a = new Node(NODE_A);
+ nodes.add(a);
+ Node b = new Node(NODE_B);
+ nodes.add(b);
+ Node c = new Node(NODE_C);
+ nodes.add(c);
+ Node d = new Node(NODE_D);
+ nodes.add(d);
+ Node e = new Node(NODE_E);
+ nodes.add(e);
+ Node g = new Node(NODE_G);
+ nodes.add(g);
edges.add(new Edge(a, d));
edges.add(new Edge(c, b));
edges.add(new Edge(b, g, 1, 3));
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.setDirection(direction);
@@ -653,28 +748,27 @@ public static DirectedGraph tinyGraph(int direction) {
}
public static DirectedGraph unstableGraph(int direction) {
- Node a0, b0, c0, a1, b1, c1, a2, b2, c2;
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
- nodes.add(a0 = new Node("node a0")); //$NON-NLS-1$
- nodes.add(b0 = new Node("node b0")); //$NON-NLS-1$
- nodes.add(c0 = new Node("node c0")); //$NON-NLS-1$
- nodes.add(a1 = new Node("node a1")); //$NON-NLS-1$
- nodes.add(b1 = new Node("node b1")); //$NON-NLS-1$
- nodes.add(c1 = new Node("node c1")); //$NON-NLS-1$
- nodes.add(a2 = new Node("node a2")); //$NON-NLS-1$
- nodes.add(b2 = new Node("node b2")); //$NON-NLS-1$
- nodes.add(c2 = new Node("node c2")); //$NON-NLS-1$
-
- // edges.add(new Edge(ab, a0));
- // edges.add(new Edge(ab, b0));
- //
- // edges.add(new Edge(ac, a0));
- // edges.add(new Edge(ac, c0));
- //
- // edges.add(new Edge(bc, c0));
- // edges.add(new Edge(bc, b0));
+ Node a0 = new Node(NODE_A0);
+ nodes.add(a0);
+ Node b0 = new Node(NODE_B0);
+ nodes.add(b0);
+ Node c0 = new Node(NODE_C0);
+ nodes.add(c0);
+ Node a1 = new Node(NODE_A1);
+ nodes.add(a1);
+ Node b1 = new Node(NODE_B1);
+ nodes.add(b1);
+ Node c1 = new Node(NODE_C1);
+ nodes.add(c1);
+ Node a2 = new Node(NODE_A2);
+ nodes.add(a2);
+ Node b2 = new Node(NODE_B2);
+ nodes.add(b2);
+ Node c2 = new Node(NODE_C2);
+ nodes.add(c2);
edges.add(new Edge(a0, a1, 1, 9));
edges.add(new Edge(a1, a2, 1, 9));
@@ -699,4 +793,7 @@ public static DirectedGraph unstableGraph(int direction) {
}
+ private GraphTests() {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/GridLayoutExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/GridLayoutExample.java
index 3d9491722..061475c41 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/GridLayoutExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/GridLayoutExample.java
@@ -112,25 +112,17 @@ public void mousePressed(MouseEvent event) {
protected Shape createShape() {
Shape shape = null;
- if (shapeCount == 0) {
- shape = new Ellipse();
- } else if (shapeCount == 1) {
- shape = new RectangleFigure();
- } else if (shapeCount == 2) {
- shape = new RoundedRectangle();
- } else if (shapeCount == 3) {
- shape = new RectangleFigure();
- } else if (shapeCount == 4) {
- shape = new Ellipse();
- } else if (shapeCount == 5) {
- shape = new Triangle();
- } else if (shapeCount == 6) {
- shape = new RoundedRectangle();
- } else if (shapeCount == 7) {
- shape = new Triangle();
- } else {
- shape = new RoundedRectangle();
- }
+ shape = switch (shapeCount) {
+ case 0 -> new Ellipse();
+ case 1 -> new RectangleFigure();
+ case 2 -> new RoundedRectangle();
+ case 3 -> new RectangleFigure();
+ case 4 -> new Ellipse();
+ case 5 -> new Triangle();
+ case 6 -> new RoundedRectangle();
+ case 7 -> new Triangle();
+ default -> new RoundedRectangle();
+ };
shape.setBackgroundColor(colors[colorCount]);
shape.setSize(70, 70);
@@ -320,7 +312,7 @@ public void widgetSelected(SelectionEvent e) {
@Override
public void widgetSelected(SelectionEvent e) {
gridLayout.verticalSpacing = getEventValue(e, "verticalSpacing").intValue(); //$NON-NLS-1$
- ;
+
updateView();
}
});
@@ -603,7 +595,8 @@ protected static int findAlignment(int align) {
protected static int findAlignment(String align) {
if (align.equals("BEGINNING")) { //$NON-NLS-1$
return SWT.BEGINNING;
- } else if (align.equals("CENTER")) { //$NON-NLS-1$
+ }
+ if (align.equals("CENTER")) { //$NON-NLS-1$
return SWT.CENTER;
} else if (align.equals("END")) { //$NON-NLS-1$
return SWT.END;
@@ -614,7 +607,7 @@ protected static int findAlignment(String align) {
}
/**
- * @see org.eclipse.draw2d.examples.AbstractExample#hookShell()
+ * @see org.eclipse.draw2d.examples.AbstractExample#hookShell(Shell)
*/
@Override
protected void hookShell(Shell shell) {
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/ToolbarLayoutExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/ToolbarLayoutExample.java
index e591eb377..10d35e2fb 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/ToolbarLayoutExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/layouts/ToolbarLayoutExample.java
@@ -88,7 +88,7 @@ protected IFigure createContents() {
}
/**
- * @see org.eclipse.draw2d.examples.AbstractExample#hookShell()
+ * @see org.eclipse.draw2d.examples.AbstractExample#hookShell(Shell)
*/
@Override
protected void hookShell(Shell shell) {
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/InheritBackgroundExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/InheritBackgroundExample.java
index ad600c233..c00c4e53f 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/InheritBackgroundExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/InheritBackgroundExample.java
@@ -88,7 +88,7 @@ private static FigureCanvas createCanvas(Composite parent, int style, String tex
figure, or by the operating system.
Note that vertical scrolling may not be
as fast when the background from the
- parent is inherited."""));
+ parent is inherited.""")); //$NON-NLS-1$
return canvas;
}
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/ShapeStylesExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/ShapeStylesExample.java
index f5dcbd5dd..7c3b51c6d 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/ShapeStylesExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/swt/ShapeStylesExample.java
@@ -301,11 +301,11 @@ static void refreshGrid() {
shell.pack();
}
- static abstract class StyleAxis {
+ abstract static class StyleAxis {
private final String name;
protected StyleItem[] elements;
- public StyleAxis(String name, StyleItem[] elements) {
+ protected StyleAxis(String name, StyleItem[] elements) {
this.name = name;
this.elements = elements;
}
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/CaretExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/CaretExample.java
index b313e7249..affb1fa5c 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/CaretExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/CaretExample.java
@@ -36,7 +36,7 @@
public class CaretExample extends AbstractExample {
TextFlow caretOwner;
- TextFlow content[];
+ TextFlow[] content;
Caret caret;
private Label offsetLabel;
private Label trailLabel;
@@ -50,7 +50,7 @@ protected IFigure createContents() {
protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
graphics.setBackgroundColor(new Color(null, 190, 220, 250));
graphics.fillRectangle(getBounds());
- };
+ }
};
page.setBorder(new LineBorder(ColorConstants.darkGray, 10));
@@ -66,7 +66,7 @@ protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
.
דפיםֱ מֱ- ישרֱֹאןץֱֹ\
- نصً ثُ سٍَبُس""");
+ نصً ثُ سٍَبُس"""); //$NON-NLS-1$
text.setBorder(new TestBorder());
text.setFont(new Font(null, "Tahoma", 20, 0)); //$NON-NLS-1$
@@ -75,7 +75,7 @@ protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
page.addMouseMotionListener(new MouseMotionListener.Stub() {
@Override
public void mouseMoved(MouseEvent me) {
- int trail[] = new int[1];
+ int[] trail = new int[1];
Point where = me.getLocation();
page.translateFromParent(where);
int offset = text.getOffset(where, trail, null);
@@ -85,15 +85,11 @@ public void mouseMoved(MouseEvent me) {
@Override
public void mouseExited(MouseEvent me) {
- };
+ }
});
return page;
}
- // protected int getShellStyle() {
- // return super.getShellStyle() | SWT.RIGHT_TO_LEFT;
- // }
-
@Override
protected void hookShell(Shell shell) {
getFigureCanvas().addKeyListener(new KeyAdapter() {
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/MultiLineLabelExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/MultiLineLabelExample.java
index d4f23fd22..135ea2575 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/MultiLineLabelExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/MultiLineLabelExample.java
@@ -30,20 +30,18 @@
*/
public abstract class MultiLineLabelExample {
- private static MultiLineLabel label;
-
public static void main(String[] args) {
Display d = Display.getDefault();
Shell shell = new Shell(d);
shell.setLayout(new GridLayout());
- label = new MultiLineLabel(shell);
+ MultiLineLabel label = new MultiLineLabel(shell);
Text text = new Text(shell, SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.READ_ONLY);
label.setText("""
This is a oijeoi aeif jaoiewjf oaiew jfoaiew\
apijewpfk apoewkf paokwe pfokawpehfaowephf hawoiejf oaweijf paowkefp aoewkfpa\s\
pawkfe paoewkf paowekf pawokefoaiwjefo iajewoifja oewijf poerk pgaokew faewfpokew f\
f oaewkfp aewpofk apwejfoiuajweo foiwajef poawkefpawkje pfoakewpf aewpfkpaowke fpawf\
- gfpowaegpawepmulti-line label.""");
+ gfpowaegpawepmulti-line label."""); //$NON-NLS-1$
text.setText(label.getText());
GridData data = new GridData(GridData.FILL_HORIZONTAL);
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowExample.java
index 26aba3dea..5390bb270 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowExample.java
@@ -33,7 +33,7 @@
*/
public class TextFlowExample extends AbstractExample {
- static protected IFigure createAlignmentParagraph() {
+ protected static IFigure createAlignmentParagraph() {
BlockFlow block = new BlockFlow();
block.setHorizontalAligment(PositionConstants.RIGHT);
block.add(new TextFlow(
@@ -45,10 +45,10 @@ static protected IFigure createAlignmentParagraph() {
return block;
}
- static protected IFigure createBaselineParagraph() {
+ protected static IFigure createBaselineParagraph() {
BlockFlow block = new BlockFlow();
- String message[] = { "Text fragments ", "with different ", "Font sizes will ", "have their ", "baseline ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ String[] message = { "Text fragments ", "with different ", "Font sizes will ", "have their ", "baseline ", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"vertically ", "aligned ", "within ", "the current ", "line" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
for (int i = 0; i < message.length; i++) {
@@ -61,7 +61,7 @@ static protected IFigure createBaselineParagraph() {
return block;
}
- static protected IFigure createBlockParagraph() {
+ protected static IFigure createBlockParagraph() {
BlockFlow blockFlow = new BlockFlow();
blockFlow.setFont(COURIER);
TextFlow contents = new TextFlow();
@@ -74,12 +74,12 @@ static protected IFigure createBlockParagraph() {
public void foo() {
//TABs are not handled currently, only spaces.
System.out.println("foo")
- }""");
+ }"""); //$NON-NLS-1$
blockFlow.add(contents);
return blockFlow;
}
- static protected IFigure createNestedInlineParagraph() {
+ protected static IFigure createNestedInlineParagraph() {
BlockFlow blockFlow = new BlockFlow();
TextFlow text;
blockFlow.add(new TextFlow(
@@ -104,7 +104,7 @@ static protected IFigure createNestedInlineParagraph() {
return blockFlow;
}
- static protected IFigure createParagraph() {
+ protected static IFigure createParagraph() {
BlockFlow blockFlow = new BlockFlow();
TextFlow contents = new TextFlow();
contents.setText("""
@@ -120,7 +120,7 @@ static protected IFigure createParagraph() {
return blockFlow;
}
- static protected IFigure createTitle() {
+ protected static IFigure createTitle() {
BlockFlow blockFlow = new BlockFlow();
TextFlow contents = new TextFlow("Draw2D TextFlow Example"); //$NON-NLS-1$
contents.setFont(HEADING_1);
@@ -155,7 +155,6 @@ public static void main(String[] args) {
@Override
protected void setFigureCanvas(FigureCanvas canvas) {
super.setFigureCanvas(canvas);
- // canvas.setVerticalScrollBarVisibility(canvas.ALWAYS);
canvas.getViewport().setContentsTracksWidth(true);
}
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowFactory.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowFactory.java
index c8886aef5..c997f4ac7 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowFactory.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowFactory.java
@@ -28,8 +28,6 @@ public class TextFlowFactory {
static void addFontSizes(Figure parent, int min, int max) {
for (int i = min; i < max; i++) {
TextFlow tf = new TextFlow(Integer.toString(i) + " pt. Font "); //$NON-NLS-1$
- // tf.setBackgroundColor(ColorConstants.lightGray);
- // tf.setForegroundColor(ColorConstants.yellow);
tf.setFont(new org.eclipse.swt.graphics.Font(org.eclipse.swt.widgets.Display.getDefault(), "Helvetica", i, //$NON-NLS-1$
org.eclipse.swt.SWT.NORMAL));
parent.add(tf);
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowLargeExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowLargeExample.java
index 0806eec51..1210f8ded 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowLargeExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/text/TextFlowLargeExample.java
@@ -41,13 +41,13 @@
public class TextFlowLargeExample {
- static int KEYS_TYPED = 0;
- static boolean PERFORMANCE = false;
+ static int keysTyped = 0;
+ static final boolean PERFORMANCE = false;
static FigureCanvas canvas;
static TextFlow target;
static FlowPage page;
- static Font regularFont = new Font(Display.getDefault(), "Arial", 15, SWT.NORMAL), //$NON-NLS-1$
- boldFont = new Font(Display.getDefault(), "Comic Sans MS", 16, SWT.BOLD); //$NON-NLS-1$
+ static Font regularFont = new Font(Display.getDefault(), "Arial", 15, SWT.NORMAL); //$NON-NLS-1$
+ static Font boldFont = new Font(Display.getDefault(), "Comic Sans MS", 16, SWT.BOLD); //$NON-NLS-1$
public static void main(String[] args) {
Display d = Display.getDefault();
@@ -78,19 +78,20 @@ public void keyPressed(KeyEvent e) {
}
}
- static protected void addText(char c) {
+ protected static void addText(char c) {
if (((c <= 'Z') && (c >= 'A')) || ((c <= 'z') && (c >= 'a')) || (c == ' ')) {
if (target != null) {
target.setText(target.getText() + c);
- if (PERFORMANCE && ((KEYS_TYPED % 10) == 0)) {
- // System.out.println(KEYS_TYPED + " keys typed " + FlowPage.VALIDATIONS + " paints and layouts");
+ if (PERFORMANCE && ((keysTyped % 10) == 0)) {
+ // System.out.println(KEYS_TYPED + " keys typed " + FlowPage.VALIDATIONS + "
+ // paints and layouts");
}
- KEYS_TYPED++;
+ keysTyped++;
}
}
}
- static public void populatePage() {
+ public static void populatePage() {
target = new TextFlow("Normal text."); //$NON-NLS-1$
target.setToolTip(new Label("This is a Tooltip")); //$NON-NLS-1$
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/thumbnail/ThumbnailExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/thumbnail/ThumbnailExample.java
index 2a821772d..ad1f99897 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/thumbnail/ThumbnailExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/thumbnail/ThumbnailExample.java
@@ -40,7 +40,8 @@
public class ThumbnailExample {
private static Figure contents;
- private static Shell mainShell, overviewShell;
+ private static Shell mainShell;
+ private static Shell overviewShell;
private static Dimension offset = new Dimension();
public static void main(String[] args) {
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeBranch.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeBranch.java
index 516a97a77..10b41dc71 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeBranch.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeBranch.java
@@ -135,8 +135,8 @@ public void collapse() {
IFigure root = this;
Viewport port = null;
while (root.getParent() != null) {
- if (root instanceof Viewport) {
- port = ((Viewport) root);
+ if (root instanceof Viewport vp) {
+ port = vp;
}
root = root.getParent();
}
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeLayout.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeLayout.java
index aeae6a989..84849e108 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeLayout.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeLayout.java
@@ -22,8 +22,8 @@
import org.eclipse.draw2d.geometry.Transposer;
/**
- * Performs a layout on a container containing {@link AbstractBranch} figures.
- * This layout is similar to FlowLayout, except that the children are squeezed
+ * Performs a layout on a container containing {@link TreeBranch} figures. This
+ * layout is similar to FlowLayout, except that the children are squeezed
* together to overlap by comparing their left and right contours.
*
* @author hudsonr Created on Apr 18, 2003
@@ -45,12 +45,12 @@ protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHi
return result.getSize();
}
- private static int[] calculateNewRightContour(int old[], int add[], int shift) {
+ private static int[] calculateNewRightContour(int[] old, int[] add, int shift) {
if (old == null) {
return add;
}
- // if (shift < 0)
- // shift = 0;
+ // if (shift < 0)
+ // shift = 0;
int[] result = new int[Math.max(old.length, add.length)];
System.arraycopy(add, 0, result, 0, add.length);
for (int i = add.length; i < result.length; i++) {
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeRoot.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeRoot.java
index 25faca94d..848ab72b1 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeRoot.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/tree/TreeRoot.java
@@ -98,9 +98,6 @@ public void validate() {
super.validate();
}
- /**
- * @return
- */
public boolean isCompressed() {
return compression;
}
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/UMLClassFigure.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/UMLClassFigure.java
index 3635c53ad..c20f4190a 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/UMLClassFigure.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/UMLClassFigure.java
@@ -26,17 +26,17 @@
public class UMLClassFigure extends Figure {
/** Background color of UMLFigure */
- public static Color classColor = new Color(null, 255, 255, 206);
+ public static final Color CLASS_COLOR = new Color(null, 255, 255, 206);
/** CompartmentFigures */
- private CompartmentFigure attributeFigure = new CompartmentFigure();
- private CompartmentFigure methodFigure = new CompartmentFigure();
+ private final CompartmentFigure attributeFigure = new CompartmentFigure();
+ private final CompartmentFigure methodFigure = new CompartmentFigure();
public UMLClassFigure(Label name) {
ToolbarLayout layout = new ToolbarLayout();
setLayoutManager(layout);
setBorder(new LineBorder(ColorConstants.black, 1));
- setBackgroundColor(classColor);
+ setBackgroundColor(CLASS_COLOR);
setOpaque(true);
add(name);
diff --git a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/ZoomExample.java b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/ZoomExample.java
index 1e0002f1f..abde5e1d3 100644
--- a/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/ZoomExample.java
+++ b/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/zoom/ZoomExample.java
@@ -40,9 +40,8 @@
public class ZoomExample {
private static Figure contents;
- // private static Shell overviewShell;
- public static void main(String args[]) {
+ public static void main(String[] args) {
Display d = new Display();
final Shell shell = new Shell(d);
shell.setSize(800, 800);