]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/impl/proxy/ProxyTerminalHandler.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / impl / proxy / ProxyTerminalHandler.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.element.handler.impl.proxy;
13
14 import java.awt.Shape;
15 import java.awt.geom.AffineTransform;
16
17 import org.simantics.g2d.diagram.handler.Topology.Terminal;
18 import org.simantics.g2d.element.IElement;
19 import org.simantics.g2d.element.handler.TerminalLayout;
20 import org.simantics.g2d.utils.geom.DirectionSet;
21
22 /**
23  * @author Toni Kalajainen
24  */
25 public class ProxyTerminalHandler implements TerminalLayout {
26
27     private static final long serialVersionUID = 219568974959605233L;
28
29     TerminalLayout orig;
30     IProxyProvider provider;
31
32     public ProxyTerminalHandler(IProxyProvider provider, TerminalLayout orig) {
33         this.provider = provider;
34         this.orig = orig;
35     }
36
37     @Override
38     public AffineTransform getTerminalPosition(IElement node, Terminal t) {
39         return orig.getTerminalPosition(provider.provide(node), t);
40     }
41
42     @Override
43     public boolean getTerminalDirection(IElement node, Terminal t, DirectionSet directions) {
44         return orig.getTerminalDirection(node, t, directions);
45     }
46
47     @Override
48     public Shape getTerminalShape(IElement node, Terminal t) {
49         return orig.getTerminalShape(node, t);
50     }
51
52 }