svn-gvsig-desktop / branches / v10 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / tools / Behavior / IBehavior.java @ 20100
History | View | Annotate | Download (4.87 KB)
1 |
package com.iver.cit.gvsig.fmap.tools.Behavior; |
---|---|
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 com.iver.cit.gvsig.fmap.MapControl; |
9 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
10 |
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener; |
11 |
|
12 |
/**
|
13 |
* <p>When a programmer needs to add a way to permit user to interact with the current object where the graphical
|
14 |
* information is stored and represented, (see {@link MapControl MapControl}), must analyze and decide the basic
|
15 |
* <i>behavior</i> nature of the interaction.</p>
|
16 |
*
|
17 |
* <p>That <i>behavior</i> will manage mouse events and generate information and <i>tool</i> events that the
|
18 |
* associated {@link ToolListener ToolListener} will use to interact with the <code>MapControl</code> object ultimately.</p>
|
19 |
*
|
20 |
* <p>It will be possible also combine more than one <i>behavior</i> for a tool listener, for having a richness tool.</p>
|
21 |
*/
|
22 |
public interface IBehavior { |
23 |
/**
|
24 |
* <p>Gets the <code>ToolListener</code> used by this behavior to perform actions on the
|
25 |
* associated <code>MapControl</code> object.</p>
|
26 |
*
|
27 |
* @return the <code>ToolListener</code> used by this behavior
|
28 |
*/
|
29 |
public ToolListener getListener();
|
30 |
|
31 |
/**
|
32 |
* <p>Method executed in real-time, when user is working with a tool on the associated <code>MapControl</code>
|
33 |
* object, repainting the <code>MapControl</code>'s image.</p>
|
34 |
*
|
35 |
* <p>Returns immediately in all cases, even if the complete image has not yet been loaded.</p>
|
36 |
*
|
37 |
* <p>This method will be implemented according to the specific nature of each behavior, and its
|
38 |
* extra and particular features.</p>
|
39 |
*
|
40 |
* @see Graphics#drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)
|
41 |
*/
|
42 |
public void paintComponent(Graphics g); |
43 |
|
44 |
/**
|
45 |
* <p>Associates this behavior to a <code>MapControl</code> object.</p>
|
46 |
*
|
47 |
* @param mc the <code>MapControl</code> object to associate
|
48 |
*
|
49 |
* @see #getMapControl()
|
50 |
*/
|
51 |
public void setMapControl(MapControl mc); |
52 |
|
53 |
/**
|
54 |
* <p>Gets the mouse cursor of the tool listener associated to this behavior.</p>
|
55 |
*
|
56 |
* @return the mouse cursor of the tool listener associated
|
57 |
*/
|
58 |
public Cursor getCursor(); |
59 |
|
60 |
/**
|
61 |
* <p>Returns the reference to the <code>MapControl</code> object that this behavior uses.</p>
|
62 |
*
|
63 |
* @return the <code>MapControl</code> object used this behavior
|
64 |
*
|
65 |
* @see #setMapControl(MapControl)
|
66 |
*/
|
67 |
public MapControl getMapControl();
|
68 |
|
69 |
/**
|
70 |
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
|
71 |
*
|
72 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse clicked event</i>, by the <code>IBehavior</code> object
|
73 |
*/
|
74 |
public void mouseClicked(MouseEvent e) throws BehaviorException; |
75 |
|
76 |
/**
|
77 |
* @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
|
78 |
*
|
79 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse entered event</i>, by the <code>IBehavior</code> object
|
80 |
*/
|
81 |
public void mouseEntered(MouseEvent e) throws BehaviorException; |
82 |
|
83 |
/**
|
84 |
* @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
|
85 |
*
|
86 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse exited event</i>, by the <code>IBehavior</code> object
|
87 |
*/
|
88 |
public void mouseExited(MouseEvent e) throws BehaviorException; |
89 |
|
90 |
/**
|
91 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
|
92 |
*
|
93 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse pressed event</i>, by the <code>IBehavior</code> object
|
94 |
*/
|
95 |
public void mousePressed(MouseEvent e) throws BehaviorException; |
96 |
|
97 |
/**
|
98 |
* @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
|
99 |
*
|
100 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse released event</i>, by the <code>IBehavior</code> object
|
101 |
*/
|
102 |
public void mouseReleased(MouseEvent e) throws BehaviorException; |
103 |
|
104 |
/**
|
105 |
* @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
|
106 |
*
|
107 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse dragged event</i>, by the <code>IBehavior</code> object
|
108 |
*/
|
109 |
public void mouseDragged(MouseEvent e) throws BehaviorException; |
110 |
|
111 |
/**
|
112 |
* @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
|
113 |
*
|
114 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse moved event</i>, by the <code>IBehavior</code> object
|
115 |
*/
|
116 |
public void mouseMoved(MouseEvent e) throws BehaviorException; |
117 |
|
118 |
/**
|
119 |
* @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
|
120 |
*
|
121 |
* @throws BehaviorException any exception processing the action associated to a <i>mouse wheel event</i>, by the <code>IBehavior</code> object
|
122 |
*/
|
123 |
public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException; |
124 |
|
125 |
} |