svn-gvsig-desktop / tags / v1_0_2_Build_903 / extensions / extCAD / src / com / iver / cit / gvsig / gui / preferences / EditionPreferencePage.java @ 10704
History | View | Annotate | Download (15 KB)
1 | 5793 | fjp | /* 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.gui.preferences; |
||
42 | |||
43 | import java.awt.BorderLayout; |
||
44 | 6805 | jaume | import java.awt.event.KeyEvent; |
45 | import java.awt.event.KeyListener; |
||
46 | 5793 | fjp | import java.util.ArrayList; |
47 | |||
48 | import javax.swing.ImageIcon; |
||
49 | import javax.swing.JLabel; |
||
50 | import javax.swing.JPanel; |
||
51 | import javax.swing.JScrollPane; |
||
52 | import javax.swing.JSeparator; |
||
53 | import javax.swing.JTable; |
||
54 | import javax.swing.JTextField; |
||
55 | import javax.swing.table.AbstractTableModel; |
||
56 | import javax.swing.table.TableModel; |
||
57 | |||
58 | import com.iver.andami.PluginServices; |
||
59 | 5813 | fjp | import com.iver.andami.preferences.AbstractPreferencePage; |
60 | 6660 | caballero | import com.iver.andami.preferences.StoreException; |
61 | 5813 | fjp | import com.iver.cit.gvsig.CADExtension; |
62 | import com.iver.cit.gvsig.EditionManager; |
||
63 | 8765 | jjdelcerro | import com.iver.cit.gvsig.fmap.MapContext; |
64 | import com.iver.cit.gvsig.fmap.MapControl; |
||
65 | 5793 | fjp | import com.iver.cit.gvsig.fmap.layers.FLayer; |
66 | import com.iver.cit.gvsig.fmap.layers.FLayers; |
||
67 | import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
||
68 | 5813 | fjp | import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator; |
69 | 5817 | fjp | import com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool; |
70 | 5813 | fjp | import com.iver.cit.gvsig.layers.VectorialLayerEdited; |
71 | 5793 | fjp | |
72 | public class EditionPreferencePage extends AbstractPreferencePage { |
||
73 | private JLabel jLabel = null; |
||
74 | 5813 | fjp | |
75 | 5793 | fjp | private JTextField jTxtTolerance = null; |
76 | 5813 | fjp | |
77 | 5793 | fjp | private JLabel jLabel1 = null; |
78 | 5813 | fjp | |
79 | 5793 | fjp | private JSeparator jSeparator = null; |
80 | 5813 | fjp | |
81 | 5793 | fjp | private JScrollPane jScrollPane = null; |
82 | 5813 | fjp | |
83 | 5793 | fjp | private JTable jTableSnapping = null; |
84 | 5813 | fjp | |
85 | 5793 | fjp | private JLabel jLabelCache = null; |
86 | 5813 | fjp | |
87 | 5793 | fjp | private JPanel jPanelNord = null; |
88 | 5813 | fjp | |
89 | 5793 | fjp | private JPanel jPanelCache = null; |
90 | 6805 | jaume | private boolean changed = false; |
91 | 5813 | fjp | |
92 | 5793 | fjp | private FLayers layers;
|
93 | 5813 | fjp | |
94 | 8765 | jjdelcerro | private MapContext mapContext;
|
95 | |||
96 | 5813 | fjp | private class MyRecord { |
97 | 5793 | fjp | public Boolean bSelec = new Boolean(false); |
98 | 5813 | fjp | |
99 | 5793 | fjp | public String layerName; |
100 | 5813 | fjp | |
101 | 5793 | fjp | public Integer maxFeat = new Integer(1000); |
102 | } |
||
103 | 5813 | fjp | |
104 | private class MyTableModel extends AbstractTableModel { |
||
105 | 5793 | fjp | private ArrayList records = new ArrayList(); |
106 | 5813 | fjp | |
107 | public MyTableModel(FLayers layers) {
|
||
108 | 5793 | fjp | addLayer(layers); |
109 | } |
||
110 | |||
111 | 5813 | fjp | private void addLayer(FLayer lyr) { |
112 | if (lyr instanceof FLayers) { |
||
113 | 5793 | fjp | FLayers lyrGroup = (FLayers) lyr; |
114 | 5813 | fjp | for (int i = 0; i < lyrGroup.getLayersCount(); i++) { |
115 | FLayer lyr2 = lyrGroup.getLayer(i); |
||
116 | 5793 | fjp | addLayer(lyr2); |
117 | } |
||
118 | 5813 | fjp | } else {
|
119 | if (lyr instanceof FLyrVect) { |
||
120 | FLyrVect aux = (FLyrVect) lyr; |
||
121 | 5793 | fjp | MyRecord rec = new MyRecord();
|
122 | rec.layerName = lyr.getName(); |
||
123 | 5813 | fjp | rec.bSelec = new Boolean(aux.isSpatialCacheEnabled()); |
124 | rec.maxFeat = new Integer(aux.getSpatialCache() |
||
125 | .getMaxFeatures()); |
||
126 | records.add(rec); |
||
127 | 5793 | fjp | } |
128 | } |
||
129 | 5813 | fjp | } |
130 | 5793 | fjp | |
131 | public int getColumnCount() { |
||
132 | return 3; |
||
133 | } |
||
134 | |||
135 | public int getRowCount() { |
||
136 | return records.size();
|
||
137 | } |
||
138 | |||
139 | public Object getValueAt(int rowIndex, int columnIndex) { |
||
140 | MyRecord rec = (MyRecord) records.get(rowIndex); |
||
141 | if (columnIndex == 0) |
||
142 | return rec.bSelec;
|
||
143 | if (columnIndex == 1) |
||
144 | return rec.layerName;
|
||
145 | if (columnIndex == 2) |
||
146 | return rec.maxFeat;
|
||
147 | return null; |
||
148 | 5813 | fjp | |
149 | 5793 | fjp | } |
150 | |||
151 | public Class getColumnClass(int c) { |
||
152 | if (c == 0) |
||
153 | return Boolean.class; |
||
154 | if (c == 2) |
||
155 | return Integer.class; |
||
156 | 5813 | fjp | return String.class; |
157 | 5793 | fjp | } |
158 | |||
159 | public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
||
160 | MyRecord rec = (MyRecord) records.get(rowIndex); |
||
161 | if (columnIndex == 0) |
||
162 | rec.bSelec = (Boolean) aValue;
|
||
163 | 5813 | fjp | if (columnIndex == 2) { |
164 | 5793 | fjp | if (aValue != null) |
165 | rec.maxFeat = (Integer) aValue;
|
||
166 | else
|
||
167 | rec.maxFeat = new Integer(0); |
||
168 | } |
||
169 | 8765 | jjdelcerro | changed =true;
|
170 | 5793 | fjp | super.setValueAt(aValue, rowIndex, columnIndex);
|
171 | } |
||
172 | |||
173 | public boolean isCellEditable(int rowIndex, int columnIndex) { |
||
174 | if (columnIndex == 0) |
||
175 | return true; |
||
176 | if (columnIndex == 2) |
||
177 | return true; |
||
178 | |||
179 | return false; |
||
180 | } |
||
181 | |||
182 | public String getColumnName(int column) { |
||
183 | if (column == 0) |
||
184 | return PluginServices.getText(this, "Selected"); |
||
185 | if (column == 1) |
||
186 | return PluginServices.getText(this, "LayerName"); |
||
187 | if (column == 2) |
||
188 | return PluginServices.getText(this, "MaxFeaturesEditionCache"); |
||
189 | return "You shouldn't reach this point"; |
||
190 | |||
191 | } |
||
192 | 5813 | fjp | |
193 | 5793 | fjp | } |
194 | |||
195 | /**
|
||
196 | 5813 | fjp | * This method initializes
|
197 | 6606 | caballero | *
|
198 | 5793 | fjp | */
|
199 | public EditionPreferencePage() {
|
||
200 | super();
|
||
201 | initialize(); |
||
202 | } |
||
203 | |||
204 | 5813 | fjp | /*
|
205 | * private void addLayer(FLayer lyr) { if (lyr instanceof FLayers) { FLayers
|
||
206 | * lyrGroup = (FLayers) lyr; for (int i=0; i < lyrGroup.getLayersCount();
|
||
207 | * i++) { FLayer lyr2 = lyrGroup.getLayer(i); addLayer(lyr2); } } else { if
|
||
208 | * (lyr instanceof FLyrVect) { layers.add(lyr); } } }
|
||
209 | */
|
||
210 | |||
211 | 5793 | fjp | /**
|
212 | * This method initializes this
|
||
213 | 6606 | caballero | *
|
214 | 5793 | fjp | */
|
215 | private void initialize() { |
||
216 | BorderLayout layout = new BorderLayout(); |
||
217 | layout.setHgap(20);
|
||
218 | |||
219 | 5813 | fjp | this.setLayout(layout);
|
220 | |||
221 | jLabelCache = new JLabel(); |
||
222 | jLabelCache |
||
223 | .setText(PluginServices.getText(this, "capas_edition_cache")); |
||
224 | jLabelCache.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); |
||
225 | 8765 | jjdelcerro | jLabelCache.setPreferredSize(new java.awt.Dimension(500,20)); |
226 | 5813 | fjp | jLabelCache.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
227 | jLabel1 = new JLabel(); |
||
228 | jLabel1.setText("pixels");
|
||
229 | jLabel1.setBounds(new java.awt.Rectangle(195, 8, 207, 15)); |
||
230 | jLabel1.setPreferredSize(new java.awt.Dimension(28, 20)); |
||
231 | jLabel1.setName("jLabel1");
|
||
232 | jLabel = new JLabel(); |
||
233 | jLabel.setText("Snap Tolerance:");
|
||
234 | jLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
||
235 | jLabel.setName("jLabel");
|
||
236 | jLabel.setBounds(new java.awt.Rectangle(15, 8, 122, 15)); |
||
237 | jLabel.setPreferredSize(new java.awt.Dimension(28, 20)); |
||
238 | jLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); |
||
239 | |||
240 | 8765 | jjdelcerro | this.setSize(new java.awt.Dimension(502,288)); |
241 | 5813 | fjp | this.setPreferredSize(this.getSize()); |
242 | this.add(getJPanelNord(), BorderLayout.NORTH); |
||
243 | |||
244 | this.add(getJSeparator(), BorderLayout.CENTER); |
||
245 | |||
246 | this.add(getJPanelCache(), BorderLayout.CENTER); |
||
247 | |||
248 | 5793 | fjp | } |
249 | |||
250 | public String getID() { |
||
251 | return this.getClass().getName(); |
||
252 | } |
||
253 | |||
254 | public String getTitle() { |
||
255 | 5813 | fjp | return PluginServices.getText(this, "Edition"); |
256 | 5793 | fjp | } |
257 | |||
258 | public JPanel getPanel() { |
||
259 | return this; |
||
260 | } |
||
261 | |||
262 | 5813 | fjp | /*
|
263 | * (non-Javadoc)
|
||
264 | 6606 | caballero | *
|
265 | 5793 | fjp | * @see com.iver.cit.gvsig.gui.preferences.IPreference#initializeValues()
|
266 | */
|
||
267 | public void initializeValues() { |
||
268 | 5813 | fjp | // /* Vamos a usar esto por ahora as?:
|
269 | // * Al abrir el dialogo, miramos las capas que hay
|
||
270 | // * en edici?n y las capas activas.
|
||
271 | // * Las capas en edici?n nos las guardamos para
|
||
272 | // * fijarles las propiedades, y las que est?n activas
|
||
273 | // * las metemos en la tabla de configuraci?n de
|
||
274 | // * snapping.
|
||
275 | // */
|
||
276 | // FLyrVect firstLyrVect = null;
|
||
277 | // for (int i=0; i<layers.getLayersCount(); i++)
|
||
278 | // {
|
||
279 | // FLayer aux = layers.getLayer(i);
|
||
280 | // if (aux.isActive())
|
||
281 | // if (aux instanceof FLyrVect)
|
||
282 | // {
|
||
283 | // firstLyrVect = (FLyrVect) aux;
|
||
284 | // }
|
||
285 | // }
|
||
286 | 6606 | caballero | //
|
287 | 5813 | fjp | // TableModel tm = getJTableSnapping().getModel();
|
288 | // for (int i=0; i < tm.getRowCount(); i++)
|
||
289 | // {
|
||
290 | // String layerName = (String) tm.getValueAt(i, 1);
|
||
291 | // FLayer layer = layers.getLayer(layerName);
|
||
292 | // FLyrVect lyr = (FLyrVect) layers.getLayer(layerName);
|
||
293 | // Boolean bUseCache = (Boolean) tm.getValueAt(i,0);
|
||
294 | // Integer maxFeat = (Integer) tm.getValueAt(i,2);
|
||
295 | // lyr.setSpatialCacheEnabled(bUseCache.booleanValue());
|
||
296 | // lyr.setMaxFeaturesInEditionCache(maxFeat.intValue());
|
||
297 | // }
|
||
298 | //
|
||
299 | 5793 | fjp | |
300 | } |
||
301 | |||
302 | 6660 | caballero | public void storeValues() throws StoreException { |
303 | 5793 | fjp | TableModel tm = getJTableSnapping().getModel();
|
304 | 5813 | fjp | ArrayList layersToSnap = new ArrayList(); |
305 | for (int i = 0; i < tm.getRowCount(); i++) { |
||
306 | 5793 | fjp | String layerName = (String) tm.getValueAt(i, 1); |
307 | FLyrVect lyr = (FLyrVect) layers.getLayer(layerName); |
||
308 | 5813 | fjp | Boolean bUseCache = (Boolean) tm.getValueAt(i, 0); |
309 | Integer maxFeat = (Integer) tm.getValueAt(i, 2); |
||
310 | |||
311 | // Decidimos si vamos a habilitar el spatialCache DESPUES, justo
|
||
312 | // antes de renderizar.
|
||
313 | // Necesitamos un m?todo que explore las capas en edici?n y mire las
|
||
314 | // capas sobre las
|
||
315 | // que se necestia el cache. Aqu? lo que hacemos es a?adir las
|
||
316 | // seleccionadas a la
|
||
317 | // lista de capas asociadas al snapping de los temas activos en
|
||
318 | // edici?n.
|
||
319 | // Lo del m?ximo de features en cach?, tiene que ser para cada capa
|
||
320 | // distinto. Pero no
|
||
321 | // puedes "chafar" el que ya hay, porque puedes fastidiar a otra
|
||
322 | // capa en edici?n.
|
||
323 | // Como m?ximo, lo que podemos hacer es que si es mayor al que hay,
|
||
324 | // lo subimos. Si
|
||
325 | // se solicita uno menor, lo dejamos como est?.
|
||
326 | // Otra opci?n ser?a no hacer caso de esto para cada capa, y ponerlo
|
||
327 | // de forma global.
|
||
328 | // lyr.setSpatialCacheEnabled(bUseCache.booleanValue());
|
||
329 | 5793 | fjp | lyr.setMaxFeaturesInEditionCache(maxFeat.intValue()); |
330 | 5813 | fjp | if (bUseCache.booleanValue())
|
331 | layersToSnap.add(lyr); |
||
332 | 5793 | fjp | } |
333 | 5813 | fjp | SingleLayerIterator it = new SingleLayerIterator(layers);
|
334 | EditionManager edManager = CADExtension.getEditionManager(); |
||
335 | 5793 | fjp | |
336 | 5813 | fjp | while (it.hasNext()) {
|
337 | FLayer aux = it.next(); |
||
338 | if (aux instanceof FLyrVect) |
||
339 | { |
||
340 | FLyrVect lyrVect = (FLyrVect) aux; |
||
341 | // Inicializamos todas
|
||
342 | lyrVect.setSpatialCacheEnabled(false);
|
||
343 | if (aux.isActive())
|
||
344 | if (aux.isEditing()) {
|
||
345 | // Sobre la capa en edici?n siempre se puede hacer snapping
|
||
346 | 6606 | caballero | lyrVect.setSpatialCacheEnabled(true);
|
347 | 5813 | fjp | VectorialLayerEdited lyrEd = (VectorialLayerEdited) edManager |
348 | .getLayerEdited(aux); |
||
349 | lyrEd.setLayersToSnap(layersToSnap); |
||
350 | |||
351 | } |
||
352 | } |
||
353 | } // while
|
||
354 | it.rewind(); |
||
355 | /*
|
||
356 | * Iteramos por las capas en edici?n y marcamos aquellas capas que
|
||
357 | * necesitan trabajar con el cache habilitado
|
||
358 | */
|
||
359 | while (it.hasNext()) {
|
||
360 | FLayer aux = it.next(); |
||
361 | if (aux.isEditing())
|
||
362 | if (aux instanceof FLyrVect) { |
||
363 | VectorialLayerEdited lyrEd = (VectorialLayerEdited) edManager |
||
364 | .getLayerEdited(aux); |
||
365 | for (int i=0; i<lyrEd.getLayersToSnap().size(); i++) |
||
366 | { |
||
367 | FLyrVect lyrVect = (FLyrVect) lyrEd.getLayersToSnap().get(i); |
||
368 | lyrVect.setSpatialCacheEnabled(true);
|
||
369 | } |
||
370 | |||
371 | } |
||
372 | |||
373 | } // while
|
||
374 | 8765 | jjdelcerro | mapContext.redraw(); |
375 | 6660 | caballero | try{
|
376 | SelectionCADTool.tolerance = Integer.parseInt(getJTxtTolerance().getText());
|
||
377 | 6811 | jaume | |
378 | 6660 | caballero | }catch (Exception e) { |
379 | throw new StoreException(PluginServices.getText(this, "tolerancia_incorrecta"),e); |
||
380 | } |
||
381 | 5793 | fjp | } |
382 | |||
383 | 8765 | jjdelcerro | public void initializeDefaults() { |
384 | 7849 | jmvivo | getJTxtTolerance().setText("4");
|
385 | 5793 | fjp | TableModel tm = getJTableSnapping().getModel();
|
386 | 5813 | fjp | for (int i = 0; i < tm.getRowCount(); i++) { |
387 | 5793 | fjp | String layerName = (String) tm.getValueAt(i, 1); |
388 | FLyrVect lyr = (FLyrVect) layers.getLayer(layerName); |
||
389 | 5813 | fjp | Boolean bUseCache = (Boolean) tm.getValueAt(i, 0); |
390 | Integer maxFeat = (Integer) tm.getValueAt(i, 2); |
||
391 | 5793 | fjp | lyr.setSpatialCacheEnabled(bUseCache.booleanValue()); |
392 | lyr.setMaxFeaturesInEditionCache(maxFeat.intValue()); |
||
393 | } |
||
394 | 5813 | fjp | |
395 | 5793 | fjp | } |
396 | |||
397 | public ImageIcon getIcon() { |
||
398 | return null; |
||
399 | } |
||
400 | 5813 | fjp | |
401 | 8765 | jjdelcerro | public void setMapContext(MapContext mc) { |
402 | 5813 | fjp | // addLayer(layers);
|
403 | 8765 | jjdelcerro | this.mapContext = mc;
|
404 | this.layers = mc.getLayers();
|
||
405 | 5793 | fjp | MyTableModel tm = new MyTableModel(layers);
|
406 | getJTableSnapping().setModel(tm); |
||
407 | 5817 | fjp | getJTxtTolerance().setText(String.valueOf(SelectionCADTool.tolerance));
|
408 | 5793 | fjp | } |
409 | |||
410 | /**
|
||
411 | 5813 | fjp | * This method initializes jTxtTolerance
|
412 | 6606 | caballero | *
|
413 | 5813 | fjp | * @return javax.swing.JTextField
|
414 | 5793 | fjp | */
|
415 | private JTextField getJTxtTolerance() { |
||
416 | if (jTxtTolerance == null) { |
||
417 | jTxtTolerance = new JTextField(); |
||
418 | 5813 | fjp | jTxtTolerance.setPreferredSize(new java.awt.Dimension(28, 20)); |
419 | 5793 | fjp | jTxtTolerance.setName("jTxtTolerance");
|
420 | 5817 | fjp | jTxtTolerance.setHorizontalAlignment(javax.swing.JTextField.RIGHT); |
421 | jTxtTolerance.setText("4");
|
||
422 | 5813 | fjp | jTxtTolerance.setBounds(new java.awt.Rectangle(142, 8, 39, 15)); |
423 | 6805 | jaume | jTxtTolerance.addKeyListener(new KeyListener() { |
424 | public void keyPressed(KeyEvent e) { changed = true; } |
||
425 | public void keyReleased(KeyEvent e) { changed = true; } |
||
426 | public void keyTyped(KeyEvent e){ changed = true; } |
||
427 | }); |
||
428 | 5793 | fjp | } |
429 | return jTxtTolerance;
|
||
430 | } |
||
431 | |||
432 | /**
|
||
433 | 5813 | fjp | * This method initializes jSeparator
|
434 | 6606 | caballero | *
|
435 | 5813 | fjp | * @return javax.swing.JSeparator
|
436 | 5793 | fjp | */
|
437 | private JSeparator getJSeparator() { |
||
438 | if (jSeparator == null) { |
||
439 | jSeparator = new JSeparator(); |
||
440 | 5817 | fjp | jSeparator.setPreferredSize(new java.awt.Dimension(200,2)); |
441 | 5793 | fjp | } |
442 | return jSeparator;
|
||
443 | } |
||
444 | |||
445 | /**
|
||
446 | 5813 | fjp | * This method initializes jScrollPane
|
447 | 6606 | caballero | *
|
448 | 5813 | fjp | * @return javax.swing.JScrollPane
|
449 | 5793 | fjp | */
|
450 | private JScrollPane getJScrollPane() { |
||
451 | if (jScrollPane == null) { |
||
452 | jScrollPane = new JScrollPane(); |
||
453 | 8765 | jjdelcerro | jScrollPane.setPreferredSize(new java.awt.Dimension(500,419)); |
454 | 5793 | fjp | jScrollPane.setViewportView(getJTableSnapping()); |
455 | } |
||
456 | return jScrollPane;
|
||
457 | } |
||
458 | |||
459 | /**
|
||
460 | 5813 | fjp | * This method initializes jTableSnapping
|
461 | 6606 | caballero | *
|
462 | 5813 | fjp | * @return javax.swing.JTable
|
463 | 5793 | fjp | */
|
464 | private JTable getJTableSnapping() { |
||
465 | if (jTableSnapping == null) { |
||
466 | jTableSnapping = new JTable(); |
||
467 | 5813 | fjp | // TableColumnModel cm = new DefaultTableColumnModel();
|
468 | // TableColumn checkCol = new TableColumn(0, 50);
|
||
469 | // cm.addColumn(checkCol);
|
||
470 | 6606 | caballero | //
|
471 | 5813 | fjp | // TableColumn layerCol = new TableColumn(1, 250);
|
472 | // cm.addColumn(layerCol);
|
||
473 | 6606 | caballero | //
|
474 | 5813 | fjp | // TableColumn maxFeatCol = new TableColumn(2, 50);
|
475 | // cm.addColumn(maxFeatCol);
|
||
476 | //
|
||
477 | // JTableHeader head = new JTableHeader(cm);
|
||
478 | // head.setVisible(true);
|
||
479 | 6606 | caballero | //
|
480 | //
|
||
481 | 5813 | fjp | // TableModel tm = new DefaultTableModel(4,3);
|
482 | // jTableSnapping.setModel(tm);
|
||
483 | // jTableSnapping.setTableHeader(head);
|
||
484 | 6805 | jaume | jTableSnapping.addKeyListener(new KeyListener() { |
485 | public void keyPressed(KeyEvent e) { changed = true; } |
||
486 | public void keyReleased(KeyEvent e) { changed = true; } |
||
487 | public void keyTyped(KeyEvent e){ changed = true; } |
||
488 | }); |
||
489 | 5793 | fjp | } |
490 | return jTableSnapping;
|
||
491 | } |
||
492 | |||
493 | /**
|
||
494 | 5813 | fjp | * This method initializes jPanelNord
|
495 | 6606 | caballero | *
|
496 | 5813 | fjp | * @return javax.swing.JPanel
|
497 | 5793 | fjp | */
|
498 | private JPanel getJPanelNord() { |
||
499 | if (jPanelNord == null) { |
||
500 | jPanelNord = new JPanel(); |
||
501 | jPanelNord.setLayout(null);
|
||
502 | 5813 | fjp | jPanelNord |
503 | .setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN); |
||
504 | jPanelNord.setPreferredSize(new java.awt.Dimension(30, 30)); |
||
505 | 5793 | fjp | jPanelNord.add(jLabel, null);
|
506 | jPanelNord.add(getJTxtTolerance(), null);
|
||
507 | jPanelNord.add(jLabel1, null);
|
||
508 | |||
509 | } |
||
510 | return jPanelNord;
|
||
511 | } |
||
512 | |||
513 | /**
|
||
514 | 5813 | fjp | * This method initializes jPanelCache
|
515 | 6606 | caballero | *
|
516 | 5813 | fjp | * @return javax.swing.JPanel
|
517 | 5793 | fjp | */
|
518 | private JPanel getJPanelCache() { |
||
519 | if (jPanelCache == null) { |
||
520 | jPanelCache = new JPanel(); |
||
521 | 8765 | jjdelcerro | jPanelCache.setLayout(new BorderLayout()); |
522 | jPanelCache.add(jLabelCache, java.awt.BorderLayout.NORTH); |
||
523 | jPanelCache.add(getJScrollPane(), java.awt.BorderLayout.EAST); |
||
524 | 5793 | fjp | } |
525 | return jPanelCache;
|
||
526 | } |
||
527 | |||
528 | 6805 | jaume | public boolean isValueChanged() { |
529 | return changed;
|
||
530 | 6606 | caballero | } |
531 | |||
532 | 6811 | jaume | public void setChangesApplied() { |
533 | changed = false;
|
||
534 | } |
||
535 | |||
536 | 8765 | jjdelcerro | } // @jve:decl-index=0:visual-constraint="14,10"
|