Revision 36631 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/gui/ProjectWindow.java
ProjectWindow.java | ||
---|---|---|
34 | 34 |
import java.util.Collections; |
35 | 35 |
import java.util.Comparator; |
36 | 36 |
import java.util.Enumeration; |
37 |
import java.util.Iterator; |
|
37 | 38 |
import java.util.List; |
38 | 39 |
|
39 | 40 |
import javax.swing.AbstractButton; |
... | ... | |
278 | 279 |
refreshDocuments(); |
279 | 280 |
} |
280 | 281 |
|
281 |
private Document createDocumentInProject(String doctype) { |
|
282 |
try { |
|
283 |
Document document = |
|
284 |
ProjectManager.getInstance().createDocumentByUser(doctype); |
|
285 |
if (document == null) { |
|
286 |
return null; |
|
282 |
private void createDocumentsInProject(String doctype) { |
|
283 |
Iterator<? extends Document> documents = |
|
284 |
ProjectManager.getInstance().createDocumentsByUser(doctype); |
|
285 |
for (; documents.hasNext();) { |
|
286 |
try { |
|
287 |
Document document = documents.next(); |
|
288 |
project.add(document); |
|
289 |
int index = |
|
290 |
((DefaultListModel) lstDocs.getModel()).indexOf(document); |
|
291 |
lstDocs.setSelectedIndex(index); |
|
292 |
lstDocs.requestFocus(); |
|
293 |
openDocumentWindow(document); |
|
294 |
} catch (Exception e) { |
|
295 |
NotificationManager.addError(e); |
|
287 | 296 |
} |
288 |
project.add(document); |
|
289 |
int index = |
|
290 |
((DefaultListModel) lstDocs.getModel()).indexOf(document); |
|
291 |
lstDocs.setSelectedIndex(index); |
|
292 |
lstDocs.requestFocus(); |
|
293 |
return document; |
|
294 |
} catch (Exception e) { |
|
295 |
NotificationManager.addError(e); |
|
296 | 297 |
} |
297 |
return null; |
|
298 | 298 |
} |
299 | 299 |
|
300 | 300 |
/** |
... | ... | |
305 | 305 |
*/ |
306 | 306 |
private void newProjectDocument() throws Exception { |
307 | 307 |
String doctype = getDocumentSelected(); |
308 |
Document doc = createDocumentInProject(doctype); |
|
309 |
openDocumentWindow(doc); |
|
308 |
createDocumentsInProject(doctype); |
|
310 | 309 |
} |
311 | 310 |
|
312 | 311 |
/** |
Also available in: Unified diff