Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libFMap_mapcontrol / src / org / gvsig / fmap / mapcontrol / tools / Behaibor / IBehavior.java @ 21203

History | View | Annotate | Download (5 KB)

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

    
3
import java.awt.Cursor;
4
import java.awt.Graphics;
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.tools.BehaviorException;
10
import org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener;
11

    
12

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

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

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

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

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

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

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

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

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

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

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

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

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

    
126
}