Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_controls / src / org / gvsig / fmap / mapcontrol / tools / Behavior / IBehavior.java @ 38564

History | View | Annotate | Download (5.05 KB)

1
package org.gvsig.fmap.mapcontrol.tools.Behavior;
2

    
3
import java.awt.Graphics;
4
import java.awt.Image;
5
import java.awt.event.MouseEvent;
6
import java.awt.event.MouseWheelEvent;
7

    
8
import org.gvsig.fmap.mapcontrol.MapControl;
9
import org.gvsig.fmap.mapcontrol.MapControlDrawer;
10
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
11
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener;
12

    
13

    
14
/**
15
 * <p>When a programmer needs to add a way to permit user to interact with the current object where the graphical
16
 *  information is stored and represented, (see {@link MapControl MapControl}), must analyze and decide the basic
17
 *  <i>behavior</i> nature of the interaction.</p>
18
 *
19
 * <p>That <i>behavior</i> will manage mouse events and generate information and <i>tool</i> events that the
20
 *  associated {@link ToolListener ToolListener} will use to interact with the <code>MapControl</code> object ultimately.</p>
21
 *
22
 * <p>It will be possible also combine more than one <i>behavior</i> for a tool listener, for having a richness tool.</p>
23
 */
24
public interface IBehavior {
25
        /**
26
         * <p>Gets the <code>ToolListener</code> used by this behavior to perform actions on the
27
         *  associated <code>MapControl</code> object.</p>
28
         *
29
         * @return the <code>ToolListener</code> used by this behavior
30
         */
31
        public ToolListener getListener();
32

    
33
        /**
34
         * <p>Method executed in real-time, when user is working with a tool on the associated <code>MapControl</code>
35
         *  object, repainting the <code>MapControl</code>'s image.</p>
36
         *
37
         * <p>Returns immediately in all cases, even if the complete image has not yet been loaded.</p>
38
         *
39
         * <p>This method will be implemented according to the specific nature of each behavior, and its
40
         *  extra and particular features.</p>
41
         *
42
         * @see Graphics#drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
43
         */
44
        public void paintComponent(MapControlDrawer renderer);
45

    
46
        /**
47
         * <p>Associates this behavior to a <code>MapControl</code> object.</p>
48
         *
49
         * @param mc the <code>MapControl</code> object to associate
50
         *
51
         * @see #getMapControl()
52
         */
53
        public void setMapControl(MapControl mc);
54

    
55
        /**
56
         * <p>Gets the mouse cursor of the tool listener associated to this behavior.</p>
57
         *
58
         * @return the mouse cursor of the tool listener associated
59
         */
60
        public Image getImageCursor();
61

    
62
        /**
63
         * <p>Returns the reference to the <code>MapControl</code> object that this behavior uses.</p>
64
         *
65
         * @return the <code>MapControl</code> object used this behavior
66
         *
67
         * @see #setMapControl(MapControl)
68
         */
69
        public MapControl getMapControl();
70

    
71
        /**
72
         * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
73
         *
74
         * @throws BehaviorException any exception processing the action associated to a <i>mouse clicked event</i>, by the <code>IBehavior</code> object
75
         */
76
        public void mouseClicked(MouseEvent e) throws BehaviorException;
77

    
78
        /**
79
         * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
80
         *
81
         * @throws BehaviorException any exception processing the action associated to a <i>mouse entered event</i>, by the <code>IBehavior</code> object
82
         */
83
        public void mouseEntered(MouseEvent e) throws BehaviorException;
84

    
85
        /**
86
         * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
87
         *
88
         * @throws BehaviorException any exception processing the action associated to a <i>mouse exited event</i>, by the <code>IBehavior</code> object
89
         */
90
        public void mouseExited(MouseEvent e) throws BehaviorException;
91

    
92
        /**
93
         * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
94
         *
95
         * @throws BehaviorException any exception processing the action associated to a <i>mouse pressed event</i>, by the <code>IBehavior</code> object
96
         */
97
        public void mousePressed(MouseEvent e) throws BehaviorException;
98

    
99
        /**
100
         * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
101
         *
102
         * @throws BehaviorException any exception processing the action associated to a <i>mouse released event</i>, by the <code>IBehavior</code> object
103
         */
104
        public void mouseReleased(MouseEvent e) throws BehaviorException;
105

    
106
        /**
107
         * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
108
         *
109
         * @throws BehaviorException any exception processing the action associated to a <i>mouse dragged event</i>, by the <code>IBehavior</code> object
110
         */
111
        public void mouseDragged(MouseEvent e) throws BehaviorException;
112

    
113
        /**
114
         * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
115
         *
116
         * @throws BehaviorException any exception processing the action associated to a <i>mouse moved event</i>, by the <code>IBehavior</code> object
117
         */
118
        public void mouseMoved(MouseEvent e) throws BehaviorException;
119

    
120
        /**
121
         * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
122
         *
123
         * @throws BehaviorException any exception processing the action associated to a <i>mouse wheel event</i>, by the <code>IBehavior</code> object
124
         */
125
        public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException;
126

    
127
}