|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2005, 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 |
|
| 12 |
package org.eclipse.draw2d.graph; |
| 13 |
|
| 14 |
import org.eclipse.draw2d.PositionConstants; |
| 15 |
|
| 16 |
class CompoundTransposeMetrics extends TransposeMetrics { |
| 17 |
|
| 18 |
public void visit(DirectedGraph g) { |
| 19 |
if (g.getDirection() == PositionConstants.SOUTH) |
| 20 |
return; |
| 21 |
super.visit(g); |
| 22 |
int temp; |
| 23 |
CompoundDirectedGraph cg = (CompoundDirectedGraph) g; |
| 24 |
for (int i = 0; i < cg.subgraphs.size(); i++) { |
| 25 |
Node node = cg.subgraphs.getNode(i); |
| 26 |
temp = node.width; |
| 27 |
node.width = node.height; |
| 28 |
node.height = temp; |
| 29 |
if (node.getPadding() != null) |
| 30 |
node.setPadding(t.t(node.getPadding())); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
public void revisit(DirectedGraph g) { |
| 35 |
if (g.getDirection() == PositionConstants.SOUTH) |
| 36 |
return; |
| 37 |
super.revisit(g); |
| 38 |
int temp; |
| 39 |
CompoundDirectedGraph cg = (CompoundDirectedGraph) g; |
| 40 |
for (int i = 0; i < cg.subgraphs.size(); i++) { |
| 41 |
Node node = (Node) cg.subgraphs.get(i); |
| 42 |
temp = node.width; |
| 43 |
node.width = node.height; |
| 44 |
node.height = temp; |
| 45 |
temp = node.y; |
| 46 |
node.y = node.x; |
| 47 |
node.x = temp; |
| 48 |
if (node.getPadding() != null) |
| 49 |
node.setPadding(t.t(node.getPadding())); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
} |