Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / tools / Behavior / Behavior.java @ 10627

History | View | Annotate | Download (4.23 KB)

1
/*
2
 * Created on 28-oct-2004
3
 */
4
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
package com.iver.cit.gvsig.fmap.tools.Behavior;
45

    
46
import java.awt.Cursor;
47
import java.awt.Graphics;
48
import java.awt.event.MouseEvent;
49
import java.awt.event.MouseWheelEvent;
50
import java.awt.image.BufferedImage;
51

    
52
import com.iver.cit.gvsig.fmap.MapControl;
53
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
54
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
55

    
56

    
57
/**
58
 * Herramienta del MapControl. Ejecuta acciones respondiendo a eventos, por
59
 * delegaci?n desde MapControl.
60
 *
61
 * @author Luis W. Sevilla
62
 */
63
public abstract class Behavior implements IBehavior {
64
        private MapControl mapControl;
65
        /* (non-Javadoc)
66
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#getListener()
67
         */
68
        public abstract ToolListener getListener();
69

    
70
        /* (non-Javadoc)
71
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#paintComponent(java.awt.Graphics)
72
         */
73
        public void paintComponent(Graphics g) {
74
                BufferedImage img = getMapControl().getImage();
75

    
76
                if (img != null) {
77
                        g.drawImage(img, 0, 0, null);
78
                }
79
        }
80

    
81
        /* (non-Javadoc)
82
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#setMapControl(com.iver.cit.gvsig.fmap.MapControl)
83
         */
84
        public void setMapControl(MapControl mc) {
85
                mapControl = mc;
86
        }
87

    
88
        /* (non-Javadoc)
89
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#getCursor()
90
         */
91
        public Cursor getCursor() {
92
                return getListener().getCursor();
93
        }
94

    
95
        /* (non-Javadoc)
96
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#getMapControl()
97
         */
98
        public MapControl getMapControl() {
99
                return mapControl;
100
        }
101

    
102
        /* (non-Javadoc)
103
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseClicked(java.awt.event.MouseEvent)
104
         */
105
        public void mouseClicked(MouseEvent e) throws BehaviorException {
106
        }
107

    
108
        /* (non-Javadoc)
109
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseEntered(java.awt.event.MouseEvent)
110
         */
111
        public void mouseEntered(MouseEvent e) throws BehaviorException {
112
        }
113

    
114
        /* (non-Javadoc)
115
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseExited(java.awt.event.MouseEvent)
116
         */
117
        public void mouseExited(MouseEvent e) throws BehaviorException {
118
        }
119

    
120
        /* (non-Javadoc)
121
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mousePressed(java.awt.event.MouseEvent)
122
         */
123
        public void mousePressed(MouseEvent e) throws BehaviorException {
124
        }
125

    
126
        /* (non-Javadoc)
127
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseReleased(java.awt.event.MouseEvent)
128
         */
129
        public void mouseReleased(MouseEvent e) throws BehaviorException {
130
        }
131

    
132
        /* (non-Javadoc)
133
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseDragged(java.awt.event.MouseEvent)
134
         */
135
        public void mouseDragged(MouseEvent e) throws BehaviorException {
136
        }
137

    
138
        /* (non-Javadoc)
139
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseMoved(java.awt.event.MouseEvent)
140
         */
141
        public void mouseMoved(MouseEvent e) throws BehaviorException {
142
        }
143

    
144
        /* (non-Javadoc)
145
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.IBehavior#mouseWheelMoved(java.awt.event.MouseWheelEvent)
146
         */
147
        public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException {
148
        }
149
}