root / tags / v1_1_Build_1006 / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / pointsTable / TablePointsPanel.java @ 12458
History | View | Annotate | Download (20.5 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 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 |
package org.gvsig.georeferencing.gui.pointsTable; |
20 |
|
21 |
import java.awt.BorderLayout; |
22 |
import java.awt.Component; |
23 |
import java.awt.Dimension; |
24 |
import java.awt.FlowLayout; |
25 |
import java.awt.GridBagConstraints; |
26 |
import java.awt.GridBagLayout; |
27 |
import java.awt.GridLayout; |
28 |
import java.awt.event.ActionEvent; |
29 |
import java.awt.event.ActionListener; |
30 |
import java.awt.event.MouseAdapter; |
31 |
import java.awt.event.MouseEvent; |
32 |
|
33 |
import javax.swing.AbstractCellEditor; |
34 |
import javax.swing.JCheckBox; |
35 |
import javax.swing.JOptionPane; |
36 |
import javax.swing.JPanel; |
37 |
import javax.swing.JScrollPane; |
38 |
import javax.swing.JTable; |
39 |
import javax.swing.SwingConstants; |
40 |
import javax.swing.SwingUtilities; |
41 |
import javax.swing.table.DefaultTableModel; |
42 |
import javax.swing.table.TableCellEditor; |
43 |
import javax.swing.table.TableCellRenderer; |
44 |
import javax.swing.table.TableColumn; |
45 |
|
46 |
import org.gvsig.georeferencing.gui.dialog.GeoreferencingDialog; |
47 |
|
48 |
import com.iver.andami.PluginServices; |
49 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints; |
50 |
|
51 |
/**
|
52 |
* Panel que contiene la tabla de puntos con sus controles.
|
53 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
54 |
*/
|
55 |
public class TablePointsPanel extends JPanel implements ActionListener{ |
56 |
|
57 |
//**********************Vars**********************************
|
58 |
private GeoreferencingDialog parent = null; |
59 |
private JPanel pTable = null; |
60 |
private JPanel pPointSelection = null; |
61 |
private TableControlerPanel tableControlerPanel = null; |
62 |
private int widthGeneralPanel = 390, heightGeneralPanel = 175; |
63 |
private int widthSupPanel = 375, heightSupPanel = 137; |
64 |
private int widthInfPanel = 375, heightInfPanel = 27; |
65 |
private int widthTable = 375, heightTable = 110; |
66 |
private FLyrPoints lyrPoints = null; |
67 |
private int lastIndexSelection = -1; |
68 |
private boolean disableEvent = false; |
69 |
final static String[] columnNames = {"", "N?", "X", "Y", |
70 |
"X'", "Y'", "Error X", |
71 |
"Error Y", "RMS"}; |
72 |
private PointTable table = null; |
73 |
private TablePanelButtons pTablePanelButtons = null; |
74 |
/**
|
75 |
* Estado de los botones cuando se ejecuta disableAllControls
|
76 |
*/
|
77 |
private boolean[] buttonsState = new boolean[3]; |
78 |
/**
|
79 |
* DisableAllControls ha sido ejecutada si est? a true esta variabled
|
80 |
*/
|
81 |
private boolean disableAllControls = false; |
82 |
//**********************End Vars******************************
|
83 |
|
84 |
//**********************Classes*******************************
|
85 |
/**
|
86 |
* Clase que representa la tabla de puntos
|
87 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
88 |
*/
|
89 |
public class PointTable extends JPanel { |
90 |
|
91 |
private JTable table = null; |
92 |
private JScrollPane scrollPane = null; |
93 |
|
94 |
private TableModelPoint tabModel = null; |
95 |
|
96 |
public TableModelPoint getTableModel(){
|
97 |
return tabModel;
|
98 |
} |
99 |
|
100 |
public PointTable() {
|
101 |
super(new GridLayout(1,0)); |
102 |
|
103 |
tabModel = new TableModelPoint();
|
104 |
table = new JTable(tabModel); |
105 |
table.setPreferredScrollableViewportSize(new Dimension(500, 70)); |
106 |
|
107 |
|
108 |
table.addMouseListener(new MouseAdapter() { |
109 |
public void mouseClicked(MouseEvent e) { |
110 |
//Al seleccionar una fila de la tabla se cambia al punto correspondiente.
|
111 |
tableControlerPanel.setSelectedIndex(table.getSelectedRow()); |
112 |
parent.getPointManager().selectPoint(table.getSelectedRow(), parent); |
113 |
tableControlerPanel.checkArrows(); |
114 |
|
115 |
//Si hemos pinchado el checkBox cambiamos el valor de este y ponemos activo/desactivo el punto
|
116 |
if(table.getSelectedColumn() == 0){ |
117 |
boolean value = (((Boolean)tabModel.getValueAt(table.getSelectedRow(), 0)).booleanValue()); |
118 |
//tabModel.setValueAt(new Boolean(!value), table.getSelectedRow(), 0);
|
119 |
try{
|
120 |
parent.deactivatePanel((com.iver.cit.gvsig.project.documents.view.gui.View)PluginServices.getMDIManager().getActiveWindow(), new JCheckBox("", !value)); |
121 |
}catch(ClassCastException exc){ |
122 |
//Si no podemos obtener la vista dejamos el control como estaba
|
123 |
tabModel.setValueAt(new Boolean(value), table.getSelectedRow(), 0); |
124 |
return;
|
125 |
}catch(Exception exc){ |
126 |
//Si no podemos obtener la vista dejamos el control como estaba
|
127 |
tabModel.setValueAt(new Boolean(value), table.getSelectedRow(), 0); |
128 |
return;
|
129 |
} |
130 |
} |
131 |
|
132 |
} |
133 |
}); |
134 |
|
135 |
scrollPane = new JScrollPane(table); |
136 |
|
137 |
TableColumn column = null; |
138 |
for (int i = 0; i < table.getModel().getColumnCount(); i++) { |
139 |
column = table.getColumnModel().getColumn(i); |
140 |
if(i == 0){ |
141 |
column.setCellRenderer(new CheckColumnRenderer());
|
142 |
column.setCellEditor(new CheckColumnEditor());
|
143 |
column.setMaxWidth(19);
|
144 |
column.setMinWidth(19);
|
145 |
} |
146 |
if(i == 1){ |
147 |
column.setMaxWidth(25);
|
148 |
column.setMinWidth(25);
|
149 |
} |
150 |
if((i == 2) || (i == 3)){ |
151 |
column.setMinWidth(50);
|
152 |
column.setMaxWidth(140);
|
153 |
} |
154 |
if((i == 4) || (i == 5)){ |
155 |
column.setMinWidth(80);
|
156 |
column.setMaxWidth(190);
|
157 |
} |
158 |
} |
159 |
|
160 |
add(scrollPane); |
161 |
} |
162 |
|
163 |
/**
|
164 |
* TableModel del JTable que contiene los puntos con sus errores
|
165 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
166 |
*/
|
167 |
public class TableModelPoint extends DefaultTableModel { |
168 |
|
169 |
public TableModelPoint(){
|
170 |
super(new Object[0][9], columnNames); |
171 |
} |
172 |
|
173 |
public int getColumnCount() { |
174 |
return columnNames.length;
|
175 |
} |
176 |
|
177 |
public String getColumnName(int col) { |
178 |
return columnNames[col];
|
179 |
} |
180 |
|
181 |
public Class getColumnClass(int c) { |
182 |
if (c == 0) |
183 |
return Boolean.class; |
184 |
return String.class; |
185 |
} |
186 |
|
187 |
public void addNew() { |
188 |
super.addRow(new Object[] {new Boolean(true), "", "", "", "", "", "", "", ""}); |
189 |
} |
190 |
|
191 |
public void setValueAt(Object value, int row, int col) { |
192 |
super.setValueAt(value, row, col);
|
193 |
} |
194 |
|
195 |
/**
|
196 |
* Devuelve true si la celda es editable. Solo son editables
|
197 |
* las celdas de los puntos.
|
198 |
*/
|
199 |
public boolean isCellEditable(int row, int col){ |
200 |
return false; |
201 |
} |
202 |
} |
203 |
|
204 |
class CheckColumnRenderer extends JCheckBox implements TableCellRenderer { |
205 |
final private static long serialVersionUID = -3370601314380922368L; |
206 |
|
207 |
public Component getTableCellRendererComponent(JTable table, |
208 |
Object value,
|
209 |
boolean isSelected,
|
210 |
boolean hasFocus,
|
211 |
int row, int column) { |
212 |
if (value == null) { |
213 |
this.setSelected(false); |
214 |
} |
215 |
|
216 |
Boolean ValueAsBoolean = (Boolean) value; |
217 |
this.setSelected(ValueAsBoolean.booleanValue());
|
218 |
this.setHorizontalAlignment(SwingConstants.CENTER); |
219 |
|
220 |
return this; |
221 |
} |
222 |
} |
223 |
|
224 |
class CheckColumnEditor extends AbstractCellEditor implements TableCellEditor { |
225 |
final private static long serialVersionUID = -3370601314380922368L; |
226 |
public JCheckBox checkBox; |
227 |
|
228 |
public CheckColumnEditor() {
|
229 |
super();
|
230 |
checkBox = new JCheckBox(); |
231 |
checkBox.addActionListener(new ActionListener() { |
232 |
public void actionPerformed(ActionEvent event) { |
233 |
//checkBox.setSelected(!checkBox.isSelected());
|
234 |
fireEditingStopped(); |
235 |
} |
236 |
}); |
237 |
} |
238 |
|
239 |
public Component getTableCellEditorComponent(JTable table, Object obj, |
240 |
boolean isSelected,
|
241 |
int row, int col) { |
242 |
checkBox.setHorizontalAlignment(SwingUtilities.CENTER);
|
243 |
|
244 |
Boolean lValueAsBoolean = (Boolean) obj; |
245 |
checkBox.setSelected(lValueAsBoolean.booleanValue()); |
246 |
|
247 |
return checkBox;
|
248 |
} |
249 |
|
250 |
public Object getCellEditorValue() { |
251 |
return new Boolean(checkBox.isSelected()); |
252 |
} |
253 |
} |
254 |
|
255 |
/**
|
256 |
* @return Returns the table.
|
257 |
*/
|
258 |
public JTable getTable() { |
259 |
return table;
|
260 |
} |
261 |
} |
262 |
//**********************End Classes*****************************
|
263 |
|
264 |
//**********************Methods*********************************
|
265 |
/**
|
266 |
* This is the default constructor
|
267 |
*/
|
268 |
public TablePointsPanel(GeoreferencingDialog p) {
|
269 |
super();
|
270 |
this.parent = p;
|
271 |
initialize(); |
272 |
} |
273 |
|
274 |
/**
|
275 |
* This method initializes this
|
276 |
*
|
277 |
* @return void
|
278 |
*/
|
279 |
private void initialize() { |
280 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
281 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
282 |
this.setLayout(new GridBagLayout()); |
283 |
this.setPreferredSize(new java.awt.Dimension(390,175)); |
284 |
this.setSize(new java.awt.Dimension(390,175)); |
285 |
this.setLocation(new java.awt.Point(0,0)); |
286 |
gridBagConstraints1.gridx = 0;
|
287 |
gridBagConstraints1.gridy = 0;
|
288 |
gridBagConstraints1.insets = new java.awt.Insets(0,0,0,0); |
289 |
gridBagConstraints5.gridx = 0;
|
290 |
gridBagConstraints5.gridy = 1;
|
291 |
gridBagConstraints5.insets = new java.awt.Insets(2,0,0,0); |
292 |
this.add(getPTable(), gridBagConstraints1);
|
293 |
this.add(getPPointSelection(), gridBagConstraints5);
|
294 |
} |
295 |
|
296 |
/**
|
297 |
* Actualiza el n?mero de puntos del combo a partir de los contenidos en
|
298 |
* la capa de puntos. Esta funci?n es usada desde otros paneles que cambien
|
299 |
* el punto seleccionado para comunicar a la tabla la nueva selecci?n.
|
300 |
*/
|
301 |
public void updateComboPoint(int pointSelected){ |
302 |
try{
|
303 |
loadLyrPoint(); |
304 |
}catch(InstantiationException exc){ |
305 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
306 |
PluginServices.getText(this, "error_capa_puntos")); |
307 |
return;
|
308 |
} |
309 |
|
310 |
disableEvent = true;
|
311 |
tableControlerPanel.setNItems(lyrPoints.getCountPoints()); |
312 |
try{
|
313 |
tableControlerPanel.getCPoint().setSelectedIndex(pointSelected); |
314 |
}catch(IllegalArgumentException ex){ |
315 |
|
316 |
} |
317 |
getJTable().getTable().setRowSelectionInterval(pointSelected, pointSelected); |
318 |
tableControlerPanel.checkArrows(); |
319 |
disableEvent = false;
|
320 |
} |
321 |
|
322 |
/**
|
323 |
* Obtiene una capa de puntos. Si no existe crea una.
|
324 |
* @return
|
325 |
*/
|
326 |
private void loadLyrPoint() throws InstantiationException{ |
327 |
|
328 |
if(lyrPoints == null){ |
329 |
if(lyrPoints == null){ |
330 |
lyrPoints = this.parent.getLyrPoints();
|
331 |
if(lyrPoints == null) |
332 |
throw new InstantiationException(); |
333 |
} |
334 |
} |
335 |
|
336 |
} |
337 |
|
338 |
/**
|
339 |
* Comprueba si los valores de un punto en los campos de la tabla est?n
|
340 |
* vacios y lanza una excepci?n si hay alguno sin informaci?n.
|
341 |
* @throws NoSuchFieldException
|
342 |
*/
|
343 |
private void checkInfoPointText(int nPunto)throws NoSuchFieldException{ |
344 |
try{
|
345 |
if( getJTable().getTable().getValueAt(nPunto, 1).toString().equals("") || |
346 |
getJTable().getTable().getValueAt(nPunto, 2).toString().equals("") || |
347 |
getJTable().getTable().getValueAt(nPunto, 3).toString().equals("") || |
348 |
getJTable().getTable().getValueAt(nPunto, 4).toString().equals("") || |
349 |
getJTable().getTable().getValueAt(nPunto, 5).toString().equals("") ){ |
350 |
disableEvent = true;
|
351 |
tableControlerPanel.setSelectedIndex(lastIndexSelection); |
352 |
disableEvent = false;
|
353 |
throw new NoSuchFieldException(); |
354 |
} |
355 |
}catch(ArrayIndexOutOfBoundsException ex){ |
356 |
//Si el acceso al elemento de la tabla da error no hacemos nada
|
357 |
} |
358 |
} |
359 |
/**
|
360 |
* Cuando pasamos de un punto a otro
|
361 |
* <UL>
|
362 |
* <LI>Cargamos la capa de puntos si no est? cargada todavia</LI>
|
363 |
* <LI>Comprobamos que el punto desde el que partimos no tenga campos inicio o fin vacios</LI>
|
364 |
* <LI>Seleccionamos en el combo en nuevo punto</LI>
|
365 |
* <LI>Cargamos la informaci?n del nuevo punto en los JTextField, mini imagen y seleccionamos la fila de la tabla</LI>
|
366 |
* <LI>Chequeamos la flechas para activar o desactivar las que toquen.</LI>
|
367 |
* </UL>
|
368 |
* @param changeSelection Cambia la posici?n seleccionada del combo si es true
|
369 |
* @param pos Posici?n a la que cambia el combo si el parametro chageSelection es true
|
370 |
*/
|
371 |
private void changePoint(boolean changeSelection, int pos){ |
372 |
disableEvent = true;
|
373 |
try{
|
374 |
loadLyrPoint(); |
375 |
checkInfoPointText(pos); |
376 |
if(changeSelection){
|
377 |
lastIndexSelection = pos; |
378 |
tableControlerPanel.setSelectedIndex(pos); |
379 |
} |
380 |
lyrPoints.getPointManager().selectPoint(tableControlerPanel.getSelectedIndex(), parent); |
381 |
tableControlerPanel.checkArrows(); |
382 |
}catch(NoSuchFieldException exc){ |
383 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
384 |
PluginServices.getText(this, "coordenadas_vacias")); |
385 |
}catch(InstantiationException exc){ |
386 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
387 |
PluginServices.getText(this, "error_capa_puntos")); |
388 |
} |
389 |
disableEvent = false;
|
390 |
} |
391 |
|
392 |
/* (non-Javadoc)
|
393 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
394 |
*/
|
395 |
public void actionPerformed(ActionEvent e) { |
396 |
//Bot?n de ir al punto inicial
|
397 |
if(e.getSource() == tableControlerPanel.getBFirst()){
|
398 |
if(tableControlerPanel.getItemCount() >= 1) |
399 |
changePoint(true, 0); |
400 |
} |
401 |
|
402 |
//Bot?n de ir al punto anterior
|
403 |
if(e.getSource() == tableControlerPanel.getBPrev()){
|
404 |
if(tableControlerPanel.getSelectedIndex() != 0) |
405 |
changePoint(true, tableControlerPanel.getSelectedIndex() - 1); |
406 |
} |
407 |
|
408 |
//Bot?n de ir al punto siguiente
|
409 |
if(e.getSource() == tableControlerPanel.getBNext()){
|
410 |
if(tableControlerPanel.getSelectedIndex() != (tableControlerPanel.getItemCount() - 1)) |
411 |
changePoint(true, tableControlerPanel.getSelectedIndex() + 1); |
412 |
|
413 |
} |
414 |
|
415 |
//Bot?n de ir al punto final
|
416 |
if(e.getSource() == tableControlerPanel.getBLast()){
|
417 |
if(tableControlerPanel.getItemCount() >= 1) |
418 |
changePoint(true, tableControlerPanel.getItemCount() - 1); |
419 |
} |
420 |
|
421 |
//Combo de selecci?n de punto
|
422 |
if(e.getSource() == tableControlerPanel.getCPoint()){
|
423 |
if(tableControlerPanel.getSelectedIndex() != -1){ |
424 |
if(!disableEvent){
|
425 |
changePoint(true,tableControlerPanel.getSelectedIndex());
|
426 |
} |
427 |
} |
428 |
} |
429 |
|
430 |
} |
431 |
|
432 |
/**
|
433 |
* Esta funci?n deshabilita todos los controles y guarda sus valores
|
434 |
* de habilitado o deshabilitado para que cuando se ejecute restoreControlsValue
|
435 |
* se vuelvan a quedar como estaba
|
436 |
*/
|
437 |
public void disableAllControls(){ |
438 |
if(!disableAllControls){
|
439 |
disableAllControls = true;
|
440 |
|
441 |
//Salvamos los estados
|
442 |
buttonsState[0] = getPTablePanelButtons().getBSave().isEnabled();
|
443 |
buttonsState[1] = getPTablePanelButtons().getBLoad().isEnabled();
|
444 |
buttonsState[2] = getPTablePanelButtons().getBExportToAscii().isEnabled();
|
445 |
|
446 |
//Desactivamos controles
|
447 |
getPTablePanelButtons().getBSave().setEnabled(false);
|
448 |
getPTablePanelButtons().getBLoad().setEnabled(false);
|
449 |
getPTablePanelButtons().getBExportToAscii().setEnabled(false);
|
450 |
} |
451 |
} |
452 |
|
453 |
/**
|
454 |
* Esta funci?n deja los controles como estaban al ejecutar la funci?n
|
455 |
* disableAllControls
|
456 |
*/
|
457 |
public void restoreControlsValue(){ |
458 |
if(disableAllControls){
|
459 |
disableAllControls = false;
|
460 |
getPTablePanelButtons().getBSave().setEnabled(buttonsState[0]);
|
461 |
getPTablePanelButtons().getBLoad().setEnabled(buttonsState[1]);
|
462 |
getPTablePanelButtons().getBExportToAscii().setEnabled(buttonsState[2]);
|
463 |
} |
464 |
} |
465 |
//**********************End Methods*****************************
|
466 |
|
467 |
//**********************Setters & Getters***********************
|
468 |
/**
|
469 |
* This method initializes jPanel
|
470 |
*
|
471 |
* @return javax.swing.JPanel
|
472 |
*/
|
473 |
public JPanel getPTable() { |
474 |
if (pTable == null) { |
475 |
BorderLayout borderLayout4 = new BorderLayout(); |
476 |
pTable = new JPanel(); |
477 |
pTable.setLayout(borderLayout4); |
478 |
pTable.setSize(new java.awt.Dimension(widthSupPanel,heightSupPanel));
|
479 |
pTable.setPreferredSize(new java.awt.Dimension(375,137)); |
480 |
pTable.add(getJTable(), BorderLayout.CENTER);
|
481 |
} |
482 |
return pTable;
|
483 |
} |
484 |
|
485 |
/**
|
486 |
* This method initializes jPanel1
|
487 |
*
|
488 |
* @return javax.swing.JPanel
|
489 |
*/
|
490 |
public JPanel getPPointSelection() { |
491 |
if (pPointSelection == null) { |
492 |
pPointSelection = new JPanel(); |
493 |
pPointSelection.setPreferredSize(new java.awt.Dimension(375,27)); |
494 |
if(this.tableControlerPanel == null){ |
495 |
FlowLayout flowLayout6 = new FlowLayout(); |
496 |
pPointSelection.setLayout(flowLayout6); |
497 |
tableControlerPanel = new TableControlerPanel();
|
498 |
flowLayout6.setAlignment(java.awt.FlowLayout.LEFT); |
499 |
flowLayout6.setHgap(0);
|
500 |
flowLayout6.setVgap(1);
|
501 |
pPointSelection.add(tableControlerPanel, null);
|
502 |
pPointSelection.add(getPTablePanelButtons(), null);
|
503 |
pPointSelection.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED)); |
504 |
tableControlerPanel.getBFirst().addActionListener(this);
|
505 |
tableControlerPanel.getBLast().addActionListener(this);
|
506 |
tableControlerPanel.getBNext().addActionListener(this);
|
507 |
tableControlerPanel.getBPrev().addActionListener(this);
|
508 |
tableControlerPanel.getCPoint().addActionListener(this);
|
509 |
} |
510 |
} |
511 |
return pPointSelection;
|
512 |
} |
513 |
|
514 |
/**
|
515 |
* This method initializes jTable
|
516 |
*
|
517 |
* @return javax.swing.JTable
|
518 |
*/
|
519 |
public PointTable getJTable() {
|
520 |
if (table == null) { |
521 |
table = new PointTable();
|
522 |
table.setSize(new java.awt.Dimension(widthTable, heightTable));
|
523 |
table.setPreferredSize(new java.awt.Dimension(widthTable, heightTable));
|
524 |
} |
525 |
return table;
|
526 |
} |
527 |
|
528 |
/**
|
529 |
* Elimina todas las filas de la tabla.
|
530 |
*/
|
531 |
public void clearTable(){ |
532 |
int l = table.getTable().getRowCount();
|
533 |
this.setSaveToDisk(false); |
534 |
for(int i=0;i<l;i++) |
535 |
((DefaultTableModel)table.getTable().getModel()).removeRow(0); |
536 |
} |
537 |
|
538 |
/**
|
539 |
* @return Returns the tableControlerPanel.
|
540 |
*/
|
541 |
public TableControlerPanel getTableControlerPanel() {
|
542 |
return tableControlerPanel;
|
543 |
} |
544 |
|
545 |
/**
|
546 |
* Asigna una tabla
|
547 |
* @param table
|
548 |
*/
|
549 |
public void setTable(PointTable table){ |
550 |
this.table = table;
|
551 |
table.setSize(new java.awt.Dimension(widthTable, heightTable));
|
552 |
table.setPreferredSize(new java.awt.Dimension(widthTable, heightTable));
|
553 |
} |
554 |
|
555 |
/**
|
556 |
* Calculo del nuevo tama?o a partir de un frame redimensionado
|
557 |
* @param w Ancho del frame
|
558 |
* @param h Alto del frame
|
559 |
*/
|
560 |
public void newFrameSize(int w, int h){ |
561 |
int newWidth = w;
|
562 |
double coef = 0.95; |
563 |
|
564 |
this.setSize(new java.awt.Dimension(newWidth, heightGeneralPanel)); |
565 |
this.setPreferredSize(new java.awt.Dimension(newWidth, heightGeneralPanel)); |
566 |
|
567 |
getPTable().setSize(new java.awt.Dimension((int)(coef * newWidth),heightSupPanel)); |
568 |
getPTable().setPreferredSize(new java.awt.Dimension((int)(coef * newWidth),heightSupPanel)); |
569 |
|
570 |
getJTable().setSize(new java.awt.Dimension((int)(coef * newWidth), heightTable)); |
571 |
getJTable().setPreferredSize(new java.awt.Dimension((int)(coef * newWidth), heightTable)); |
572 |
|
573 |
getPPointSelection().setSize(new java.awt.Dimension((int)(coef * newWidth), heightInfPanel)); |
574 |
} |
575 |
|
576 |
/**
|
577 |
* This method initializes jPanel
|
578 |
*
|
579 |
* @return javax.swing.JPanel
|
580 |
*/
|
581 |
public TablePanelButtons getPTablePanelButtons() {
|
582 |
if (pTablePanelButtons == null) { |
583 |
pTablePanelButtons = new TablePanelButtons();
|
584 |
} |
585 |
return pTablePanelButtons;
|
586 |
} |
587 |
|
588 |
/**
|
589 |
* Activa o desactiva los botones de exportar capa de puntos y salvar
|
590 |
* la tabla a Ascii.
|
591 |
*@param isPossible Si vale true activa los controles de salvar y exportaci?n
|
592 |
*y si vale false los desactiva
|
593 |
*/
|
594 |
public void setSaveToDisk(boolean isPossible){ |
595 |
this.getPTablePanelButtons().setSaveToDisk(isPossible);
|
596 |
} |
597 |
//**********************End Setters & Getters*******************
|
598 |
} |