]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/connection/IConnectionAdvisor.java
Two rendering glitch fixes for time series charts
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / connection / IConnectionAdvisor.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.connection;
13
14 import org.simantics.g2d.diagram.handler.Topology.Terminal;
15 import org.simantics.g2d.element.ElementHints;
16 import org.simantics.g2d.element.IElement;
17
18 /**
19  * @author Hannu Niemisto
20  */
21 public interface IConnectionAdvisor {
22
23     /**
24      * @param backend current backend data access object or <code>null</code> if
25      *        there's no ongoing transaction
26      * @param element1
27      * @param term1
28      * @param element2
29      * @param term2
30      * @return a back-end object that describes the type of the connection that
31      *         would be created if the two terminals were connected. If
32      *         <code>null</code> is returned, connection is not to be allowed.
33      *         Otherwise the tools will allow the connection to proceed,
34      *         regardless of whether the connection is in reality sane or not.
35      *         It is the job of the {@link IConnectionAdvisor} to verify this,
36      *         not the tool's.
37      * 
38      * @see ElementHints#KEY_CONNECTION_TYPE
39      */
40     Object canBeConnected(Object backend, IElement element1, Terminal term1, IElement element2, Terminal term2);
41
42     /**
43      * @param backend current backend data access object or <code>null</code> if
44      *        there's no ongoing transaction
45      * @param element
46      * @param term
47      * @return
48      */
49     boolean canBeginConnection(Object backend, IElement element, Terminal term);
50
51 }