1
|
/*******************************************************************************
|
2
|
* Copyright (c) 2003, 2010 IBM Corporation and others.
|
3
|
* All rights reserved. This program and the accompanying materials
|
4
|
* are made available under the terms of the Eclipse Public License v1.0
|
5
|
* which accompanies this distribution, and is available at
|
6
|
* http://www.eclipse.org/legal/epl-v10.html
|
7
|
*
|
8
|
* Contributors:
|
9
|
* IBM Corporation - initial API and implementation
|
10
|
*******************************************************************************/
|
11
|
package org.eclipse.draw2d.graph;
|
12
|
|
13
|
/**
|
14
|
* calculates the height and y-coordinates for nodes and subgraphs in a compound
|
15
|
* directed graph.
|
16
|
*
|
17
|
* @author Randy Hudson
|
18
|
* @since 2.1.2
|
19
|
*/
|
20
|
class CompoundVerticalPlacement extends VerticalPlacement {
|
21
|
|
22
|
/**
|
23
|
* @see GraphVisitor#visit(DirectedGraph) Extended to set subgraph values.
|
24
|
*/
|
25
|
void visit(DirectedGraph dg) {
|
26
|
CompoundDirectedGraph g = (CompoundDirectedGraph) dg;
|
27
|
super.visit(g);
|
28
|
for (int i = 0; i < g.subgraphs.size(); i++) {
|
29
|
Subgraph s = (Subgraph) g.subgraphs.get(i);
|
30
|
s.y = s.head.y;
|
31
|
s.height = s.tail.height + s.tail.y - s.y;
|
32
|
}
|
33
|
}
|
34
|
|
35
|
}
|