root / tags / v1_1_Build_1003 / extensions / extGeoreferencing / src / com / iver / cit / gvsig / fmap / tools / Behavior / DraggedBehavior.java @ 12271
History | View | Annotate | Download (2.62 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package com.iver.cit.gvsig.fmap.tools.Behavior; |
20 |
|
21 |
import java.awt.event.MouseEvent; |
22 |
|
23 |
|
24 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
25 |
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
26 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
27 |
import com.iver.cit.gvsig.fmap.tools.Listeners.DraggedListener; |
28 |
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener; |
29 |
|
30 |
|
31 |
/**
|
32 |
* .
|
33 |
*
|
34 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
35 |
*/
|
36 |
public class DraggedBehavior extends Behavior { |
37 |
private DraggedListener listener;
|
38 |
|
39 |
/**
|
40 |
* Crea un nuevo DraggedListener.
|
41 |
*
|
42 |
* @param l listener.
|
43 |
*/
|
44 |
public DraggedBehavior(DraggedListener l) {
|
45 |
listener = l; |
46 |
} |
47 |
|
48 |
/**
|
49 |
* Reimplementaci?n del m?todo mousePressed de Behavior.
|
50 |
*
|
51 |
* @param e MouseEvent
|
52 |
*/
|
53 |
public void mousePressed(MouseEvent e)throws BehaviorException { |
54 |
PointEvent event = new PointEvent(e.getPoint(), e);
|
55 |
listener.press(event); |
56 |
} |
57 |
|
58 |
/**
|
59 |
* Reimplementaci?n del m?todo mouseReleased de Behavior.
|
60 |
*
|
61 |
* @param e MouseEvent
|
62 |
*
|
63 |
* @throws BehaviorException
|
64 |
*/
|
65 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
66 |
PointEvent event = new PointEvent(e.getPoint(), e);
|
67 |
listener.release(event); |
68 |
} |
69 |
|
70 |
/**
|
71 |
* Reimplementaci?n del m?todo mouseDragged de Behavior.
|
72 |
*
|
73 |
* @param e MouseEvent
|
74 |
*
|
75 |
* @throws BehaviorException
|
76 |
*/
|
77 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
78 |
PointEvent event = new PointEvent(e.getPoint(), e);
|
79 |
listener.dragg(event); |
80 |
} |
81 |
|
82 |
/**
|
83 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(org.gvsig.fmap.tools.ToolListener)
|
84 |
*/
|
85 |
public void setListener(ToolListener listener) { |
86 |
this.listener = (DraggedListener) listener;
|
87 |
} |
88 |
|
89 |
/**
|
90 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener()
|
91 |
*/
|
92 |
public ToolListener getListener() {
|
93 |
return listener;
|
94 |
} |
95 |
} |