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