Revision 9392 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/ProjectMapFactory.java
ProjectMapFactory.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.Component; |
4 | 4 |
import java.text.DateFormat; |
5 |
import java.util.ArrayList; |
|
5 | 6 |
import java.util.Arrays; |
6 | 7 |
import java.util.Comparator; |
7 | 8 |
import java.util.Date; |
... | ... | |
12 | 13 |
import javax.swing.JOptionPane; |
13 | 14 |
|
14 | 15 |
import com.iver.andami.PluginServices; |
15 |
import com.iver.cit.gvsig.gui.layout.Layout; |
|
16 | 16 |
import com.iver.cit.gvsig.project.Project; |
17 | 17 |
import com.iver.cit.gvsig.project.documents.ProjectDocument; |
18 | 18 |
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory; |
19 | 19 |
import com.iver.cit.gvsig.project.documents.contextMenu.actions.CopyDocumentContextMenuAction; |
20 | 20 |
import com.iver.cit.gvsig.project.documents.contextMenu.actions.CutDocumentContextMenuAction; |
21 | 21 |
import com.iver.cit.gvsig.project.documents.contextMenu.actions.PasteDocumentContextMenuAction; |
22 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
|
22 | 23 |
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory; |
23 | 24 |
import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory; |
24 | 25 |
import com.iver.utiles.XMLEntity; |
... | ... | |
57 | 58 |
* |
58 | 59 |
* @return ProjectDocument. |
59 | 60 |
*/ |
61 |
// public ProjectDocument create(Project project) { |
|
62 |
// String layoutName = ""; |
|
63 |
// String aux = PluginServices.getText(this, "untitled"); |
|
64 |
// layoutName = aux + " - " + ProjectMap.numMaps++; |
|
65 |
// |
|
66 |
// if (project != null) { |
|
67 |
// // Buscamos si alguna vista ya ten?a este nombre: |
|
68 |
// while (existLayoutName(project, layoutName)) { |
|
69 |
// layoutName = aux + " - " + ProjectView.numViews++; |
|
70 |
// } |
|
71 |
// } |
|
72 |
// |
|
73 |
// ProjectMap map = createMap(layoutName); |
|
74 |
// map.setModel(new Layout()); |
|
75 |
// map.getModel().setProjectMap(map); |
|
76 |
// map.setProject(project, 0); |
|
77 |
// map.setProjectDocumentFactory(this); |
|
78 |
// |
|
79 |
// return map; |
|
80 |
// } |
|
60 | 81 |
public ProjectDocument create(Project project) { |
61 | 82 |
ProjectMap map = createMap(PluginServices.getText(this, "untitled")); |
62 | 83 |
map.setModel(new Layout()); |
... | ... | |
66 | 87 |
|
67 | 88 |
return map; |
68 | 89 |
} |
90 |
private boolean existLayoutName(Project project, String layoutName) { |
|
91 |
ArrayList viewList = project.getDocumentsByType(getRegisterName()); |
|
69 | 92 |
|
93 |
for (int i = 0; i < viewList.size(); i++) { |
|
94 |
ProjectMap pm = (ProjectMap) viewList.get(i); |
|
95 |
String title = pm.getName(); |
|
96 |
|
|
97 |
if (title.compareTo(layoutName) == 0) { |
|
98 |
return true; |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
return false; |
|
103 |
} |
|
70 | 104 |
/** |
71 | 105 |
* Returns the name of registration in the point of extension. |
72 | 106 |
* |
Also available in: Unified diff