Revision 31496 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/gui/ProjectWindow.java
ProjectWindow.java | ||
---|---|---|
50 | 50 |
import java.beans.PropertyChangeListener; |
51 | 51 |
import java.io.File; |
52 | 52 |
import java.util.ArrayList; |
53 |
import java.util.Iterator; |
|
53 |
import java.util.Collections; |
|
54 |
import java.util.Comparator; |
|
55 |
import java.util.List; |
|
54 | 56 |
|
55 | 57 |
import javax.swing.ButtonGroup; |
56 | 58 |
import javax.swing.JDialog; |
... | ... | |
70 | 72 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
71 | 73 |
import org.gvsig.app.extension.ProjectExtension; |
72 | 74 |
import org.gvsig.app.project.Project; |
73 |
import org.gvsig.app.project.documents.ProjectDocument; |
|
74 |
import org.gvsig.app.project.documents.ProjectDocumentFactory; |
|
75 |
import org.gvsig.app.project.documents.contextMenu.gui.DocumentContextMenu; |
|
75 |
import org.gvsig.app.project.ProjectManager; |
|
76 |
import org.gvsig.app.project.documents.Document; |
|
77 |
import org.gvsig.app.project.documents.DocumentManager; |
|
78 |
import org.gvsig.app.project.documents.AbstractDocument; |
|
76 | 79 |
import org.gvsig.gui.beans.swing.JButton; |
77 |
import org.gvsig.tools.ToolsLocator; |
|
78 |
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
|
79 | 80 |
import org.gvsig.utils.DefaultListModel; |
80 | 81 |
|
81 |
|
|
82 |
|
|
83 | 82 |
/** |
84 |
* Clase principal del proyecto donde se puede operar para crear |
|
85 |
* cualquier tipo de documento.
|
|
86 |
* |
|
83 |
* Clase principal del proyecto donde se puede operar para crear cualquier tipo
|
|
84 |
* de documento. |
|
85 |
*
|
|
87 | 86 |
* @author Vicente Caballero Navarro |
88 | 87 |
*/ |
89 | 88 |
public class ProjectWindow extends JPanel implements PropertyChangeListener, |
90 |
IWindow, SingletonWindow { |
|
89 |
IWindow, SingletonWindow { |
|
90 |
/** |
|
91 |
* |
|
92 |
*/ |
|
93 |
private static final long serialVersionUID = 7315293357719796556L; |
|
91 | 94 |
private JPanel jPanel = null; |
92 | 95 |
private JRadioButton[] btnsDocuments = null; |
93 | 96 |
private ButtonGroup grupo = new ButtonGroup(); |
... | ... | |
110 | 113 |
private JButton btnExportar = null; |
111 | 114 |
private JButton btnEditar = null; |
112 | 115 |
// The properties of the Project Manager window (size, position, etc): |
113 |
private WindowInfo m_viewInfo=null;
|
|
116 |
private WindowInfo m_viewInfo = null;
|
|
114 | 117 |
|
115 |
/** Proyecto representado en la vista */ |
|
116 |
private Project p; |
|
118 |
private Project project; |
|
117 | 119 |
|
118 | 120 |
private JScrollPane jScrollPane = null; |
119 | 121 |
private JPanel jPanel4 = null; |
... | ... | |
121 | 123 |
|
122 | 124 |
/** |
123 | 125 |
* This is the default constructor |
124 |
* |
|
125 |
* @param project Extension |
|
126 |
* |
|
127 |
* @param project |
|
128 |
* Extension |
|
126 | 129 |
*/ |
127 | 130 |
public ProjectWindow() { |
128 | 131 |
super(); |
... | ... | |
133 | 136 |
|
134 | 137 |
/** |
135 | 138 |
* Asigna el proyecto a la ventana |
136 |
* |
|
137 |
* @param p Proyecto con el que se operar? a trav?s de este di?logo |
|
139 |
* |
|
140 |
* @param project |
|
141 |
* Proyecto con el que se operar? a trav?s de este di?logo |
|
138 | 142 |
*/ |
139 |
public void setProject(Project p) { |
|
140 |
this.p = p;
|
|
141 |
p.addPropertyChangeListener(this); |
|
143 |
public void setProject(Project project) {
|
|
144 |
this.project = project;
|
|
145 |
project.addPropertyChangeListener(this);
|
|
142 | 146 |
refreshControls(); |
143 | 147 |
} |
144 | 148 |
|
145 | 149 |
/** |
146 |
* Activa los botones de la botonera del medio o los desactiva en funci?n |
|
147 |
* de que est? seleccionado o no un elemento de proyecto en la lista del |
|
148 |
* medio |
|
150 |
* Activa los botones de la botonera del medio o los desactiva en funci?n de |
|
151 |
* que est? seleccionado o no un elemento de proyecto en la lista del medio |
|
149 | 152 |
*/ |
150 | 153 |
private void activarBotones() { |
151 | 154 |
if (lstDocs.getSelectedIndex() != -1) { |
152 | 155 |
btnAbrir.setEnabled(true); |
153 | 156 |
btnBorrar.setEnabled(true); |
154 |
if (lstDocs.getSelectedIndices().length==1) {
|
|
157 |
if (lstDocs.getSelectedIndices().length == 1) {
|
|
155 | 158 |
btnRenombrar.setEnabled(true); |
156 | 159 |
btnPropiedades.setEnabled(true); |
157 |
}else { |
|
160 |
} else {
|
|
158 | 161 |
btnRenombrar.setEnabled(false); |
159 | 162 |
btnPropiedades.setEnabled(false); |
160 | 163 |
} |
... | ... | |
171 | 174 |
* seg?n la opci?n activada |
172 | 175 |
*/ |
173 | 176 |
private void refreshList() { |
174 |
if (p != null) { |
|
175 |
DefaultListModel model=null; |
|
176 |
String tituloMarco = PluginServices.getText(this, "documentos_existentes"); |
|
177 |
if (project != null) { |
|
178 |
DefaultListModel model = null; |
|
179 |
String tituloMarco = PluginServices.getText(this, |
|
180 |
"documentos_existentes"); |
|
177 | 181 |
|
178 |
String doc=getDocumentSelected();
|
|
179 |
model = new DefaultListModel(p.getDocumentsByType(doc));
|
|
180 |
tituloMarco=getDocumentSelectedName();
|
|
182 |
String doctype = getDocumentSelected();
|
|
183 |
model = new DefaultListModel(project.getDocuments(doctype));
|
|
184 |
tituloMarco = getDocumentSelectedName();
|
|
181 | 185 |
|
182 | 186 |
lstDocs.setModel(model); |
183 |
((TitledBorder)getJPanel1().getBorder()).setTitle(tituloMarco); |
|
187 |
((TitledBorder) getJPanel1().getBorder()).setTitle(tituloMarco);
|
|
184 | 188 |
getJPanel1().repaint(1); |
185 | 189 |
activarBotones(); |
186 | 190 |
} |
187 | 191 |
} |
192 |
|
|
188 | 193 |
/** |
189 |
* Devuelve el nombre del tipo de documento |
|
190 |
* activo (el mismo que ProjectDocumentFactory.getRegisterName)
|
|
191 |
* |
|
192 |
* |
|
194 |
* Devuelve el nombre del tipo de documento activo (el mismo que
|
|
195 |
* ProjectDocumentFactory.getRegisterName) |
|
196 |
*
|
|
197 |
*
|
|
193 | 198 |
* @return |
194 | 199 |
*/ |
195 | 200 |
|
196 | 201 |
public String getDocumentSelected() { |
197 |
JRadioButton btnSelected=null;
|
|
198 |
for (int i=0;i<btnsDocuments.length;i++) {
|
|
202 |
JRadioButton btnSelected = null;
|
|
203 |
for (int i = 0; i < btnsDocuments.length; i++) {
|
|
199 | 204 |
if (btnsDocuments[i].isSelected()) { |
200 |
btnSelected=btnsDocuments[i];
|
|
205 |
btnSelected = btnsDocuments[i];
|
|
201 | 206 |
return btnSelected.getName(); |
202 | 207 |
} |
203 | 208 |
} |
204 | 209 |
|
205 | 210 |
return null; |
206 | 211 |
} |
212 |
|
|
207 | 213 |
private String getDocumentSelectedName() { |
208 |
JRadioButton btnSelected=null;
|
|
209 |
for (int i=0;i<btnsDocuments.length;i++) {
|
|
214 |
JRadioButton btnSelected = null;
|
|
215 |
for (int i = 0; i < btnsDocuments.length; i++) {
|
|
210 | 216 |
if (btnsDocuments[i].isSelected()) { |
211 |
btnSelected=btnsDocuments[i];
|
|
217 |
btnSelected = btnsDocuments[i];
|
|
212 | 218 |
return btnSelected.getText(); |
213 | 219 |
} |
214 | 220 |
} |
215 | 221 |
|
216 | 222 |
return null; |
217 | 223 |
} |
224 |
|
|
218 | 225 |
/** |
219 | 226 |
* Refresca las etiquetas con la informaci?n del proyecto |
220 | 227 |
*/ |
221 | 228 |
private void refreshProperties() { |
222 |
if (p != null) { |
|
223 |
lblNombreSesion.setText(p.getName()); |
|
229 |
if (project != null) {
|
|
230 |
lblNombreSesion.setText(project.getName());
|
|
224 | 231 |
String path = ProjectExtension.getPath(); |
225 | 232 |
if (path != null) { |
226 | 233 |
File f = new File(path); |
... | ... | |
228 | 235 |
} else { |
229 | 236 |
lblGuardado.setText(""); |
230 | 237 |
} |
231 |
lblFecha.setText(p.getCreationDate()); |
|
238 |
lblFecha.setText(project.getCreationDate());
|
|
232 | 239 |
} |
233 | 240 |
} |
234 | 241 |
|
... | ... | |
254 | 261 |
c.fill = GridBagConstraints.HORIZONTAL; |
255 | 262 |
c.weightx = 1.0; |
256 | 263 |
c.weighty = 0; |
257 |
c.gridy=0;
|
|
264 |
c.gridy = 0;
|
|
258 | 265 |
c.insets = new Insets(2, 5, 2, 5); |
259 | 266 |
|
260 |
layout.setConstraints(getJPanel(),c); |
|
267 |
layout.setConstraints(getJPanel(), c);
|
|
261 | 268 |
add(getJPanel(), null); |
262 | 269 |
|
263 | 270 |
c.fill = GridBagConstraints.BOTH; |
264 |
c.gridy=1;
|
|
271 |
c.gridy = 1;
|
|
265 | 272 |
c.weightx = 1.0; |
266 | 273 |
c.weighty = 1.0; |
267 |
layout.setConstraints(getJPanel1(),c); |
|
274 |
layout.setConstraints(getJPanel1(), c);
|
|
268 | 275 |
add(getJPanel1(), null); |
269 | 276 |
c.fill = GridBagConstraints.HORIZONTAL; |
270 | 277 |
c.weightx = 0; |
271 | 278 |
c.weighty = 0; |
272 |
c.gridy=2;
|
|
273 |
layout.setConstraints(getJPanel3(),c); |
|
279 |
c.gridy = 2;
|
|
280 |
layout.setConstraints(getJPanel3(), c);
|
|
274 | 281 |
add(getJPanel3(), null); |
275 | 282 |
|
276 | 283 |
this.setSize(430, 544); |
277 | 284 |
this.setPreferredSize(new java.awt.Dimension(430, 554)); |
278 | 285 |
this.setMinimumSize(new java.awt.Dimension(430, 554)); |
279 | 286 |
this.add(getJScrollPane1(), gridBagConstraints); |
280 |
for (int i=0;i<btnsDocuments.length;i++) {
|
|
287 |
for (int i = 0; i < btnsDocuments.length; i++) {
|
|
281 | 288 |
grupo.add(btnsDocuments[i]); |
282 | 289 |
} |
283 |
if (btnsDocuments.length>0) {
|
|
290 |
if (btnsDocuments.length > 0) {
|
|
284 | 291 |
btnsDocuments[0].setSelected(true); |
285 | 292 |
} |
286 | 293 |
} |
287 |
private ProjectDocument createDocument(String s) { |
|
288 | 294 |
|
289 |
|
|
290 |
Iterator<Extension> iterator = ToolsLocator.getExtensionPointManager() |
|
291 |
.get("Documents").iterator(); |
|
292 |
while (iterator.hasNext()) { |
|
293 |
try { |
|
294 |
ProjectDocumentFactory documentFactory = (ProjectDocumentFactory)iterator.next().create(); |
|
295 |
if (documentFactory.getRegisterName().equals(s)) { |
|
296 |
ProjectDocument document=documentFactory.createFromGUI(p); |
|
297 |
if (document == null) { |
|
298 |
return null; |
|
299 |
} |
|
300 |
document.setProjectDocumentFactory(documentFactory); |
|
301 |
p.setModified(true); |
|
302 |
return document; |
|
303 |
} |
|
304 |
} catch (Exception e) { |
|
305 |
NotificationManager.addError(e); |
|
295 |
private Document createDocumentInProject(String doctype) { |
|
296 |
try { |
|
297 |
Document document = ProjectManager.getInstance() |
|
298 |
.createDocumentByUser(doctype); |
|
299 |
if (document == null) { |
|
300 |
return null; |
|
306 | 301 |
} |
302 |
project.add(document); |
|
303 |
lstDocs.setSelectedIndex( ((DefaultListModel)lstDocs.getModel()).indexOf(document) ); |
|
304 |
return document; |
|
305 |
} catch (Exception e) { |
|
306 |
NotificationManager.addError(e); |
|
307 | 307 |
} |
308 | 308 |
return null; |
309 | 309 |
} |
310 |
|
|
310 | 311 |
/** |
311 | 312 |
* Crea un nuevo project element |
312 |
* |
|
313 |
* @throws Exception DOCUMENT ME! |
|
313 |
* |
|
314 |
* @throws Exception |
|
315 |
* DOCUMENT ME! |
|
314 | 316 |
*/ |
315 | 317 |
private void newProjectDocument() throws Exception { |
316 |
String s=getDocumentSelected(); |
|
317 |
ProjectDocument doc=createDocument(s); |
|
318 |
if (doc!=null) { |
|
319 |
p.addDocument(doc); |
|
320 |
p.setModified(true); |
|
321 |
} |
|
318 |
String doctype = getDocumentSelected(); |
|
319 |
createDocumentInProject(doctype); |
|
322 | 320 |
} |
323 | 321 |
|
324 | 322 |
/** |
325 |
* Abre la ventana de un nuevo project element
|
|
323 |
* Abre la ventana de un nuevo documento
|
|
326 | 324 |
*/ |
327 | 325 |
private void abrir() { |
328 | 326 |
int[] indexes = lstDocs.getSelectedIndices(); |
329 |
for (int i=indexes.length-1;i>=0;i--) {
|
|
330 |
int index=indexes[i];
|
|
327 |
for (int i = indexes.length - 1; i >= 0; i--) {
|
|
328 |
int index = indexes[i];
|
|
331 | 329 |
if (index == -1) { |
332 | 330 |
return; |
333 | 331 |
} |
334 |
String s=getDocumentSelected(); |
|
335 |
ArrayList<ProjectDocument> documents = p.getDocumentsByType(s); |
|
336 |
ProjectDocument doc=documents.get(index); |
|
337 |
IWindow window=doc.createWindow(); |
|
338 |
if (window == null){ |
|
339 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "error_opening_the_document")); |
|
332 |
String doctype = getDocumentSelected(); |
|
333 |
List<Document> documents = project.getDocuments(doctype); |
|
334 |
Document doc = documents.get(index); |
|
335 |
IWindow window = doc.getFactory().getMainWindow(doc); |
|
336 |
if (window == null) { |
|
337 |
JOptionPane.showMessageDialog((Component) PluginServices |
|
338 |
.getMainFrame(), PluginServices.getText(this, |
|
339 |
"error_opening_the_document")); |
|
340 | 340 |
return; |
341 | 341 |
} |
342 | 342 |
PluginServices.getMDIManager().addWindow(window); |
343 | 343 |
} |
344 |
p.setModified(true); |
|
344 |
project.setModified(true);
|
|
345 | 345 |
} |
346 | 346 |
|
347 | 347 |
/** |
... | ... | |
353 | 353 |
if (index == -1) { |
354 | 354 |
return; |
355 | 355 |
} |
356 |
String s=getDocumentSelected();
|
|
357 |
ArrayList<ProjectDocument> documents = p.getDocumentsByType(s);
|
|
358 |
ProjectDocument doc=documents.get(index);
|
|
356 |
String doctype = getDocumentSelected();
|
|
357 |
List<Document> documents = project.getDocuments(doctype);
|
|
358 |
Document doc = documents.get(index);
|
|
359 | 359 |
|
360 | 360 |
if (doc.isLocked()) { |
361 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_renamed")); |
|
361 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, |
|
362 |
"locked_element_it_cannot_be_renamed")); |
|
362 | 363 |
return; |
363 | 364 |
} |
364 | 365 |
|
... | ... | |
367 | 368 |
pane.setMessageType(JOptionPane.QUESTION_MESSAGE); |
368 | 369 |
pane.setWantsInput(true); |
369 | 370 |
pane.setInitialSelectionValue(doc.getName()); |
370 |
pane.setInputValue(doc.getName());
|
|
371 |
JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(),
|
|
372 |
PluginServices.getText(this, "renombrar")); |
|
371 |
pane.setInputValue(doc.getName());
|
|
372 |
JDialog dlg = pane.createDialog((Component) PluginServices |
|
373 |
.getMainFrame(), PluginServices.getText(this, "renombrar"));
|
|
373 | 374 |
dlg.setModal(true); |
374 |
dlg.show();
|
|
375 |
dlg.setVisible(true);
|
|
375 | 376 |
|
376 | 377 |
String nuevoNombre = pane.getInputValue().toString().trim(); |
377 | 378 |
|
... | ... | |
383 | 384 |
return; |
384 | 385 |
} |
385 | 386 |
|
386 |
for (int i=0; i<lstDocs.getModel().getSize(); i++){
|
|
387 |
if (i==index) {
|
|
387 |
for (int i = 0; i < lstDocs.getModel().getSize(); i++) {
|
|
388 |
if (i == index) {
|
|
388 | 389 |
continue; |
389 | 390 |
} |
390 |
if (((ProjectDocument)lstDocs.getModel().getElementAt(i)).getName().equals(nuevoNombre)){ |
|
391 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "elemento_ya_existe")); |
|
391 |
if (((AbstractDocument) lstDocs.getModel().getElementAt(i)) |
|
392 |
.getName().equals(nuevoNombre)) { |
|
393 |
JOptionPane.showMessageDialog((Component) PluginServices |
|
394 |
.getMainFrame(), PluginServices.getText(this, |
|
395 |
"elemento_ya_existe")); |
|
392 | 396 |
return; |
393 | 397 |
} |
394 | 398 |
|
... | ... | |
396 | 400 |
doc.setName(nuevoNombre); |
397 | 401 |
|
398 | 402 |
refreshList(); |
399 |
p.setModified(true); |
|
403 |
project.setModified(true);
|
|
400 | 404 |
} |
401 | 405 |
|
402 | 406 |
/** |
403 | 407 |
* Borra un project element |
404 | 408 |
*/ |
405 | 409 |
private void borrar() { |
406 |
int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(),
|
|
407 |
PluginServices.getText(this, "confirmar_borrar"),
|
|
408 |
PluginServices.getText(this, "borrar"), |
|
410 |
int res = JOptionPane.showConfirmDialog((Component) PluginServices |
|
411 |
.getMainFrame(), PluginServices.getText(this,
|
|
412 |
"confirmar_borrar"), PluginServices.getText(this, "borrar"),
|
|
409 | 413 |
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); |
410 | 414 |
|
415 |
int lastremoved = 0; |
|
411 | 416 |
if (res == JOptionPane.YES_OPTION) { |
412 | 417 |
int[] indexes = lstDocs.getSelectedIndices(); |
413 |
for (int i=indexes.length-1;i>=0;i--) {
|
|
414 |
int index=indexes[i];
|
|
415 |
String s=getDocumentSelected();
|
|
416 |
ArrayList documents=p.getDocumentsByType(s);
|
|
417 |
ProjectDocument doc=(ProjectDocument)documents.get(index);
|
|
418 |
for (int i = indexes.length - 1; i >= 0; i--) {
|
|
419 |
int index = indexes[i];
|
|
420 |
String s = getDocumentSelected();
|
|
421 |
List<Document> documents = project.getDocuments(s);
|
|
422 |
Document doc = (AbstractDocument) documents.get(index);
|
|
418 | 423 |
if (doc.isLocked()) { |
419 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
|
424 |
JOptionPane.showMessageDialog(this, PluginServices.getText( |
|
425 |
this, "locked_element_it_cannot_be_deleted")); |
|
420 | 426 |
return; |
421 | 427 |
} |
422 | 428 |
PluginServices.getMDIManager().closeSingletonWindow(doc); |
423 |
p.delDocument(doc); |
|
429 |
project.remove(doc); |
|
430 |
lastremoved = index; |
|
424 | 431 |
} |
432 |
if( lastremoved > lstDocs.getModel().getSize() ) { |
|
433 |
lastremoved = lstDocs.getModel().getSize(); |
|
434 |
} |
|
435 |
if( lastremoved > 0 ) { |
|
436 |
lstDocs.setSelectedIndex(lastremoved); |
|
437 |
} |
|
425 | 438 |
refreshList(); |
426 |
p.setModified(true); |
|
439 |
project.setModified(true);
|
|
427 | 440 |
} |
428 | 441 |
} |
429 | 442 |
|
... | ... | |
438 | 451 |
} |
439 | 452 |
|
440 | 453 |
IWindow dlg = null; |
441 |
String s=getDocumentSelected();
|
|
442 |
ArrayList documents=p.getDocumentsByType(s);
|
|
443 |
ProjectDocument doc=(ProjectDocument) documents.get(index);
|
|
454 |
String doctype = getDocumentSelected();
|
|
455 |
List<Document> documents = project.getDocuments(doctype);
|
|
456 |
Document doc = (AbstractDocument) documents.get(index);
|
|
444 | 457 |
if (doc.isLocked()) { |
445 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
|
458 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, |
|
459 |
"locked_element")); |
|
446 | 460 |
return; |
447 | 461 |
} |
448 |
dlg=doc.getProperties();
|
|
462 |
dlg = doc.getFactory().getPropertiesWindow(doc);
|
|
449 | 463 |
PluginServices.getMDIManager().addWindow(dlg); |
450 | 464 |
|
451 | 465 |
refreshControls(); |
452 | 466 |
lstDocs.setSelectedIndex(index); |
453 |
p.setModified(true); |
|
467 |
project.setModified(true);
|
|
454 | 468 |
} |
455 | 469 |
|
456 | 470 |
/** |
457 | 471 |
* This method initializes jPanel |
458 |
* |
|
472 |
*
|
|
459 | 473 |
* @return JPanel |
460 | 474 |
*/ |
461 | 475 |
private JPanel getJPanel() { |
... | ... | |
465 | 479 |
java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout(); |
466 | 480 |
layFlowLayout1.setHgap(15); |
467 | 481 |
jPanel.setLayout(layFlowLayout1); |
468 |
JRadioButton[] btns=getBtnDocuments();
|
|
469 |
for (int i=0;i<btns.length;i++) {
|
|
470 |
jPanel.add(btns[i],null); |
|
482 |
JRadioButton[] btns = getBtnDocuments();
|
|
483 |
for (int i = 0; i < btns.length; i++) {
|
|
484 |
jPanel.add(btns[i], null);
|
|
471 | 485 |
} |
472 | 486 |
jPanel.setName("tipoDocPanel"); |
473 |
//jPanel.setPreferredSize(new java.awt.Dimension(700, 200)); |
|
474 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
|
475 |
null, PluginServices.getText(this, "tipos_de_documentos"),
|
|
487 |
// jPanel.setPreferredSize(new java.awt.Dimension(700, 200));
|
|
488 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
|
|
489 |
PluginServices.getText(this, "tipos_de_documentos"), |
|
476 | 490 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
477 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
491 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, |
|
492 |
null)); |
|
478 | 493 |
} |
479 | 494 |
|
480 | 495 |
return jPanel; |
... | ... | |
482 | 497 |
|
483 | 498 |
/** |
484 | 499 |
* This method initializes btnVistas |
485 |
* |
|
500 |
*
|
|
486 | 501 |
* @return JRadioButton |
487 | 502 |
*/ |
488 | 503 |
private JRadioButton[] getBtnDocuments() { |
489 | 504 |
if (btnsDocuments == null) { |
490 | 505 |
|
491 |
ArrayList<JRadioButton> btns=new ArrayList<JRadioButton>(); |
|
492 |
ArrayList<Integer> priorities=new ArrayList<Integer>(); |
|
493 |
Iterator<Extension> iterator = ToolsLocator |
|
494 |
.getExtensionPointManager().get( |
|
495 |
"Documents").iterator(); |
|
496 |
ProjectDocumentFactory documentFactory; |
|
497 |
while (iterator.hasNext()) { |
|
498 |
try { |
|
499 |
documentFactory = (ProjectDocumentFactory) iterator |
|
500 |
.next().create(); |
|
501 |
JRadioButton rb=new JRadioButton(); |
|
506 |
List<JRadioButton> btns = new ArrayList<JRadioButton>(); |
|
507 |
List<DocumentManager> factories = ProjectManager.getInstance() |
|
508 |
.getDocumentManager(); |
|
509 |
Collections.sort(factories, new Comparator<DocumentManager>() { |
|
510 |
public int compare(DocumentManager arg0, DocumentManager arg1) { |
|
511 |
return arg0.getPriority() - arg1.getPriority(); |
|
512 |
} |
|
502 | 513 |
|
503 |
rb.setIcon(documentFactory.getButtonIcon()); |
|
504 |
rb.setSelectedIcon(documentFactory.getSelectedButtonIcon()); |
|
505 |
rb.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
|
506 |
rb.setText(documentFactory.getNameType()); |
|
507 |
rb.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
|
508 |
rb.setName(documentFactory.getRegisterName()); |
|
509 |
rb.addChangeListener(new javax.swing.event.ChangeListener() { |
|
510 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
|
511 |
refreshList(); |
|
512 |
} |
|
513 |
}); |
|
514 |
// place in the right order according to list priority |
|
515 |
int priority = documentFactory.getListPriority(); |
|
516 |
int pos; |
|
517 |
for (pos=0; pos<btns.size(); pos++) { |
|
518 |
if (priorities.get(pos).intValue() > priority) { |
|
519 |
priorities.add(pos, new Integer(priority)); |
|
520 |
btns.add(pos, rb); |
|
521 |
break; |
|
522 |
} |
|
514 |
}); |
|
515 |
for (DocumentManager documentFactory : factories) { |
|
516 |
JRadioButton rb = new JRadioButton(); |
|
517 |
|
|
518 |
rb.setIcon(documentFactory.getIcon()); |
|
519 |
rb.setSelectedIcon(documentFactory.getIconSelected()); |
|
520 |
rb.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
|
521 |
rb.setText(documentFactory.getTitle()); |
|
522 |
rb.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
|
523 |
rb.setName(documentFactory.getTypeName()); |
|
524 |
rb.addChangeListener(new javax.swing.event.ChangeListener() { |
|
525 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
|
526 |
refreshList(); |
|
523 | 527 |
} |
524 |
if (pos >= btns.size()) { |
|
525 |
priorities.add(new Integer(priority)); |
|
526 |
btns.add(rb); |
|
527 |
} |
|
528 |
|
|
529 |
} catch (InstantiationException e) { |
|
530 |
e.printStackTrace(); |
|
531 |
} catch (IllegalAccessException e) { |
|
532 |
e.printStackTrace(); |
|
533 |
} catch (ClassCastException e) { |
|
534 |
e.printStackTrace(); |
|
535 |
} |
|
528 |
}); |
|
529 |
btns.add(rb); |
|
536 | 530 |
} |
537 |
|
|
538 |
|
|
539 |
btnsDocuments=btns.toArray(new JRadioButton[0]); |
|
540 |
|
|
531 |
btnsDocuments = btns.toArray(new JRadioButton[0]); |
|
541 | 532 |
} |
542 |
|
|
543 | 533 |
return btnsDocuments; |
544 | 534 |
} |
545 | 535 |
|
546 | 536 |
/** |
547 | 537 |
* This method initializes jPanel1 |
548 |
* |
|
538 |
*
|
|
549 | 539 |
* @return JPanel |
550 | 540 |
*/ |
551 | 541 |
private JPanel getJPanel1() { |
... | ... | |
559 | 549 |
c.insets = new Insets(2, 5, 2, 5); |
560 | 550 |
c.anchor = GridBagConstraints.WEST; |
561 | 551 |
c.fill = GridBagConstraints.BOTH; |
562 |
c.weightx= 1.0; |
|
552 |
c.weightx = 1.0;
|
|
563 | 553 |
c.weighty = 1.0; |
564 |
layout2.setConstraints(getJScrollPane(),c); |
|
554 |
layout2.setConstraints(getJScrollPane(), c);
|
|
565 | 555 |
jPanel1.add(getJScrollPane()); |
566 | 556 |
|
567 | 557 |
c.anchor = GridBagConstraints.EAST; |
568 | 558 |
|
569 |
|
|
570 | 559 |
c.fill = GridBagConstraints.NONE; |
571 |
c.weightx= 0; |
|
560 |
c.weightx = 0;
|
|
572 | 561 |
c.weighty = 0; |
573 |
layout2.setConstraints(getJPanel2(),c); |
|
562 |
layout2.setConstraints(getJPanel2(), c);
|
|
574 | 563 |
jPanel1.add(getJPanel2()); |
575 | 564 |
|
576 |
//jPanel1.setPreferredSize(new java.awt.Dimension(430,170)); |
|
577 |
jPanel1.setMinimumSize(new java.awt.Dimension(430,170)); |
|
565 |
// jPanel1.setPreferredSize(new java.awt.Dimension(430,170));
|
|
566 |
jPanel1.setMinimumSize(new java.awt.Dimension(430, 170));
|
|
578 | 567 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
579 | 568 |
null, |
580 | 569 |
PluginServices.getText(this, "documentos_existentes"), |
581 | 570 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
582 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
571 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, |
|
572 |
null)); |
|
583 | 573 |
} |
584 | 574 |
|
585 | 575 |
return jPanel1; |
... | ... | |
587 | 577 |
|
588 | 578 |
/** |
589 | 579 |
* This method initializes lstDocs |
590 |
* |
|
580 |
*
|
|
591 | 581 |
* @return JList |
592 | 582 |
*/ |
593 | 583 |
private JList getLstDocs() { |
594 | 584 |
if (lstDocs == null) { |
595 | 585 |
lstDocs = new JList(); |
596 | 586 |
lstDocs.addMouseListener(new java.awt.event.MouseAdapter() { |
597 |
public ProjectDocument[] getSelecteds() { |
|
598 |
if (lstDocs.getSelectedIndex() < 0) { |
|
599 |
return new ProjectDocument[0]; |
|
600 |
} |
|
601 |
Object[] seleteds = lstDocs.getSelectedValues(); |
|
602 |
ProjectDocument[] returnValue = new ProjectDocument[seleteds.length]; |
|
603 |
System.arraycopy(seleteds,0,returnValue,0,seleteds.length); |
|
604 |
return returnValue; |
|
587 |
public AbstractDocument[] getSelecteds() { |
|
588 |
if (lstDocs.getSelectedIndex() < 0) { |
|
589 |
return new AbstractDocument[0]; |
|
605 | 590 |
} |
591 |
Object[] seleteds = lstDocs.getSelectedValues(); |
|
592 |
AbstractDocument[] returnValue = new AbstractDocument[seleteds.length]; |
|
593 |
System.arraycopy(seleteds, 0, returnValue, 0, |
|
594 |
seleteds.length); |
|
595 |
return returnValue; |
|
596 |
} |
|
606 | 597 |
|
607 |
public ProjectDocument getItem(java.awt.event.MouseEvent e) { |
|
608 |
if (lstDocs.getSelectedIndex() < 0) { |
|
609 |
return null; |
|
610 |
} |
|
611 |
Component c = lstDocs.getComponentAt(e.getPoint()); |
|
612 |
|
|
598 |
public AbstractDocument getItem(java.awt.event.MouseEvent e) { |
|
599 |
if (lstDocs.getSelectedIndex() < 0) { |
|
613 | 600 |
return null; |
614 | 601 |
} |
602 |
// Component c = lstDocs.getComponentAt(e.getPoint()); |
|
615 | 603 |
|
616 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
|
617 |
if (e.getButton() == java.awt.event.MouseEvent.BUTTON3) { |
|
618 |
/* |
|
619 |
getDocumentSelected();//ProjectView |
|
620 |
getDocumentSelectedName();//Vista |
|
621 |
*/ |
|
622 |
String docType = getDocumentSelected(); |
|
623 |
ProjectDocument[] selecteds = this.getSelecteds(); |
|
604 |
return null; |
|
605 |
} |
|
624 | 606 |
|
625 |
if (selecteds == null) { |
|
626 |
return; |
|
627 |
} |
|
628 |
DocumentContextMenu menu = new DocumentContextMenu(docType,this.getItem(e),selecteds); |
|
629 |
if (menu.getActionsVisibles() < 1) { |
|
630 |
return; |
|
631 |
} |
|
632 |
lstDocs.add(menu); |
|
633 |
menu.show(e.getComponent(), e.getX(), e.getY()); |
|
607 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
|
608 |
if (e.getButton() == java.awt.event.MouseEvent.BUTTON3) { |
|
609 |
/* |
|
610 |
* getDocumentSelected();//ProjectView |
|
611 |
* getDocumentSelectedName();//Vista |
|
612 |
*/ |
|
613 |
String docType = getDocumentSelected(); |
|
614 |
AbstractDocument[] selecteds = this.getSelecteds(); |
|
615 |
|
|
616 |
if (selecteds == null) { |
|
634 | 617 |
return; |
635 | 618 |
} |
636 |
|
|
637 |
if (e.getClickCount() == 2) { |
|
638 |
abrir(); |
|
619 |
DocumentContextMenu menu = new DocumentContextMenu( |
|
620 |
docType, this.getItem(e), selecteds); |
|
621 |
if (!menu.hasActions()) { |
|
622 |
return; |
|
639 | 623 |
} |
624 |
lstDocs.add(menu); |
|
625 |
menu.show(e.getComponent(), e.getX(), e.getY()); |
|
626 |
return; |
|
627 |
} |
|
640 | 628 |
|
629 |
if (e.getClickCount() == 2) { |
|
630 |
abrir(); |
|
641 | 631 |
} |
642 |
}); |
|
643 |
lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
644 |
public void valueChanged( |
|
645 |
javax.swing.event.ListSelectionEvent e) { |
|
646 |
activarBotones(); |
|
647 |
} |
|
648 |
}); |
|
632 |
|
|
633 |
} |
|
634 |
}); |
|
635 |
lstDocs |
|
636 |
.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
637 |
public void valueChanged( |
|
638 |
javax.swing.event.ListSelectionEvent e) { |
|
639 |
activarBotones(); |
|
640 |
} |
|
641 |
}); |
|
649 | 642 |
} |
650 | 643 |
|
651 | 644 |
return lstDocs; |
... | ... | |
653 | 646 |
|
654 | 647 |
/** |
655 | 648 |
* This method initializes jPanel2 |
656 |
* |
|
649 |
*
|
|
657 | 650 |
* @return JPanel |
658 | 651 |
*/ |
659 | 652 |
private JPanel getJPanel2() { |
660 | 653 |
if (jPanel2 == null) { |
661 | 654 |
jPanel2 = new JPanel(); |
662 | 655 |
|
663 |
//FlowLayout layout = new FlowLayout(); |
|
664 |
GridLayout layout = new GridLayout(5,1); |
|
656 |
// FlowLayout layout = new FlowLayout();
|
|
657 |
GridLayout layout = new GridLayout(5, 1);
|
|
665 | 658 |
layout.setVgap(7); |
666 | 659 |
|
667 | 660 |
jPanel2.setLayout(layout); |
... | ... | |
680 | 673 |
|
681 | 674 |
/** |
682 | 675 |
* This method initializes btnNuevo |
683 |
* |
|
676 |
*
|
|
684 | 677 |
* @return JButton |
685 | 678 |
*/ |
686 | 679 |
private JButton getBtnNuevo() { |
... | ... | |
690 | 683 |
btnNuevo.setText(PluginServices.getText(this, "nuevo")); |
691 | 684 |
btnNuevo.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
692 | 685 |
btnNuevo.addActionListener(new java.awt.event.ActionListener() { |
693 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
694 |
try {
|
|
695 |
newProjectDocument();
|
|
696 |
} catch (Exception e1) {
|
|
697 |
NotificationManager.addError(e1.getLocalizedMessage(),
|
|
686 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
687 |
try { |
|
688 |
newProjectDocument(); |
|
689 |
} catch (Exception e1) { |
|
690 |
NotificationManager.addError(e1.getLocalizedMessage(), |
|
698 | 691 |
e1); |
699 |
} |
|
700 | 692 |
} |
701 |
}); |
|
693 |
} |
|
694 |
}); |
|
702 | 695 |
} |
703 | 696 |
|
704 | 697 |
return btnNuevo; |
... | ... | |
706 | 699 |
|
707 | 700 |
/** |
708 | 701 |
* This method initializes btnPropiedades |
709 |
* |
|
702 |
*
|
|
710 | 703 |
* @return JButton |
711 | 704 |
*/ |
712 | 705 |
private JButton getBtnPropiedades() { |
... | ... | |
716 | 709 |
btnPropiedades.setName("btnPropiedades"); |
717 | 710 |
btnPropiedades.setEnabled(false); |
718 | 711 |
btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
719 |
btnPropiedades.addActionListener(new java.awt.event.ActionListener() { |
|
720 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
721 |
propiedades(); |
|
722 |
} |
|
723 |
}); |
|
712 |
btnPropiedades |
|
713 |
.addActionListener(new java.awt.event.ActionListener() { |
|
714 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
715 |
propiedades(); |
|
716 |
} |
|
717 |
}); |
|
724 | 718 |
} |
725 | 719 |
|
726 | 720 |
return btnPropiedades; |
... | ... | |
728 | 722 |
|
729 | 723 |
/** |
730 | 724 |
* This method initializes btnAbrir |
731 |
* |
|
725 |
*
|
|
732 | 726 |
* @return JButton |
733 | 727 |
*/ |
734 | 728 |
private JButton getBtnAbrir() { |
... | ... | |
739 | 733 |
btnAbrir.setEnabled(false); |
740 | 734 |
btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
741 | 735 |
btnAbrir.addActionListener(new java.awt.event.ActionListener() { |
742 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
743 |
abrir();
|
|
744 |
}
|
|
745 |
});
|
|
736 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
737 |
abrir(); |
|
738 |
} |
|
739 |
}); |
|
746 | 740 |
} |
747 | 741 |
|
748 | 742 |
return btnAbrir; |
... | ... | |
750 | 744 |
|
751 | 745 |
/** |
752 | 746 |
* This method initializes btnBorrar |
753 |
* |
|
747 |
*
|
|
754 | 748 |
* @return JButton |
755 | 749 |
*/ |
756 | 750 |
private JButton getBtnBorrar() { |
... | ... | |
761 | 755 |
btnBorrar.setEnabled(false); |
762 | 756 |
btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
763 | 757 |
btnBorrar.addActionListener(new java.awt.event.ActionListener() { |
764 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
765 |
borrar();
|
|
766 |
}
|
|
767 |
});
|
|
758 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
759 |
borrar(); |
|
760 |
} |
|
761 |
}); |
|
768 | 762 |
} |
769 | 763 |
|
770 | 764 |
return btnBorrar; |
... | ... | |
772 | 766 |
|
773 | 767 |
/** |
774 | 768 |
* This method initializes btnRenombrar |
775 |
* |
|
769 |
*
|
|
776 | 770 |
* @return JButton |
777 | 771 |
*/ |
778 | 772 |
private JButton getBtnRenombrar() { |
... | ... | |
783 | 777 |
btnRenombrar.setEnabled(false); |
784 | 778 |
btnRenombrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
785 | 779 |
btnRenombrar.addActionListener(new java.awt.event.ActionListener() { |
786 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
787 |
renombrar();
|
|
788 |
}
|
|
789 |
});
|
|
780 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
781 |
renombrar(); |
|
782 |
} |
|
783 |
}); |
|
790 | 784 |
} |
791 | 785 |
|
792 | 786 |
return btnRenombrar; |
... | ... | |
794 | 788 |
|
795 | 789 |
/** |
796 | 790 |
* This method initializes jPanel3 |
797 |
* |
|
791 |
*
|
|
798 | 792 |
* @return JPanel |
799 | 793 |
*/ |
800 | 794 |
private JPanel getJPanel3() { |
... | ... | |
806 | 800 |
jPanel3.setLayout(layout3); |
807 | 801 |
c.insets = new Insets(2, 5, 0, 5); |
808 | 802 |
c.anchor = GridBagConstraints.WEST; |
809 |
c.gridx =0; |
|
810 |
c.gridy =0; |
|
811 |
layout3.setConstraints(getJLabel(),c); |
|
803 |
c.gridx = 0;
|
|
804 |
c.gridy = 0;
|
|
805 |
layout3.setConstraints(getJLabel(), c);
|
|
812 | 806 |
jPanel3.add(getJLabel(), null); |
813 | 807 |
c.fill = GridBagConstraints.HORIZONTAL; |
814 |
c.weightx=1.0;
|
|
815 |
c.gridx =1; |
|
816 |
layout3.setConstraints(getLblNombreSesion(),c); |
|
808 |
c.weightx = 1.0;
|
|
809 |
c.gridx = 1;
|
|
810 |
layout3.setConstraints(getLblNombreSesion(), c);
|
|
817 | 811 |
jPanel3.add(getLblNombreSesion(), null); |
818 | 812 |
|
819 |
c.gridx =0; |
|
820 |
c.gridy =1; |
|
813 |
c.gridx = 0;
|
|
814 |
c.gridy = 1;
|
|
821 | 815 |
c.fill = GridBagConstraints.NONE; |
822 |
c.weightx=0.0;
|
|
823 |
layout3.setConstraints(getJLabel1(),c); |
|
816 |
c.weightx = 0.0;
|
|
817 |
layout3.setConstraints(getJLabel1(), c);
|
|
824 | 818 |
jPanel3.add(getJLabel1(), null); |
825 | 819 |
c.fill = GridBagConstraints.HORIZONTAL; |
826 |
c.weightx=1.0;
|
|
827 |
c.gridx =1; |
|
828 |
layout3.setConstraints(getLblGuardado(),c); |
|
820 |
c.weightx = 1.0;
|
|
821 |
c.gridx = 1;
|
|
822 |
layout3.setConstraints(getLblGuardado(), c);
|
|
829 | 823 |
jPanel3.add(getLblGuardado(), null); |
830 | 824 |
|
831 |
c.gridx =0; |
|
832 |
c.gridy =2; |
|
825 |
c.gridx = 0;
|
|
826 |
c.gridy = 2;
|
|
833 | 827 |
c.fill = GridBagConstraints.NONE; |
834 |
c.weightx=0.0;
|
|
835 |
layout3.setConstraints(getJLabel2(),c); |
|
828 |
c.weightx = 0.0;
|
|
829 |
layout3.setConstraints(getJLabel2(), c);
|
|
836 | 830 |
jPanel3.add(getJLabel2(), null); |
837 | 831 |
|
838 | 832 |
c.fill = GridBagConstraints.HORIZONTAL; |
839 |
c.weightx=1.0;
|
|
840 |
c.gridx =1; |
|
841 |
layout3.setConstraints(getLblFecha(),c); |
|
833 |
c.weightx = 1.0;
|
|
834 |
c.gridx = 1;
|
|
835 |
layout3.setConstraints(getLblFecha(), c);
|
|
842 | 836 |
jPanel3.add(getLblFecha(), null); |
843 | 837 |
jPanel3.setPreferredSize(new java.awt.Dimension(430, 125)); |
844 | 838 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
845 | 839 |
null, PluginServices.getText(this, "propiedades_sesion"), |
846 | 840 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
847 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
848 |
c.gridx =1; |
|
849 |
c.gridy =4; |
|
841 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, |
|
842 |
null)); |
|
843 |
c.gridx = 1; |
|
844 |
c.gridy = 4; |
|
850 | 845 |
c.anchor = GridBagConstraints.EAST; |
851 |
layout3.setConstraints(getJPanel4(),c); |
|
846 |
layout3.setConstraints(getJPanel4(), c);
|
|
852 | 847 |
jPanel3.add(getJPanel4(), null); |
853 | 848 |
} |
854 | 849 |
|
... | ... | |
857 | 852 |
|
858 | 853 |
/** |
859 | 854 |
* This method initializes jLabel |
860 |
* |
|
855 |
*
|
|
861 | 856 |
* @return JLabel |
862 | 857 |
*/ |
863 | 858 |
private JLabel getJLabel() { |
... | ... | |
872 | 867 |
|
873 | 868 |
/** |
874 | 869 |
* This method initializes lblNombreSesion |
875 |
* |
|
870 |
*
|
|
876 | 871 |
* @return JLabel |
877 | 872 |
*/ |
878 | 873 |
private JLabel getLblNombreSesion() { |
... | ... | |
889 | 884 |
|
890 | 885 |
/** |
891 | 886 |
* This method initializes jLabel1 |
892 |
* |
|
887 |
*
|
|
893 | 888 |
* @return JLabel |
894 | 889 |
*/ |
895 | 890 |
private JLabel getJLabel1() { |
... | ... | |
904 | 899 |
|
905 | 900 |
/** |
906 | 901 |
* This method initializes lblGuardado |
907 |
* |
|
902 |
*
|
|
908 | 903 |
* @return JLabel |
909 | 904 |
*/ |
910 | 905 |
private JLabel getLblGuardado() { |
... | ... | |
920 | 915 |
|
921 | 916 |
/** |
922 | 917 |
* This method initializes jLabel2 |
923 |
* |
|
918 |
*
|
|
924 | 919 |
* @return JLabel |
925 | 920 |
*/ |
926 | 921 |
private JLabel getJLabel2() { |
927 | 922 |
if (jLabel2 == null) { |
928 | 923 |
jLabel2 = new JLabel(); |
929 |
jLabel2.setText(PluginServices.getText(this, "creation_date") + |
|
930 |
":"); |
|
924 |
jLabel2 |
|
925 |
.setText(PluginServices.getText(this, "creation_date") |
|
926 |
+ ":"); |
|
931 | 927 |
jLabel2.setPreferredSize(new java.awt.Dimension(150, 16)); |
932 | 928 |
} |
933 | 929 |
|
... | ... | |
936 | 932 |
|
937 | 933 |
/** |
938 | 934 |
* This method initializes lblFecha |
939 |
* |
|
935 |
*
|
|
940 | 936 |
* @return JLabel |
941 | 937 |
*/ |
942 | 938 |
private JLabel getLblFecha() { |
... | ... | |
952 | 948 |
|
953 | 949 |
/** |
954 | 950 |
* This method initializes btnImportar |
955 |
* |
|
951 |
*
|
|
956 | 952 |
* @return JButton |
957 | 953 |
*/ |
958 | 954 |
private JButton getBtnImportar() { |
... | ... | |
971 | 967 |
|
972 | 968 |
/** |
973 | 969 |
* This method initializes btnExportar |
974 |
* |
|
970 |
*
|
|
975 | 971 |
* @return JButton |
976 | 972 |
*/ |
977 | 973 |
private JButton getBtnExportar() { |
... | ... | |
990 | 986 |
|
991 | 987 |
/** |
992 | 988 |
* This method initializes btnEditar |
993 |
* |
|
989 |
*
|
|
994 | 990 |
* @return JButton |
995 | 991 |
*/ |
996 | 992 |
private JButton getBtnEditar() { |
... | ... | |
1003 | 999 |
btnEditar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
1004 | 1000 |
|
1005 | 1001 |
btnEditar.addActionListener(new java.awt.event.ActionListener() { |
1006 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
1007 |
ProjectProperties dlg = new ProjectProperties(p);
|
|
1008 |
PluginServices.getMDIManager().addWindow(dlg);
|
|
1009 |
refreshProperties();
|
|
1010 |
}
|
|
1011 |
});
|
|
1002 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
1003 |
ProjectProperties dlg = new ProjectProperties(project);
|
|
1004 |
PluginServices.getMDIManager().addWindow(dlg); |
|
1005 |
refreshProperties(); |
|
1006 |
} |
|
1007 |
}); |
|
1012 | 1008 |
} |
1013 | 1009 |
|
1014 | 1010 |
return btnEditar; |
... | ... | |
1016 | 1012 |
|
1017 | 1013 |
/** |
1018 | 1014 |
* This method initializes jScrollPane |
1019 |
* |
|
1015 |
*
|
|
1020 | 1016 |
* @return JScrollPane |
1021 | 1017 |
*/ |
1022 | 1018 |
private JScrollPane getJScrollPane() { |
... | ... | |
1024 | 1020 |
jScrollPane = new JScrollPane(); |
1025 | 1021 |
jScrollPane.setViewportView(getLstDocs()); |
1026 | 1022 |
jScrollPane.setPreferredSize(new java.awt.Dimension(200, 100)); |
1027 |
jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
1023 |
jScrollPane |
|
1024 |
.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
1028 | 1025 |
} |
1029 | 1026 |
|
1030 | 1027 |
return jScrollPane; |
... | ... | |
1034 | 1031 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel() |
1035 | 1032 |
*/ |
1036 | 1033 |
public Object getWindowModel() { |
1037 |
return p; |
|
1034 |
return project;
|
|
1038 | 1035 |
} |
1039 | 1036 |
|
1040 |
/** |
|
1041 |
* This method is used to get <strong>an initial</strong> ViewInfo object |
|
1042 |
* for this Project Manager window. It is not intended to retrieve the |
|
1043 |
* ViewInfo object in a later time. |
|
1044 |
* <strong>Use PluginServices.getMDIManager().getViewInfo(view) |
|
1045 |
* to retrieve the ViewInfo object at any time after the creation of the |
|
1046 |
* object. |
|
1047 |
* |
|
1048 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo() |
|
1049 |
*/ |
|
1037 |
public Project getProject() { |
|
1038 |
return project; |
|
1039 |
} |
|
1040 |
|
|
1041 |
/** |
|
1042 |
* This method is used to get <strong>an initial</strong> ViewInfo object |
|
1043 |
* for this Project Manager window. It is not intended to retrieve the |
|
1044 |
* ViewInfo object in a later time. <strong>Use |
|
1045 |
* PluginServices.getMDIManager().getViewInfo(view) to retrieve the ViewInfo |
|
1046 |
* object at any time after the creation of the object. |
|
1047 |
* |
|
1048 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo() |
|
1049 |
*/ |
|
1050 | 1050 |
public WindowInfo getWindowInfo() { |
1051 |
if (m_viewInfo==null) {
|
|
1051 |
if (m_viewInfo == null) {
|
|
1052 | 1052 |
m_viewInfo = new WindowInfo(WindowInfo.MAXIMIZABLE); |
1053 |
//m_viewInfo = new ViewInfo(ViewInfo.MAXIMIZABLE+ViewInfo.RESIZABLE); |
|
1053 |
// m_viewInfo = new |
|
1054 |
// ViewInfo(ViewInfo.MAXIMIZABLE+ViewInfo.RESIZABLE); |
|
1054 | 1055 |
m_viewInfo.setWidth(this.getWidth()); |
1055 | 1056 |
m_viewInfo.setHeight(this.getHeight()); |
1056 | 1057 |
m_viewInfo.setNormalWidth(this.getPreferredSize().width); |
... | ... | |
1068 | 1069 |
refreshControls(); |
1069 | 1070 |
} |
1070 | 1071 |
|
1071 |
/** |
|
1072 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated() |
|
1073 |
*/ |
|
1074 |
public void viewActivated() { |
|
1075 |
} |
|
1072 |
// /** |
|
1073 |
// * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated() |
|
1074 |
// */ |
|
1075 |
// public void viewActivated() { |
|
1076 |
// // do nothing |
|
1077 |
// } |
|
1076 | 1078 |
|
1077 | 1079 |
/** |
1078 | 1080 |
* This method initializes jPanel4 |
1079 |
* |
|
1081 |
*
|
|
1080 | 1082 |
* @return JPanel |
1081 | 1083 |
*/ |
1082 | 1084 |
private JPanel getJPanel4() { |
... | ... | |
1085 | 1087 |
|
1086 | 1088 |
jPanel4.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
1087 | 1089 |
jPanel4.setPreferredSize(new java.awt.Dimension(414, 30)); |
1088 |
jPanel4.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
|
1090 |
jPanel4 |
|
1091 |
.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
|
1089 | 1092 |
jPanel4.add(getBtnImportar(), null); |
1090 | 1093 |
jPanel4.add(getBtnExportar(), null); |
1091 | 1094 |
jPanel4.add(getBtnEditar(), null); |
... | ... | |
1096 | 1099 |
|
1097 | 1100 |
/** |
1098 | 1101 |
* This method initializes jScrollPane1 |
1099 |
* |
|
1102 |
*
|
|
1100 | 1103 |
* @return javax.swing.JScrollPane |
1101 | 1104 |
*/ |
1102 | 1105 |
private JScrollPane getJScrollPane1() { |
1103 | 1106 |
if (jScrollPane1 == null) { |
1104 | 1107 |
jScrollPane1 = new JScrollPane(); |
1105 |
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_NEVER); |
|
1106 |
jScrollPane1.setPreferredSize(new java.awt.Dimension(433,200)); |
|
1108 |
jScrollPane1 |
|
1109 |
.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_NEVER); |
|
1110 |
jScrollPane1.setPreferredSize(new java.awt.Dimension(433, 200)); |
|
1107 | 1111 |
jScrollPane1.setViewportView(getJPanel()); |
1108 | 1112 |
} |
1109 | 1113 |
return jScrollPane1; |
... | ... | |
1113 | 1117 |
return WindowInfo.PROJECT_PROFILE; |
1114 | 1118 |
} |
1115 | 1119 |
|
1116 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
1120 |
} |
Also available in: Unified diff