Revision 38050
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/gui/ProjectWindow.java | ||
---|---|---|
75 | 75 |
import com.iver.cit.gvsig.project.documents.ProjectDocument; |
76 | 76 |
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory; |
77 | 77 |
import com.iver.cit.gvsig.project.documents.contextMenu.gui.DocumentContextMenu; |
78 |
import com.iver.cit.gvsig.project.documents.view.ProjectViewBase; |
|
78 | 79 |
import com.iver.utiles.DefaultListModel; |
79 | 80 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
80 | 81 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
... | ... | |
82 | 83 |
|
83 | 84 |
|
84 | 85 |
/** |
85 |
* Clase principal del proyecto donde se puede operar para crear |
|
86 |
* cualquier tipo de documento. |
|
87 |
* |
|
86 |
* Main class of the project where any kind of document can be created |
|
87 |
* |
|
88 | 88 |
* @author Vicente Caballero Navarro |
89 | 89 |
*/ |
90 | 90 |
public class ProjectWindow extends JPanel implements PropertyChangeListener, |
91 | 91 |
IWindow, SingletonWindow { |
92 |
|
|
93 |
private static final long serialVersionUID = -1991932402182134580L; |
|
92 | 94 |
private JPanel jPanel = null; |
93 | 95 |
private JRadioButton[] btnsDocuments = null; |
94 | 96 |
private ButtonGroup grupo = new ButtonGroup(); |
... | ... | |
110 | 112 |
private JButton btnImportar = null; |
111 | 113 |
private JButton btnExportar = null; |
112 | 114 |
private JButton btnEditar = null; |
113 |
// The properties of the Project Manager window (size, position, etc): |
|
114 | 115 |
private WindowInfo m_viewInfo=null; |
115 | 116 |
|
116 |
/** Proyecto representado en la vista */
|
|
117 |
/** Project represented in the view */
|
|
117 | 118 |
private Project p; |
118 | 119 |
|
119 | 120 |
private JScrollPane jScrollPane = null; |
120 | 121 |
private JPanel jPanel4 = null; |
121 | 122 |
private JScrollPane jScrollPane1 = null; |
122 | 123 |
|
123 |
/** |
|
124 |
* This is the default constructor |
|
125 |
* |
|
126 |
* @param project Extension |
|
127 |
*/ |
|
128 | 124 |
public ProjectWindow() { |
129 | 125 |
super(); |
130 | 126 |
initialize(); |
... | ... | |
132 | 128 |
Help.getHelp().enableHelp(this, "Manual-usuario-gvSIG-1.10-Proyectos-de-gvSIG-Introduci?n"); |
133 | 129 |
} |
134 | 130 |
|
135 |
/** |
|
136 |
* Asigna el proyecto a la ventana |
|
137 |
* |
|
138 |
* @param p Proyecto con el que se operar? a trav?s de este di?logo |
|
139 |
*/ |
|
131 |
/** |
|
132 |
* Assign the project to the window |
|
133 |
* |
|
134 |
* @param p |
|
135 |
* Project which will be handled through this dialog |
|
136 |
*/ |
|
140 | 137 |
public void setProject(Project p) { |
141 | 138 |
this.p = p; |
142 | 139 |
p.addPropertyChangeListener(this); |
143 | 140 |
refreshControls(); |
144 | 141 |
} |
145 | 142 |
|
146 |
/** |
|
147 |
* Activa los botones de la botonera del medio o los desactiva en funci?n |
|
148 |
* de que est? seleccionado o no un elemento de proyecto en la lista del |
|
149 |
* medio |
|
150 |
*/ |
|
151 |
private void activarBotones() { |
|
143 |
/** |
|
144 |
* Enable or disable the buttons based on if is selected or not an element |
|
145 |
* of a project in the list of the center |
|
146 |
*/ |
|
147 |
private void enableButtons() { |
|
152 | 148 |
if (lstDocs.getSelectedIndex() != -1) { |
153 | 149 |
btnAbrir.setEnabled(true); |
154 | 150 |
btnBorrar.setEnabled(true); |
... | ... | |
167 | 163 |
} |
168 | 164 |
} |
169 | 165 |
|
170 |
/** |
|
171 |
* Refresca la lista de elementos de proyecto con vistas, mapas o tablas,
|
|
172 |
* seg?n la opci?n activada
|
|
173 |
*/
|
|
166 |
/**
|
|
167 |
* Refresh the list of elements of a project with views, layouts or tables
|
|
168 |
* based on the active option
|
|
169 |
*/
|
|
174 | 170 |
private void refreshList() { |
175 | 171 |
if (p != null) { |
176 | 172 |
DefaultListModel model=null; |
... | ... | |
183 | 179 |
lstDocs.setModel(model); |
184 | 180 |
((TitledBorder)getJPanel1().getBorder()).setTitle(tituloMarco); |
185 | 181 |
getJPanel1().repaint(1); |
186 |
activarBotones();
|
|
182 |
enableButtons();
|
|
187 | 183 |
} |
188 | 184 |
} |
189 |
/** |
|
190 |
* Devuelve el nombre del tipo de documento |
|
191 |
* activo (el mismo que ProjectDocumentFactory.getRegisterName) |
|
192 |
* |
|
193 |
* |
|
194 |
* @return |
|
195 |
*/ |
|
196 |
|
|
185 |
|
|
186 |
/** |
|
187 |
* Returns the name of the kind of document active. (the same of |
|
188 |
* ProjectDocumentFactory.getRegisterName |
|
189 |
* |
|
190 |
*/ |
|
197 | 191 |
public String getDocumentSelected() { |
198 | 192 |
JRadioButton btnSelected=null; |
199 | 193 |
for (int i=0;i<btnsDocuments.length;i++) { |
... | ... | |
205 | 199 |
|
206 | 200 |
return null; |
207 | 201 |
} |
202 |
|
|
208 | 203 |
private String getDocumentSelectedName() { |
209 | 204 |
JRadioButton btnSelected=null; |
210 | 205 |
for (int i=0;i<btnsDocuments.length;i++) { |
... | ... | |
216 | 211 |
|
217 | 212 |
return null; |
218 | 213 |
} |
219 |
/** |
|
220 |
* Refresca las etiquetas con la informaci?n del proyecto |
|
221 |
*/ |
|
214 |
|
|
215 |
/** |
|
216 |
* Refresh the labes with the information of the project |
|
217 |
*/ |
|
222 | 218 |
private void refreshProperties() { |
223 | 219 |
if (p != null) { |
224 | 220 |
lblNombreSesion.setText(p.getName()); |
... | ... | |
233 | 229 |
} |
234 | 230 |
} |
235 | 231 |
|
236 |
/**
|
|
237 |
* Refresca todo el di?logo
|
|
238 |
*/
|
|
232 |
/**
|
|
233 |
* Refresh all the dialog
|
|
234 |
*/
|
|
239 | 235 |
public void refreshControls() { |
240 | 236 |
refreshList(); |
241 | 237 |
refreshProperties(); |
242 | 238 |
} |
243 | 239 |
|
244 |
/** |
|
245 |
* This method initializes this |
|
246 |
*/ |
|
240 |
|
|
247 | 241 |
private void initialize() { |
248 | 242 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
249 | 243 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
... | ... | |
289 | 283 |
ExtensionPointsSingleton.getInstance(); |
290 | 284 |
|
291 | 285 |
ExtensionPoint extensionPoint =(ExtensionPoint)extensionPoints.get("Documents"); |
292 |
Iterator iterator = extensionPoint.keySet().iterator();
|
|
286 |
Iterator iterator = extensionPoint.keySet().iterator(); |
|
293 | 287 |
while (iterator.hasNext()) { |
294 | 288 |
try { |
295 | 289 |
ProjectDocumentFactory documentFactory = (ProjectDocumentFactory)extensionPoint.create((String)iterator.next()); |
... | ... | |
310 | 304 |
} |
311 | 305 |
return null; |
312 | 306 |
} |
313 |
/** |
|
314 |
* Crea un nuevo project element |
|
315 |
* |
|
316 |
* @throws Exception DOCUMENT ME! |
|
317 |
*/ |
|
307 |
|
|
308 |
/** |
|
309 |
* Creates a new document of the selected type |
|
310 |
*/ |
|
318 | 311 |
private void newProjectDocument() throws Exception { |
319 | 312 |
String s=getDocumentSelected(); |
320 | 313 |
ProjectDocument doc=createDocument(s); |
... | ... | |
324 | 317 |
} |
325 | 318 |
} |
326 | 319 |
|
327 |
/** |
|
328 |
* Abre la ventana de un nuevo project element |
|
329 |
*/ |
|
330 |
private void abrir() { |
|
320 |
private void openSelectedDocument() { |
|
331 | 321 |
int[] indexes = lstDocs.getSelectedIndices(); |
332 | 322 |
for (int i=indexes.length-1;i>=0;i--) { |
333 | 323 |
int index=indexes[i]; |
... | ... | |
335 | 325 |
return; |
336 | 326 |
} |
337 | 327 |
String s=getDocumentSelected(); |
338 |
ArrayList documents=p.getDocumentsByType(s);
|
|
328 |
ArrayList<ProjectDocument> documents = p.getDocumentsByType(s);
|
|
339 | 329 |
ProjectDocument doc=(ProjectDocument)documents.get(index); |
340 | 330 |
IWindow window=doc.createWindow(); |
341 | 331 |
if (window == null){ |
... | ... | |
347 | 337 |
p.setModified(true); |
348 | 338 |
} |
349 | 339 |
|
350 |
/** |
|
351 |
* Cambia el nombre de un project element |
|
352 |
*/ |
|
353 |
private void renombrar() { |
|
340 |
private void renameSelectedDocument() { |
|
354 | 341 |
int index = lstDocs.getSelectedIndex(); |
355 | 342 |
|
356 | 343 |
if (index == -1) { |
357 | 344 |
return; |
358 | 345 |
} |
359 | 346 |
String s=getDocumentSelected(); |
360 |
ArrayList documents=p.getDocumentsByType(s);
|
|
347 |
ArrayList<ProjectDocument> documents = p.getDocumentsByType(s);
|
|
361 | 348 |
ProjectDocument doc=(ProjectDocument)documents.get(index); |
362 | 349 |
|
363 | 350 |
if (doc.isLocked()) { |
364 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_renamed")); |
|
351 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, |
|
352 |
"locked_element_it_cannot_be_renamed")); |
|
365 | 353 |
return; |
366 | 354 |
} |
367 | 355 |
|
... | ... | |
378 | 366 |
|
379 | 367 |
String nuevoNombre = pane.getInputValue().toString().trim(); |
380 | 368 |
|
381 |
if (nuevoNombre.length() == 0) {
|
|
369 |
if ((nuevoNombre == null) || (nuevoNombre.length() == 0)) {
|
|
382 | 370 |
return; |
383 | 371 |
} |
384 | 372 |
|
385 |
if (nuevoNombre == null) { |
|
386 |
return; |
|
387 |
} |
|
388 |
|
|
389 | 373 |
for (int i=0; i<lstDocs.getModel().getSize(); i++){ |
390 | 374 |
if (i==index) continue; |
391 | 375 |
if (((ProjectDocument)lstDocs.getModel().getElementAt(i)).getName().equals(nuevoNombre)){ |
... | ... | |
400 | 384 |
p.setModified(true); |
401 | 385 |
} |
402 | 386 |
|
403 |
/** |
|
404 |
* Borra un project element |
|
405 |
*/ |
|
406 |
private void borrar() { |
|
387 |
private void removeSelectedDocuments() { |
|
407 | 388 |
int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(), |
408 | 389 |
PluginServices.getText(this, "confirmar_borrar"), |
409 | 390 |
PluginServices.getText(this, "borrar"), |
... | ... | |
414 | 395 |
for (int i=indexes.length-1;i>=0;i--) { |
415 | 396 |
int index=indexes[i]; |
416 | 397 |
String s=getDocumentSelected(); |
417 |
ArrayList documents=p.getDocumentsByType(s);
|
|
398 |
ArrayList<ProjectDocument> documents = p.getDocumentsByType(s);
|
|
418 | 399 |
ProjectDocument doc=(ProjectDocument)documents.get(index); |
419 | 400 |
if (doc.isLocked()) { |
420 | 401 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
... | ... | |
428 | 409 |
} |
429 | 410 |
} |
430 | 411 |
|
431 |
/** |
|
432 |
* Muestra el di?logo de propiedades de un project element |
|
433 |
*/ |
|
434 |
private void propiedades() { |
|
412 |
private void showSelectedDocumentProperties() { |
|
435 | 413 |
int index = lstDocs.getSelectedIndex(); |
436 | 414 |
|
437 | 415 |
if (index == -1) { |
... | ... | |
440 | 418 |
|
441 | 419 |
IWindow dlg = null; |
442 | 420 |
String s=getDocumentSelected(); |
443 |
ArrayList documents=p.getDocumentsByType(s);
|
|
421 |
ArrayList<ProjectDocument> documents = p.getDocumentsByType(s);
|
|
444 | 422 |
ProjectDocument doc=(ProjectDocument) documents.get(index); |
445 | 423 |
if (doc.isLocked()) { |
446 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
|
424 |
JOptionPane.showMessageDialog(this, |
|
425 |
PluginServices.getText(this, "locked_element")); |
|
447 | 426 |
return; |
448 | 427 |
} |
449 | 428 |
dlg=doc.getProperties(); |
... | ... | |
454 | 433 |
p.setModified(true); |
455 | 434 |
} |
456 | 435 |
|
457 |
/** |
|
458 |
* This method initializes jPanel |
|
459 |
* |
|
460 |
* @return JPanel |
|
461 |
*/ |
|
462 | 436 |
private JPanel getJPanel() { |
463 | 437 |
if (jPanel == null) { |
464 | 438 |
jPanel = new JPanel(); |
... | ... | |
481 | 455 |
return jPanel; |
482 | 456 |
} |
483 | 457 |
|
484 |
/** |
|
485 |
* This method initializes btnVistas |
|
486 |
* |
|
487 |
* @return JRadioButton |
|
488 |
*/ |
|
489 | 458 |
private JRadioButton[] getBtnDocuments() { |
490 | 459 |
if (btnsDocuments == null) { |
491 | 460 |
ExtensionPoints extensionPoints = |
492 | 461 |
ExtensionPointsSingleton.getInstance(); |
493 | 462 |
|
494 | 463 |
ExtensionPoint extensionPoint =(ExtensionPoint)extensionPoints.get("Documents"); |
495 |
ArrayList btns=new ArrayList();
|
|
496 |
ArrayList priorities=new ArrayList();
|
|
464 |
ArrayList<JRadioButton> btns = new ArrayList<JRadioButton>();
|
|
465 |
ArrayList<Integer> priorities = new ArrayList<Integer>();
|
|
497 | 466 |
Iterator iterator = extensionPoint.keySet().iterator(); |
498 | 467 |
while (iterator.hasNext()) { |
499 | 468 |
try { |
... | ... | |
543 | 512 |
return btnsDocuments; |
544 | 513 |
} |
545 | 514 |
|
546 |
/** |
|
547 |
* This method initializes jPanel1 |
|
548 |
* |
|
549 |
* @return JPanel |
|
550 |
*/ |
|
515 |
|
|
551 | 516 |
private JPanel getJPanel1() { |
552 | 517 |
if (jPanel1 == null) { |
553 | 518 |
jPanel1 = new JPanel(); |
... | ... | |
585 | 550 |
return jPanel1; |
586 | 551 |
} |
587 | 552 |
|
588 |
/** |
|
589 |
* This method initializes lstDocs |
|
590 |
* |
|
591 |
* @return JList |
|
592 |
*/ |
|
553 |
|
|
593 | 554 |
private JList getLstDocs() { |
594 | 555 |
if (lstDocs == null) { |
595 | 556 |
lstDocs = new JList(); |
... | ... | |
615 | 576 |
|
616 | 577 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
617 | 578 |
if (e.getButton() == java.awt.event.MouseEvent.BUTTON3) { |
618 |
/* |
|
619 |
getDocumentSelected();//ProjectView |
|
620 |
getDocumentSelectedName();//Vista |
|
621 |
*/ |
|
622 | 579 |
String docType = getDocumentSelected(); |
623 | 580 |
ProjectDocument[] selecteds = this.getSelecteds(); |
624 | 581 |
|
... | ... | |
631 | 588 |
} |
632 | 589 |
|
633 | 590 |
if (e.getClickCount() == 2) { |
634 |
abrir();
|
|
591 |
openSelectedDocument();
|
|
635 | 592 |
} |
636 | 593 |
|
637 | 594 |
} |
... | ... | |
639 | 596 |
lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
640 | 597 |
public void valueChanged( |
641 | 598 |
javax.swing.event.ListSelectionEvent e) { |
642 |
activarBotones();
|
|
599 |
enableButtons();
|
|
643 | 600 |
} |
644 | 601 |
}); |
645 | 602 |
} |
... | ... | |
647 | 604 |
return lstDocs; |
648 | 605 |
} |
649 | 606 |
|
650 |
/** |
|
651 |
* This method initializes jPanel2 |
|
652 |
* |
|
653 |
* @return JPanel |
|
654 |
*/ |
|
607 |
|
|
655 | 608 |
private JPanel getJPanel2() { |
656 | 609 |
if (jPanel2 == null) { |
657 | 610 |
jPanel2 = new JPanel(); |
658 |
|
|
659 |
//FlowLayout layout = new FlowLayout(); |
|
660 | 611 |
GridLayout layout = new GridLayout(5,1); |
661 | 612 |
layout.setVgap(7); |
662 |
|
|
663 | 613 |
jPanel2.setLayout(layout); |
664 | 614 |
jPanel2.add(getBtnNuevo(), null); |
665 | 615 |
jPanel2.add(getBtnAbrir(), null); |
... | ... | |
670 | 620 |
jPanel2.setMinimumSize(new java.awt.Dimension(100, 150)); |
671 | 621 |
jPanel2.setMaximumSize(new java.awt.Dimension(100, 150)); |
672 | 622 |
} |
673 |
|
|
674 | 623 |
return jPanel2; |
675 | 624 |
} |
676 | 625 |
|
677 |
/** |
|
678 |
* This method initializes btnNuevo |
|
679 |
* |
|
680 |
* @return JButton |
|
681 |
*/ |
|
626 |
|
|
682 | 627 |
private JButton getBtnNuevo() { |
683 | 628 |
if (btnNuevo == null) { |
684 | 629 |
btnNuevo = new JButton(); |
... | ... | |
700 | 645 |
return btnNuevo; |
701 | 646 |
} |
702 | 647 |
|
703 |
/** |
|
704 |
* This method initializes btnPropiedades |
|
705 |
* |
|
706 |
* @return JButton |
|
707 |
*/ |
|
708 | 648 |
private JButton getBtnPropiedades() { |
709 | 649 |
if (btnPropiedades == null) { |
710 | 650 |
btnPropiedades = new JButton(); |
... | ... | |
714 | 654 |
btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
715 | 655 |
btnPropiedades.addActionListener(new java.awt.event.ActionListener() { |
716 | 656 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
717 |
propiedades();
|
|
657 |
showSelectedDocumentProperties();
|
|
718 | 658 |
} |
719 | 659 |
}); |
720 | 660 |
} |
... | ... | |
722 | 662 |
return btnPropiedades; |
723 | 663 |
} |
724 | 664 |
|
725 |
/** |
|
726 |
* This method initializes btnAbrir |
|
727 |
* |
|
728 |
* @return JButton |
|
729 |
*/ |
|
730 | 665 |
private JButton getBtnAbrir() { |
731 | 666 |
if (btnAbrir == null) { |
732 | 667 |
btnAbrir = new JButton(); |
... | ... | |
736 | 671 |
btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
737 | 672 |
btnAbrir.addActionListener(new java.awt.event.ActionListener() { |
738 | 673 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
739 |
abrir();
|
|
674 |
openSelectedDocument();
|
|
740 | 675 |
} |
741 | 676 |
}); |
742 | 677 |
} |
... | ... | |
744 | 679 |
return btnAbrir; |
745 | 680 |
} |
746 | 681 |
|
747 |
/** |
|
748 |
* This method initializes btnBorrar |
|
749 |
* |
|
750 |
* @return JButton |
|
751 |
*/ |
|
752 | 682 |
private JButton getBtnBorrar() { |
753 | 683 |
if (btnBorrar == null) { |
754 | 684 |
btnBorrar = new JButton(); |
... | ... | |
758 | 688 |
btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
759 | 689 |
btnBorrar.addActionListener(new java.awt.event.ActionListener() { |
760 | 690 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
761 |
borrar();
|
|
691 |
removeSelectedDocuments();
|
|
762 | 692 |
} |
763 | 693 |
}); |
764 | 694 |
} |
... | ... | |
766 | 696 |
return btnBorrar; |
767 | 697 |
} |
768 | 698 |
|
769 |
/** |
|
770 |
* This method initializes btnRenombrar |
|
771 |
* |
|
772 |
* @return JButton |
|
773 |
*/ |
|
699 |
|
|
774 | 700 |
private JButton getBtnRenombrar() { |
775 | 701 |
if (btnRenombrar == null) { |
776 | 702 |
btnRenombrar = new JButton(); |
... | ... | |
780 | 706 |
btnRenombrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
781 | 707 |
btnRenombrar.addActionListener(new java.awt.event.ActionListener() { |
782 | 708 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
783 |
renombrar();
|
|
709 |
renameSelectedDocument();
|
|
784 | 710 |
} |
785 | 711 |
}); |
786 | 712 |
} |
... | ... | |
788 | 714 |
return btnRenombrar; |
789 | 715 |
} |
790 | 716 |
|
791 |
/** |
|
792 |
* This method initializes jPanel3 |
|
793 |
* |
|
794 |
* @return JPanel |
|
795 |
*/ |
|
717 |
|
|
796 | 718 |
private JPanel getJPanel3() { |
797 | 719 |
if (jPanel3 == null) { |
798 | 720 |
jPanel3 = new JPanel(); |
... | ... | |
851 | 773 |
return jPanel3; |
852 | 774 |
} |
853 | 775 |
|
854 |
/** |
|
855 |
* This method initializes jLabel |
|
856 |
* |
|
857 |
* @return JLabel |
|
858 |
*/ |
|
776 |
|
|
859 | 777 |
private JLabel getJLabel() { |
860 | 778 |
if (jLabel == null) { |
861 | 779 |
jLabel = new JLabel(); |
... | ... | |
866 | 784 |
return jLabel; |
867 | 785 |
} |
868 | 786 |
|
869 |
/** |
|
870 |
* This method initializes lblNombreSesion |
|
871 |
* |
|
872 |
* @return JLabel |
|
873 |
*/ |
|
787 |
|
|
874 | 788 |
private JLabel getLblNombreSesion() { |
875 | 789 |
if (lblNombreSesion == null) { |
876 | 790 |
lblNombreSesion = new JLabel(); |
... | ... | |
883 | 797 |
return lblNombreSesion; |
884 | 798 |
} |
885 | 799 |
|
886 |
/** |
|
887 |
* This method initializes jLabel1 |
|
888 |
* |
|
889 |
* @return JLabel |
|
890 |
*/ |
|
800 |
|
|
891 | 801 |
private JLabel getJLabel1() { |
892 | 802 |
if (jLabel1 == null) { |
893 | 803 |
jLabel1 = new JLabel(); |
... | ... | |
898 | 808 |
return jLabel1; |
899 | 809 |
} |
900 | 810 |
|
901 |
/** |
|
902 |
* This method initializes lblGuardado |
|
903 |
* |
|
904 |
* @return JLabel |
|
905 |
*/ |
|
811 |
|
|
906 | 812 |
private JLabel getLblGuardado() { |
907 | 813 |
if (lblGuardado == null) { |
908 | 814 |
lblGuardado = new JLabel(); |
... | ... | |
914 | 820 |
return lblGuardado; |
915 | 821 |
} |
916 | 822 |
|
917 |
/** |
|
918 |
* This method initializes jLabel2 |
|
919 |
* |
|
920 |
* @return JLabel |
|
921 |
*/ |
|
922 | 823 |
private JLabel getJLabel2() { |
923 | 824 |
if (jLabel2 == null) { |
924 | 825 |
jLabel2 = new JLabel(); |
... | ... | |
930 | 831 |
return jLabel2; |
931 | 832 |
} |
932 | 833 |
|
933 |
/** |
|
934 |
* This method initializes lblFecha |
|
935 |
* |
|
936 |
* @return JLabel |
|
937 |
*/ |
|
834 |
|
|
938 | 835 |
private JLabel getLblFecha() { |
939 | 836 |
if (lblFecha == null) { |
940 | 837 |
lblFecha = new JLabel(); |
... | ... | |
946 | 843 |
return lblFecha; |
947 | 844 |
} |
948 | 845 |
|
949 |
/** |
|
950 |
* This method initializes btnImportar |
|
951 |
* |
|
952 |
* @return JButton |
|
953 |
*/ |
|
846 |
|
|
954 | 847 |
private JButton getBtnImportar() { |
955 | 848 |
if (btnImportar == null) { |
956 | 849 |
btnImportar = new JButton(); |
... | ... | |
965 | 858 |
return btnImportar; |
966 | 859 |
} |
967 | 860 |
|
968 |
/** |
|
969 |
* This method initializes btnExportar |
|
970 |
* |
|
971 |
* @return JButton |
|
972 |
*/ |
|
861 |
|
|
973 | 862 |
private JButton getBtnExportar() { |
974 | 863 |
if (btnExportar == null) { |
975 | 864 |
btnExportar = new JButton(); |
... | ... | |
984 | 873 |
return btnExportar; |
985 | 874 |
} |
986 | 875 |
|
987 |
/** |
|
988 |
* This method initializes btnEditar |
|
989 |
* |
|
990 |
* @return JButton |
|
991 |
*/ |
|
876 |
|
|
992 | 877 |
private JButton getBtnEditar() { |
993 | 878 |
if (btnEditar == null) { |
994 | 879 |
btnEditar = new JButton(); |
... | ... | |
1010 | 895 |
return btnEditar; |
1011 | 896 |
} |
1012 | 897 |
|
1013 |
/** |
|
1014 |
* This method initializes jScrollPane |
|
1015 |
* |
|
1016 |
* @return JScrollPane |
|
1017 |
*/ |
|
898 |
|
|
1018 | 899 |
private JScrollPane getJScrollPane() { |
1019 | 900 |
if (jScrollPane == null) { |
1020 | 901 |
jScrollPane = new JScrollPane(); |
... | ... | |
1070 | 951 |
public void viewActivated() { |
1071 | 952 |
} |
1072 | 953 |
|
1073 |
/** |
|
1074 |
* This method initializes jPanel4 |
|
1075 |
* |
|
1076 |
* @return JPanel |
|
1077 |
*/ |
|
954 |
|
|
1078 | 955 |
private JPanel getJPanel4() { |
1079 | 956 |
if (jPanel4 == null) { |
1080 | 957 |
jPanel4 = new JPanel(); |
... | ... | |
1090 | 967 |
return jPanel4; |
1091 | 968 |
} |
1092 | 969 |
|
1093 |
/** |
|
1094 |
* This method initializes jScrollPane1 |
|
1095 |
* |
|
1096 |
* @return javax.swing.JScrollPane |
|
1097 |
*/ |
|
970 |
|
|
1098 | 971 |
private JScrollPane getJScrollPane1() { |
1099 | 972 |
if (jScrollPane1 == null) { |
1100 | 973 |
jScrollPane1 = new JScrollPane(); |
... | ... | |
1108 | 981 |
public Object getWindowProfile() { |
1109 | 982 |
return WindowInfo.PROJECT_PROFILE; |
1110 | 983 |
} |
1111 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
|
984 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/ProjectView.java | ||
---|---|---|
47 | 47 |
import java.util.Map.Entry; |
48 | 48 |
|
49 | 49 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
50 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
51 | 50 |
import com.iver.andami.PluginServices; |
52 | 51 |
import com.iver.andami.ui.mdiManager.IWindow; |
53 | 52 |
import com.iver.cit.gvsig.fmap.MapContext; |
54 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
55 | 53 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
56 | 54 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
57 | 55 |
import com.iver.cit.gvsig.fmap.layers.LayersIterator; |
58 | 56 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
59 | 57 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
58 |
import com.iver.cit.gvsig.gui.preferencespage.ViewPage; |
|
60 | 59 |
import com.iver.cit.gvsig.project.Project; |
61 | 60 |
import com.iver.cit.gvsig.project.documents.ProjectDocument; |
62 | 61 |
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory; |
... | ... | |
74 | 73 |
* @author Fernando Gonz?lez Cort?s |
75 | 74 |
*/ |
76 | 75 |
public class ProjectView extends ProjectViewBase { |
77 |
//public static int numViews = 0; |
|
78 | 76 |
|
79 |
//public static int METROS = 0; |
|
80 |
//public static int KILOMETROS = 1; |
|
81 |
//public static int[] unidades = new int[] { METROS, KILOMETROS }; |
|
82 |
///private Color backgroundColor = new Color(255, 255, 255); |
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
/** |
|
87 |
* DOCUMENT ME! |
|
88 |
* |
|
89 |
* @return DOCUMENT ME! |
|
90 |
* @throws XMLException |
|
91 |
* @throws SaveException |
|
92 |
*/ |
|
93 | 77 |
public XMLEntity getXMLEntity() throws SaveException { |
94 | 78 |
XMLEntity xml = super.getXMLEntity(); |
95 |
//xml.putProperty("nameClass", this.getClass().getName()); |
|
96 | 79 |
try{ |
97 | 80 |
int numViews=((Integer)ProjectDocument.NUMS.get(ProjectViewFactory.registerName)).intValue(); |
98 | 81 |
|
99 | 82 |
xml.putProperty("numViews", numViews); |
100 | 83 |
|
101 |
// remove old hyperlink persistence |
|
102 |
// xml.putProperty("m_selectedField", m_selectedField); |
|
103 |
// xml.putProperty("m_typeLink", m_typeLink); |
|
104 |
// xml.putProperty("m_extLink", m_extLink); |
|
105 | 84 |
xml.addChild(mapContext.getXMLEntity()); |
106 | 85 |
|
107 | 86 |
if (mapOverViewContext != null) { |
... | ... | |
121 | 100 |
} |
122 | 101 |
|
123 | 102 |
/** |
124 |
* DOCUMENT ME! |
|
125 |
* |
|
126 |
* @param xml DOCUMENT ME! |
|
127 |
* @param p DOCUMENT ME! |
|
128 |
* @throws XMLException |
|
129 |
* @throws DriverException |
|
130 |
* @throws DriverIOException |
|
131 |
* |
|
132 | 103 |
* @see com.iver.cit.gvsig.project.documents.ProjectDocument#setXMLEntity(com.iver.utiles.XMLEntity) |
133 | 104 |
*/ |
134 | 105 |
public void setXMLEntity03(XMLEntity xml) |
... | ... | |
149 | 120 |
} |
150 | 121 |
|
151 | 122 |
/** |
152 |
* DOCUMENT ME! |
|
153 |
* |
|
154 |
* @param xml DOCUMENT ME! |
|
155 |
* @param p DOCUMENT ME! |
|
156 |
* @throws XMLException |
|
157 |
* @throws DriverException |
|
158 |
* @throws DriverIOException |
|
159 |
* @throws OpenException |
|
160 |
* |
|
161 | 123 |
* @see com.iver.cit.gvsig.project.documents.ProjectDocument#setXMLEntity(com.iver.utiles.XMLEntity) |
162 | 124 |
*/ |
163 | 125 |
public void setXMLEntity(XMLEntity xml) |
... | ... | |
189 | 151 |
applyHyperlinkToLayers(selectedField, type, extension); |
190 | 152 |
} |
191 | 153 |
|
192 |
|
|
193 |
|
|
194 |
showErrors(); |
|
154 |
showErrors(); |
|
195 | 155 |
}catch (Exception e) { |
196 | 156 |
throw new OpenException(e,this.getClass().getName()); |
197 | 157 |
} |
... | ... | |
224 | 184 |
|
225 | 185 |
} |
226 | 186 |
|
227 |
/** |
|
228 |
* DOCUMENT ME! |
|
229 |
* |
|
230 |
* @param p DOCUMENT ME! |
|
231 |
* |
|
232 |
* @return DOCUMENT ME! |
|
233 |
* @throws XMLException |
|
234 |
* @throws DriverException |
|
235 |
* @throws DriverIOException |
|
236 |
* @throws OpenException |
|
237 |
*/ |
|
238 |
/*public ProjectView cloneProjectView(Project p) |
|
239 |
throws XMLException, DriverException, DriverIOException, OpenException { |
|
240 |
return (ProjectView) createFromXML(getXMLEntity(), p); |
|
241 |
} |
|
242 |
*/ |
|
243 | 187 |
|
244 | 188 |
public String getFrameName() { |
245 | 189 |
return PluginServices.getText(this,"Vista"); |
... | ... | |
251 | 195 |
view.setWindowData(windowData); |
252 | 196 |
view.initialize(this.getMapContext()); |
253 | 197 |
view.setModel(this); |
198 |
XMLEntity xml = PluginServices.getPluginServices(this) |
|
199 |
.getPersistentXML(); |
|
200 |
if (xml.contains(ViewPage.OPEN_VIEW_WINDOW_MAXIMIZED)) { |
|
201 |
view.getWindowInfo() |
|
202 |
.setMaximized( |
|
203 |
xml.getBooleanProperty(ViewPage.OPEN_VIEW_WINDOW_MAXIMIZED)); |
|
204 |
} |
|
254 | 205 |
callCreateWindow(view); |
255 | 206 |
return view; |
256 | 207 |
} |
... | ... | |
301 | 252 |
} |
302 | 253 |
|
303 | 254 |
|
304 |
|
|
305 |
|
|
306 | 255 |
//Cargamos las tables vinculadas: |
307 | 256 |
|
308 | 257 |
//Recuperamos todos los nombres |
309 | 258 |
XMLEntity tablesRoot = project.getExportXMLTypeRootNode(root,ProjectTableFactory.registerName); |
310 |
int childIndex; |
|
311 | 259 |
XMLEntity child; |
312 | 260 |
// Lo hacemos en un map por si una vista se usa varias veces |
313 |
HashMap tablesName = new HashMap();
|
|
314 |
Iterator iterTables = tablesRoot.findChildren("viewName",this.getName()); |
|
261 |
HashMap<String, String> tablesName = new HashMap<String, String>();
|
|
262 |
Iterator<XMLEntity> iterTables = tablesRoot.findChildren("viewName",this.getName());
|
|
315 | 263 |
while (iterTables.hasNext()){ |
316 |
child = (XMLEntity)iterTables.next();
|
|
264 |
child = iterTables.next(); |
|
317 | 265 |
tablesName.put(child.getStringProperty("name"),child.getStringProperty("name")); |
318 | 266 |
} |
319 | 267 |
|
... | ... | |
363 | 311 |
|
364 | 312 |
} |
365 | 313 |
|
366 |
// public int computeSignature() { |
|
367 |
// int result = 17; |
|
368 |
// |
|
369 |
// Class clazz = getClass(); |
|
370 |
// Field[] fields = clazz.getDeclaredFields(); |
|
371 |
// for (int i = 0; i < fields.length; i++) { |
|
372 |
// try { |
|
373 |
// String type = fields[i].getType().getName(); |
|
374 |
// if (type.equals("boolean")) { |
|
375 |
// result += 37 + ((fields[i].getBoolean(this)) ? 1 : 0); |
|
376 |
// } else if (type.equals("java.lang.String")) { |
|
377 |
// Object v = fields[i].get(this); |
|
378 |
// if (v == null) { |
|
379 |
// result += 37; |
|
380 |
// continue; |
|
381 |
// } |
|
382 |
// char[] chars = ((String) v).toCharArray(); |
|
383 |
// for (int j = 0; j < chars.length; j++) { |
|
384 |
// result += 37 + (int) chars[i]; |
|
385 |
// } |
|
386 |
// } else if (type.equals("byte")) { |
|
387 |
// result += 37 + (int) fields[i].getByte(this); |
|
388 |
// } else if (type.equals("char")) { |
|
389 |
// result += 37 + (int) fields[i].getChar(this); |
|
390 |
// } else if (type.equals("short")) { |
|
391 |
// result += 37 + (int) fields[i].getShort(this); |
|
392 |
// } else if (type.equals("int")) { |
|
393 |
// result += 37 + fields[i].getInt(this); |
|
394 |
// } else if (type.equals("long")) { |
|
395 |
// long f = fields[i].getLong(this) ; |
|
396 |
// result += 37 + (f ^ (f >>> 32)); |
|
397 |
// } else if (type.equals("float")) { |
|
398 |
// result += 37 + Float.floatToIntBits(fields[i].getFloat(this)); |
|
399 |
// } else if (type.equals("double")) { |
|
400 |
// long f = Double.doubleToLongBits(fields[i].getDouble(this)); |
|
401 |
// result += 37 + (f ^ (f >>> 32)); |
|
402 |
// } else { |
|
403 |
// Object obj = fields[i].get(this); |
|
404 |
// result += 37 + ((obj != null)? obj.hashCode() : 0); |
|
405 |
// } |
|
406 |
// } catch (Exception e) { e.printStackTrace(); } |
|
407 |
// |
|
408 |
// } |
|
409 |
// return result; |
|
410 |
// } |
|
411 | 314 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/preferencespage/ViewPage.java | ||
---|---|---|
200 | 200 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
201 | 201 |
import com.iver.cit.gvsig.project.Project; |
202 | 202 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
203 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
|
204 | 203 |
import com.iver.utiles.StringUtilities; |
205 | 204 |
import com.iver.utiles.XMLEntity; |
206 | 205 |
import com.iver.utiles.swing.JComboBox; |
206 |
|
|
207 | 207 |
/** |
208 |
* View document configuration page. |
|
209 |
* <b><b> |
|
210 |
* Here the user can establish what settings wants to use by default regarding to |
|
211 |
* the document View. |
|
212 |
* |
|
213 |
* |
|
208 |
* <p> |
|
209 |
* View document configuration page. |
|
210 |
* </p> |
|
211 |
* <p> |
|
212 |
* Here the user can establish what settings wants to use by default regarding |
|
213 |
* to the document View. |
|
214 |
* </p> |
|
215 |
* |
|
214 | 216 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
215 | 217 |
*/ |
216 | 218 |
public class ViewPage extends AbstractPreferencePage { |
... | ... | |
222 | 224 |
private static final String ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME = "NewLayersInInvisibleMode"; |
223 | 225 |
private static final String SHOW_FILE_EXTENSIONS_KEY_NAME = "ShowFileExtensions"; |
224 | 226 |
private static final String KEEP_SCALE_ON_RESIZING_KEY_NAME = "KeepScaleOnResizing"; |
227 |
public static final String OPEN_VIEW_WINDOW_MAXIMIZED = "options.view.open_view_window_maximized"; |
|
225 | 228 |
private static final String DEFAULT_SELECTION_COLOR_KEY_NAME = "DefaultSelectionColor"; |
226 | 229 |
private static final String DEFAULT_VIEW_BACK_COLOR_KEY_NAME = "DefaultViewBackColor"; |
227 | 230 |
private static final String DEFAULT_DISTANCE_AREA_KEY_NAME = "DefaultDistanceArea"; |
... | ... | |
255 | 258 |
private String fontName; |
256 | 259 |
private JCheckBox chkInvisibleNewLayers; |
257 | 260 |
private JCheckBox chkKeepScaleOnResizing; |
261 |
private JCheckBox chkOpenViewWindowMaximized; |
|
258 | 262 |
private JCheckBox chkShowFileExtensions; |
259 | 263 |
private ColorChooserPanel jccDefaultSelectionColor; |
260 | 264 |
private ColorChooserPanel jccDefaultViewBackColor; |
... | ... | |
362 | 366 |
chkKeepScaleOnResizing.setEnabled(false); |
363 | 367 |
addComponent("", chkKeepScaleOnResizing); |
364 | 368 |
|
369 |
chkOpenViewWindowMaximized = new JCheckBox(PluginServices.getText(this, |
|
370 |
"options.view.open_view_window_maximized")); |
|
371 |
addComponent("", chkOpenViewWindowMaximized); |
|
372 |
|
|
365 | 373 |
// just a separator |
366 | 374 |
addComponent(new JLabel(" ")); |
367 | 375 |
|
... | ... | |
440 | 448 |
xml.getBooleanProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME)); |
441 | 449 |
} |
442 | 450 |
|
451 |
if (xml.contains(OPEN_VIEW_WINDOW_MAXIMIZED)) { |
|
452 |
chkOpenViewWindowMaximized.setSelected(xml |
|
453 |
.getBooleanProperty(OPEN_VIEW_WINDOW_MAXIMIZED)); |
|
454 |
} else { |
|
455 |
chkOpenViewWindowMaximized.setSelected(true); |
|
456 |
xml.putProperty(OPEN_VIEW_WINDOW_MAXIMIZED, true); |
|
457 |
} |
|
458 |
|
|
443 | 459 |
// Zoom-in factor |
444 | 460 |
if (xml.contains(ZOOM_IN_FACTOR_KEY_NAME)) { |
445 | 461 |
double zoomInFactor = xml.getDoubleProperty(ZOOM_IN_FACTOR_KEY_NAME); |
... | ... | |
559 | 575 |
Project.setDefaultDistanceArea(jCmbDistanceArea.getSelectedIndex()); |
560 | 576 |
invisibleNewLayers = chkInvisibleNewLayers.isSelected(); |
561 | 577 |
keepScaleOnResize = chkKeepScaleOnResizing.isSelected(); |
578 |
|
|
562 | 579 |
showFileExtensions = chkShowFileExtensions.isSelected(); |
563 | 580 |
} catch (Exception e) { |
564 | 581 |
throw new StoreException(PluginServices.getText(this,"factor_zoom_incorrecto")); |
... | ... | |
574 | 591 |
xml.putProperty(ZOOM_OUT_FACTOR_KEY_NAME, zof); |
575 | 592 |
xml.putProperty(ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME, invisibleNewLayers); |
576 | 593 |
xml.putProperty(KEEP_SCALE_ON_RESIZING_KEY_NAME, keepScaleOnResize); |
594 |
xml.putProperty(OPEN_VIEW_WINDOW_MAXIMIZED, |
|
595 |
chkOpenViewWindowMaximized.isSelected()); |
|
577 | 596 |
xml.putProperty(SHOW_FILE_EXTENSIONS_KEY_NAME, showFileExtensions); |
578 | 597 |
xml.putProperty(DEFAULT_VIEW_BACK_COLOR_KEY_NAME, StringUtilities.color2String(viewBackColor)); |
579 | 598 |
/* |
... | ... | |
593 | 612 |
txtZoomOutFactor.setText(String.valueOf(DEFAULT_ZOOM_OUT_FACTOR)); |
594 | 613 |
chkInvisibleNewLayers.setSelected(false); |
595 | 614 |
chkKeepScaleOnResizing.setSelected(false); |
615 |
chkOpenViewWindowMaximized.setSelected(true); |
|
596 | 616 |
jccDefaultViewBackColor.setColor(FACTORY_DEFAULT_VIEW_BACK_COLOR); |
597 | 617 |
/* |
598 | 618 |
* Locator's background color, for when we let it be possible |
Also available in: Unified diff