Project

General

Profile

Download (3.98 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2000, 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.gef;
12

    
13
import org.eclipse.draw2d.ConnectionAnchor;
14

    
15
/**
16
 * A specialized <code>GraphicalEditPart</code> that supports both <i>target</i>
17
 * and <i>source</i> <code>ConnectionEditParts</code>. This <em>optional</em>
18
 * interface is used by the default {@link ConnectionEditPart} implementation
19
 * and supporting classes to obtain the correct {@link ConnectionAnchor
20
 * ConnectionAnchors} for the {@link org.eclipse.draw2d.Connection} Figure. This
21
 * interface offers a single access point for obtaining ConnectionAnchors at
22
 * different times. The classes which rely on this interface are:
23
 * <UL>
24
 * <LI>{@link org.eclipse.gef.editparts.AbstractConnectionEditPart} - during
25
 * refresh(), this interface is used to obtain the appropriate ConnectionAnchors
26
 * for the figure.
27
 * <LI>{@link org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy} - during
28
 * creation of a new connection, there is no ConnectionEditPart. Therefore, the
29
 * source node EditPart is responsible for display <i>feedback</i>.
30
 * <LI>{@link org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy} - when
31
 * disconnecting the end of a connection and reattaching it to a new node,
32
 * ConnectionEndpointEditPolicy uses this interface to obtain the proper anchors
33
 * for diaplaying <i>feedback</i>.
34
 * </UL>
35
 */
36
public interface NodeEditPart extends GraphicalEditPart {
37

    
38
	/**
39
	 * Returns the <code>ConnectionAnchor</code> for the specified <i>source</i>
40
	 * connection. This NodeEditPart is the
41
	 * {@link ConnectionEditPart#getSource() source} EditPart for the given
42
	 * connection.
43
	 * <P>
44
	 * The anchor may be a function of the connection's model, the node's model,
45
	 * a combination of both, or it may not depend on anything all.
46
	 * 
47
	 * @param connection
48
	 *            the ConnectionEditPart
49
	 * @return the ConnectionAnchor for the given ConnectionEditPart
50
	 */
51
	ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection);
52

    
53
	/**
54
	 * Returns the <code>ConnectionAnchor</code> for the specified <i>target</i>
55
	 * connection. This NodeEditPart is the
56
	 * {@link ConnectionEditPart#getTarget() target} EditPart for the given
57
	 * connection.
58
	 * <P>
59
	 * The anchor may be a function of the connection's model, the node's model,
60
	 * a combination of both, or it may not depend on anything all.
61
	 * 
62
	 * @param connection
63
	 *            the ConnectionEditPart
64
	 * @return the ConnectionAnchor for the given ConnectionEditPart
65
	 */
66
	ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection);
67

    
68
	/**
69
	 * Returns the <i>source</i> <code>ConnectionAnchor</code> for the specified
70
	 * Request. The returned ConnectionAnchor is used only when displaying
71
	 * <i>feedback</i>. The Request is usually a
72
	 * {@link org.eclipse.gef.requests.LocationRequest}, which provides the
73
	 * current mouse location.
74
	 * 
75
	 * @param request
76
	 *            a Request describing the current interaction
77
	 * @return the ConnectionAnchor to use during feedback
78
	 */
79
	ConnectionAnchor getSourceConnectionAnchor(Request request);
80

    
81
	/**
82
	 * Returns the <i>target</i> <code>ConnectionAnchor</code> for the specified
83
	 * Request. The returned ConnectionAnchor is used only when displaying
84
	 * <i>feedback</i>. The Request is usually a
85
	 * {@link org.eclipse.gef.requests.LocationRequest}, which provides the
86
	 * current mouse location.
87
	 * 
88
	 * @param request
89
	 *            a Request describing the current interaction
90
	 * @return the ConnectionAnchor to use during feedback
91
	 */
92
	ConnectionAnchor getTargetConnectionAnchor(Request request);
93

    
94
}
(29-29/44)