svn-gvsig-desktop / trunk / prototypes / mobile / desktop / extensions / extExportMobile / src / es / prodevelop / gvsig / exportMobile / LayerObject.java @ 19124
History | View | Annotate | Download (3.69 KB)
1 |
package es.prodevelop.gvsig.exportMobile; |
---|---|
2 |
|
3 |
|
4 |
import javax.swing.JButton; |
5 |
import javax.swing.JCheckBox; |
6 |
import javax.swing.JComboBox; |
7 |
import javax.swing.JLabel; |
8 |
import javax.swing.JPanel; |
9 |
|
10 |
import com.iver.cit.gvsig.fmap.drivers.FieldDescription; |
11 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
12 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
13 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
14 |
import com.iver.cit.gvsig.fmap.layers.FLyrWMS; |
15 |
|
16 |
/**
|
17 |
* Create a layer object with its checkbox, button, combo and description change
|
18 |
* the name to the layer if the name layer is duplicate
|
19 |
*
|
20 |
* @author Anabel Moreno
|
21 |
*
|
22 |
*/
|
23 |
public class LayerObject { |
24 |
|
25 |
private JCheckBox boxLyr; |
26 |
|
27 |
private String nameLyr; |
28 |
|
29 |
private JComboBox comboLyr; |
30 |
|
31 |
private FieldDescription[] description; |
32 |
|
33 |
private FLayer lyr;
|
34 |
|
35 |
private JButton buttonLyr; |
36 |
|
37 |
private JPanel parent; |
38 |
|
39 |
private JLabel isInto; |
40 |
|
41 |
// private String nameNew;
|
42 |
|
43 |
/**
|
44 |
* @param box
|
45 |
* layer
|
46 |
* @param name
|
47 |
* layer order
|
48 |
* @param combo
|
49 |
* layer
|
50 |
* @param layer
|
51 |
* @param button
|
52 |
* layer
|
53 |
*/
|
54 |
public LayerObject(JCheckBox box, String name, JComboBox combo, |
55 |
FLayer layerwn, JButton button,JPanel pa) { |
56 |
|
57 |
parent=pa; |
58 |
boxLyr = box; |
59 |
nameLyr = name; |
60 |
comboLyr = combo; |
61 |
buttonLyr = button; |
62 |
|
63 |
|
64 |
try {
|
65 |
// lyr = layer.cloneLayer();
|
66 |
// lyr.setName(nameLyr);
|
67 |
// lyr.setProjection(layer.getProjection());
|
68 |
// jldominguez december 2007
|
69 |
lyr = layerwn; |
70 |
} catch (Exception e) { |
71 |
e.printStackTrace(); |
72 |
} |
73 |
|
74 |
if(boxLyr.isSelected()==true){ |
75 |
|
76 |
if(lyr instanceof FLyrVect){ |
77 |
comboLyr.setEnabled(true);
|
78 |
buttonLyr.setEnabled(true);
|
79 |
} |
80 |
if(lyr instanceof FLyrRaster){ |
81 |
comboLyr.setEnabled(true);
|
82 |
buttonLyr.setEnabled(false);
|
83 |
} |
84 |
} |
85 |
else{
|
86 |
comboLyr.setEnabled(false);
|
87 |
buttonLyr.setEnabled(false);
|
88 |
} |
89 |
|
90 |
|
91 |
|
92 |
if (lyr instanceof FLyrRaster) { |
93 |
buttonLyr.setEnabled(false);
|
94 |
} |
95 |
if (lyr instanceof FLyrWMS) { |
96 |
|
97 |
comboLyr.setEnabled(false);
|
98 |
buttonLyr.setEnabled(false);
|
99 |
} |
100 |
} |
101 |
|
102 |
/**
|
103 |
* @return parent
|
104 |
*/
|
105 |
public JPanel getParent(){ |
106 |
return parent;
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* Set box layer selected
|
111 |
*
|
112 |
* @param st
|
113 |
*/
|
114 |
public void setBoxStatus(boolean st) { |
115 |
|
116 |
boxLyr.setSelected(st); |
117 |
|
118 |
} |
119 |
|
120 |
/**
|
121 |
* @return layer button
|
122 |
*/
|
123 |
public JButton getButton() { |
124 |
|
125 |
return buttonLyr;
|
126 |
} |
127 |
|
128 |
|
129 |
/**
|
130 |
* @return layer name
|
131 |
*/
|
132 |
public String getName() { |
133 |
|
134 |
return nameLyr;
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* Change layer name
|
139 |
* @param name
|
140 |
*/
|
141 |
public void setName(String n){ |
142 |
|
143 |
nameLyr = n; |
144 |
} |
145 |
|
146 |
/**
|
147 |
* @return layer checkbox
|
148 |
*/
|
149 |
public JCheckBox getBox() { |
150 |
|
151 |
return boxLyr;
|
152 |
} |
153 |
|
154 |
/**
|
155 |
* @return layer combo
|
156 |
*/
|
157 |
public JComboBox getCombo() { |
158 |
|
159 |
return comboLyr;
|
160 |
} |
161 |
|
162 |
/**
|
163 |
* set combo properties (enabled and selected index)
|
164 |
* @param combo
|
165 |
* @param indx
|
166 |
*/
|
167 |
public void setCombo(boolean combo,int indx){ |
168 |
|
169 |
comboLyr.setEnabled(combo); |
170 |
comboLyr.setSelectedIndex(indx); |
171 |
} |
172 |
|
173 |
/**
|
174 |
* Set layer field description
|
175 |
*
|
176 |
* @param atribSelected
|
177 |
*/
|
178 |
public void setDescription(FieldDescription[] atribSelected) { |
179 |
|
180 |
description = atribSelected; |
181 |
} |
182 |
|
183 |
/**
|
184 |
* @return layer description
|
185 |
*/
|
186 |
public FieldDescription[] getDescription() { |
187 |
|
188 |
return description;
|
189 |
} |
190 |
|
191 |
/**
|
192 |
* set image layer, if this is into the view, and create a label with this image
|
193 |
* @param imgInto
|
194 |
*/
|
195 |
public void setImage(JLabel imgInto){ |
196 |
|
197 |
isInto=imgInto; |
198 |
|
199 |
} |
200 |
|
201 |
/**
|
202 |
* @return image label
|
203 |
*/
|
204 |
public JLabel getImgLbl(){ |
205 |
|
206 |
return isInto;
|
207 |
} |
208 |
|
209 |
public FLayer getLyr() {
|
210 |
return lyr;
|
211 |
} |
212 |
|
213 |
public void setLyr(FLayer lyr) { |
214 |
this.lyr = lyr;
|
215 |
} |
216 |
|
217 |
|
218 |
} |