Statistics
| Revision:

svn-gvsig-desktop / tags / J2ME_compat_v1_2_Build_1209 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / LayerPositionEvent.java @ 19509

History | View | Annotate | Download (3.15 KB)

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

    
43
/**
44
 * <p>The class <code>LayerPositionEvent</code> stores all necessary information
45
 * in relation with an event associated to a position event of the layer in the TOC.
46
 * 
47
 * @author Vicente Caballero Navarro
48
 */
49
public class LayerPositionEvent extends LayerCollectionEvent {
50
        /**
51
         * Specifies the index that the layer had in case that the event is a 
52
         * layerMoved. In case that the event is not a layerMoved, it will have 
53
         * the same value as the index attribute.
54
         */
55
        private int oldPos;
56

    
57
        /** Indice de la capa en la coleccion */
58
        private int newPos;
59

    
60
        private final static int LAYER_MOVING = 4;
61

    
62
        private final static int LAYER_MOVED = 1;
63

    
64
        /**
65
         * Creates a layer moved event when the layer has been moved.
66
         * @param lyr specific layer
67
         * @param oldp old position        
68
         * @param newp new position
69
         * @return
70
         */
71
        public static LayerPositionEvent createLayerMovedEvent(FLayer lyr, int oldp, int newp){
72
                return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVED);
73
        }
74
        /**
75
         * Creates a layer moved event when the layer is being moved.
76
         * @param lyr specific layer
77
         * @param oldp old position        
78
         * @param newp new position
79
         * @return
80
         */
81
        public static LayerPositionEvent createLayerMovingEvent(FLayer lyr, int oldp, int newp){
82
                return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVING);
83
        }
84

    
85
        /**
86
         * Constructor method.Creates a new LayerPositionEvent.
87
         *
88
         * @param lyr
89
         * @param oldp Old position.
90
         * @param newp New position.
91
         */
92
        private LayerPositionEvent(FLayer lyr, int oldp, int newp, int eventType) {
93
                super(lyr, eventType);
94
                oldPos = oldp;
95
                newPos = newp;
96
        }
97

    
98
        /**
99
         * Returns the start position.
100
         *
101
         * @return Start position.
102
         */
103
        public int getOldPos() {
104
                return oldPos;
105
        }
106

    
107
        /**
108
         * Returns the destination position.
109
         *
110
         * @return destination position.
111
         */
112
        public int getNewPos() {
113
                return newPos;
114
        }
115
}