Skip to main content
summaryrefslogtreecommitdiffstats
blob: e4690d0fc46f8bcf240803d22e2802a05c4f1130 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*******************************************************************************
 * Copyright (c) 2004, 2005 Sybase, Inc. and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Sybase, Inc. - initial API and implementation
 *******************************************************************************/

package org.eclipse.jst.jsf.facesconfig.ui.pageflow.command;

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;

/**
 * base class for bend point commands.
 * 
 */
/*package*/ abstract class BendpointCommand extends Command {
	/** the index of the bend point */
	protected int index;

	/** the location of the bendpoint */
	protected Point location;

	/** the parent link */
	protected PageflowLink link;

	/** relative dimension between the bendpoint with start point of the pflink */
	private Dimension dimStart;

	/** relative dimension between the bendpoint with end point of the pflink */
	private Dimension dimEnd;

	/**
	 * @param label
	 */
	public BendpointCommand(String label) {
		super(label);
	}

	/**
	 * get the dimension between the bendpoint and start point
	 * 
	 * @return - the start dimension
	 */
	protected Dimension getFirstRelativeDimension() {
		return dimStart;
	}

	/**
	 * get the dimension between the bendpoint and end point
	 * 
	 * @return - the end dimension
	 */
	protected Dimension getSecondRelativeDimension() {
		return dimEnd;
	}

	/**
	 * get the index of the bend point
	 * 
	 * @return - the index
	 */
	protected int getIndex() {
		return index;
	}

	/**
	 * get the location of the bend point
	 * 
	 * @return - the index
	 */
	protected Point getLocation() {
		return location;
	}

	/**
	 * get the parent link
	 * 
	 * @return - parent link
	 */
	protected PageflowLink getPFLink() {
		return link;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see Command#redo()
	 */
	public void redo() {
		execute();
	}

	/**
	 * set the relative dimensions of the bendpoint
	 * 
	 * @param dim1 -
	 *            the dimension between the bendpoint and start point
	 * @param dim2 -
	 *            the dimension between the bendpoint and end point
	 */
	public void setRelativeDimensions(Dimension dim1, Dimension dim2) {
		dimStart = dim1;
		dimEnd = dim2;
	}

	/**
	 * set the index of the bendpoint in the bendpoint list
	 * 
	 * @param i -
	 *            index
	 */
	public void setIndex(int i) {
		index = i;
	}

	/**
	 * set the location of the bendpoing
	 * 
	 * @param p -
	 *            new location
	 */
	public void setLocation(Point p) {
		location = p;
	}

	/**
	 * set the parent link
	 * 
	 * @param newLink -
	 *            new parent pflink
	 */
	public void setPFLink(PageflowLink newLink) {
		link = newLink;
	}
}

Back to the top