Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/LayerPositionEvent.java
LayerPositionEvent.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap.layers; |
42 | 42 |
|
43 | 43 |
/** |
44 |
* Evento de posici?n de la capa en el TOC.
|
|
44 |
* <p>Event produced when a layer has been or is being moved from a collection of layers.</p>
|
|
45 | 45 |
* |
46 | 46 |
* @author Vicente Caballero Navarro |
47 | 47 |
*/ |
48 | 48 |
public class LayerPositionEvent extends LayerCollectionEvent { |
49 | 49 |
/** |
50 |
* Indica el indice que ten?a la capa afectada en caso de que el evento sea |
|
51 |
* un layerMoved. En caso de que no sea dicho evento, tendra el mismo |
|
52 |
* valor que el atributo index |
|
50 |
* <p>If this event is a <i>LAYER_MOVED</i> type, stores the previous index of the affected layer in the layer |
|
51 |
* collection; otherwise its value will be the same as the <code>newPos</code> one.</p> |
|
53 | 52 |
*/ |
54 | 53 |
private int oldPos; |
55 | 54 |
|
56 |
/** Indice de la capa en la coleccion */ |
|
55 |
/** |
|
56 |
* <p>The new index in the layer collection of the layer affected.</p> |
|
57 |
*/ |
|
57 | 58 |
private int newPos; |
58 | 59 |
|
60 |
/** |
|
61 |
* <p>Identifies this event as a action on a layer that is being moved.</p> |
|
62 |
*/ |
|
59 | 63 |
private final static int LAYER_MOVING = 4; |
60 | 64 |
|
65 |
/** |
|
66 |
* <p>Identifies this event as a action on a layer that has been moved.</p> |
|
67 |
*/ |
|
61 | 68 |
private final static int LAYER_MOVED = 1; |
62 | 69 |
|
63 |
|
|
70 |
/** |
|
71 |
* <p>Creates a new layer position event notifying a "layer moved" action.</p> |
|
72 |
* |
|
73 |
* @param lyr layer affected by the action |
|
74 |
* @param oldp previous index of the affected layer in the layer collection |
|
75 |
* @param newp new index of the affected layer in the layer collection |
|
76 |
* |
|
77 |
* @return a new layer position event |
|
78 |
*/ |
|
64 | 79 |
public static LayerPositionEvent createLayerMovedEvent(FLayer lyr, int oldp, int newp){ |
65 | 80 |
return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVED); |
66 | 81 |
} |
67 | 82 |
|
83 |
/** |
|
84 |
* <p>Creates a new layer position event notifying a "layer moving" action.</p> |
|
85 |
* |
|
86 |
* @param lyr layer affected by the action |
|
87 |
* @param oldp previous index of the affected layer in the layer collection |
|
88 |
* @param newp new index of the affected layer in the layer collection |
|
89 |
* |
|
90 |
* @return a new layer position event |
|
91 |
*/ |
|
68 | 92 |
public static LayerPositionEvent createLayerMovingEvent(FLayer lyr, int oldp, int newp){ |
69 | 93 |
return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVING); |
70 | 94 |
} |
71 | 95 |
|
72 | 96 |
/** |
73 |
* Crea un nuevo LayerPositionEvent. |
|
74 |
* |
|
75 |
* @param lyr |
|
76 |
* @param oldp Antigua posici?n. |
|
77 |
* @param newp Nueva posici?n. |
|
97 |
* <p>Creates a new layer position event of the specified type.</p> |
|
98 |
* |
|
99 |
* @param lyr layer affected by the action |
|
100 |
* @param oldp previous index of the affected layer in the layer collection |
|
101 |
* @param newp new index of the affected layer in the layer collection |
|
102 |
* @param eventType type of layer collection event |
|
103 |
* |
|
104 |
* @return a new layer position event |
|
78 | 105 |
*/ |
79 | 106 |
private LayerPositionEvent(FLayer lyr, int oldp, int newp, int eventType) { |
80 | 107 |
super(lyr, eventType); |
... | ... | |
83 | 110 |
} |
84 | 111 |
|
85 | 112 |
/** |
86 |
* Devuelve la posici?n origen.
|
|
113 |
* <p>Gets the previous index of the affected layer in the layer collection.</p>
|
|
87 | 114 |
* |
88 |
* @return Posici?n origen.
|
|
115 |
* @return the previous index
|
|
89 | 116 |
*/ |
90 | 117 |
public int getOldPos() { |
91 | 118 |
return oldPos; |
92 | 119 |
} |
93 | 120 |
|
94 | 121 |
/** |
95 |
* Devuelve la posici?n destino.
|
|
122 |
* <p>Gets the new index of the affected layer in the layer collection.</p>
|
|
96 | 123 |
* |
97 |
* @return Posici?n destino.
|
|
124 |
* @return the new index
|
|
98 | 125 |
*/ |
99 | 126 |
public int getNewPos() { |
100 | 127 |
return newPos; |
Also available in: Unified diff