Project

General

Profile

Download (2.06 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.handles;
12

    
13
import java.beans.PropertyChangeEvent;
14
import java.beans.PropertyChangeListener;
15

    
16
import org.eclipse.gef.DragTracker;
17

    
18
/**
19
 * A handle for bendpoints on a connection.
20
 */
21
public class BendpointHandle extends ConnectionHandle implements
22
		PropertyChangeListener {
23

    
24
	/*
25
	 * @TODO:Pratik No need to implement PropertyChangeListener or override
26
	 * propertyChange()
27
	 */
28

    
29
	private int index;
30

    
31
	/**
32
	 * By default, <code>null</code> is returned for the DragTracker.
33
	 * 
34
	 * @return returns null by default
35
	 */
36
	protected DragTracker createDragTracker() {
37
		return null;
38
	}
39

    
40
	/**
41
	 * Returns the index. This could mean different things for different
42
	 * subclasses. It could be the index of the point the handle belongs to. Or
43
	 * it could be the index of the handle itself. For
44
	 * {@link BendpointCreationHandle}s and {@link BendpointMoveHandle}s, this
45
	 * is the index of the handle itself, where these two types of handles are
46
	 * indexed separately. For example, if you have one bendpoint, you will have
47
	 * 2 creation handles, indexed as 0 and 1, and 1 move handle, indexed as 0.
48
	 * 
49
	 * @return the index
50
	 */
51
	public int getIndex() {
52
		return index;
53
	}
54

    
55
	/**
56
	 * Revalidates this handle when the connection's points change.
57
	 * 
58
	 * @param event
59
	 *            the event that caused the points change
60
	 */
61
	public void propertyChange(PropertyChangeEvent event) {
62
		revalidate();
63
	}
64

    
65
	/**
66
	 * Sets the index.
67
	 * 
68
	 * @param i
69
	 *            the new index
70
	 * @see #getIndex()
71
	 */
72
	protected void setIndex(int i) {
73
		index = i;
74
	}
75

    
76
}
(3-3/19)