Revision 36
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/package.info | ||
---|---|---|
1 | 1 |
# |
2 |
#Fri Dec 16 13:33:44 CET 2011
|
|
2 |
#Fri Dec 16 19:55:28 CET 2011
|
|
3 | 3 |
state=devel |
4 | 4 |
name=org.gvsig.educa.thematicmap.app.viewer |
5 | 5 |
buildNumber=0 |
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/resources/text_en.properties | ||
---|---|---|
1 |
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) |
|
2 |
|
|
3 |
open_thematic_map = Open Thematic Maps |
|
4 |
|
|
5 |
thematic_maps_availables = Thematic maps availables |
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/resources/text.properties | ||
---|---|---|
1 |
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) |
|
2 |
|
|
3 |
open_thematic_map = Abrir mapas tem\u00E1ticos |
|
4 |
|
|
5 |
thematic_maps_availables = Mapas tem\u00E1ticos disponibles |
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/java/org/gvsig/educa/thematicmap/app/viewer/ThematicMapDocumentManager.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.educa.thematicmap.app.viewer; |
23 | 23 |
|
24 |
import java.util.ArrayList; |
|
25 | 24 |
import java.util.Iterator; |
26 | 25 |
import java.util.List; |
27 | 26 |
|
... | ... | |
171 | 170 |
return new ThematicMapDocument(this); |
172 | 171 |
} |
173 | 172 |
|
173 |
public ThematicMapDocument createDocument(ThematicMap thematicMap) { |
|
174 |
return new ThematicMapDocument(this, thematicMap); |
|
175 |
} |
|
176 |
|
|
174 | 177 |
@Override |
175 | 178 |
public AbstractDocument createDocumentByUser() { |
179 |
Iterator<? extends Document> iterator = createDocumentsByUser(); |
|
180 |
if (iterator == null || !iterator.hasNext()) { |
|
181 |
return null; |
|
182 |
} |
|
183 |
return (AbstractDocument) iterator.next(); |
|
184 |
} |
|
185 |
|
|
186 |
@Override |
|
187 |
public Iterator<? extends Document> createDocumentsByUser() { |
|
176 | 188 |
ThematicMapSelector selector = |
177 | 189 |
new ThematicMapSelector(this, tmManager.getInstalledMaps()); |
178 | 190 |
tmSwingManager.getWindowManager().showWindow(selector, |
179 | 191 |
tmSwingManager.getTranslation("open_thematic_map"), MODE.DIALOG); |
180 | 192 |
|
181 |
return selector.getDocument(); |
|
182 |
} |
|
183 |
|
|
184 |
@Override |
|
185 |
public Iterator<? extends Document> createDocumentsByUser() { |
|
186 |
List<Document> docs = new ArrayList<Document>(1); |
|
187 |
Document doc = createDocumentByUser(); |
|
188 |
if (doc != null) { |
|
189 |
docs.add(doc); |
|
193 |
if (selector.getDocuments() == null |
|
194 |
|| selector.getDocuments().isEmpty()) { |
|
195 |
return null; |
|
190 | 196 |
} |
191 |
return docs.iterator();
|
|
197 |
return selector.getDocuments().iterator();
|
|
192 | 198 |
} |
193 | 199 |
|
194 | 200 |
public IWindow getMainWindow(Document doc, WindowLayout layout) { |
... | ... | |
236 | 242 |
return null; |
237 | 243 |
} |
238 | 244 |
|
245 |
@SuppressWarnings("rawtypes") |
|
239 | 246 |
@Override |
240 | 247 |
protected Class getDocumentClass() { |
241 | 248 |
return ThematicMapDocument.class; |
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/java/org/gvsig/educa/thematicmap/app/viewer/ThematicMapDocument.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.educa.thematicmap.app.viewer; |
23 | 23 |
|
24 |
import java.io.File;
|
|
24 |
import java.io.IOException;
|
|
25 | 25 |
|
26 | 26 |
import org.apache.commons.lang3.ObjectUtils; |
27 | 27 |
import org.apache.commons.lang3.StringUtils; |
... | ... | |
32 | 32 |
import org.gvsig.educa.thematicmap.ThematicMapLocator; |
33 | 33 |
import org.gvsig.educa.thematicmap.ThematicMapManager; |
34 | 34 |
import org.gvsig.educa.thematicmap.app.viewer.exception.ThematicMapLoadingException; |
35 |
import org.gvsig.educa.thematicmap.map.CantLoadContextException; |
|
36 |
import org.gvsig.educa.thematicmap.map.InvalidThematicMapFormatException; |
|
35 | 37 |
import org.gvsig.educa.thematicmap.map.ThematicMap; |
36 | 38 |
import org.gvsig.educa.thematicmap.map.ThematicMapInformation; |
37 | 39 |
import org.gvsig.fmap.mapcontext.MapContext; |
... | ... | |
58 | 60 |
private final ThematicMapManager thMapManager; |
59 | 61 |
|
60 | 62 |
private ThematicMap thematicMap; |
61 |
private File thematicMapFile; |
|
62 | 63 |
private ViewDocument sourceView; |
63 | 64 |
|
64 | 65 |
public ThematicMapDocument() { |
... | ... | |
69 | 70 |
super(factory); |
70 | 71 |
thMapManager = ThematicMapLocator.getManager(); |
71 | 72 |
thematicMap = null; |
72 |
thematicMapFile = null; |
|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
public ThematicMapDocument(DocumentManager factory, ThematicMap map) { |
... | ... | |
80 | 80 |
/** |
81 | 81 |
* @param map |
82 | 82 |
*/ |
83 |
public void setThematicMap(ThematicMap map) {
|
|
83 |
protected void setThematicMap(ThematicMap map) {
|
|
84 | 84 |
if (thematicMap != null) { |
85 | 85 |
throw new IllegalStateException("Thematic map already set"); |
86 | 86 |
} |
87 | 87 |
thematicMap = map; |
88 |
thematicMapFile = new File(map.getSourceFilePath()); |
|
89 | 88 |
super.setName(map.getInformation().getName()); |
90 | 89 |
} |
91 | 90 |
|
... | ... | |
93 | 92 |
return thematicMap; |
94 | 93 |
} |
95 | 94 |
|
95 |
public void reloadThematicMap() { |
|
96 |
if (thematicMap == null) { |
|
97 |
throw new IllegalStateException("Thematic not set"); |
|
98 |
} |
|
99 |
|
|
100 |
try { |
|
101 |
thematicMap.close(); |
|
102 |
} catch (IOException ex) { |
|
103 |
// TODO |
|
104 |
} |
|
105 |
ThematicMap newMap = |
|
106 |
thMapManager.getMapById(thematicMap.getInformation().getId()); |
|
107 |
|
|
108 |
try { |
|
109 |
newMap.open(); |
|
110 |
} catch (InvalidThematicMapFormatException ex) { |
|
111 |
// TODO Auto-generated catch block |
|
112 |
ex.printStackTrace(); |
|
113 |
} catch (CantLoadContextException ex) { |
|
114 |
// TODO Auto-generated catch block |
|
115 |
ex.printStackTrace(); |
|
116 |
} catch (IOException ex) { |
|
117 |
// TODO Auto-generated catch block |
|
118 |
ex.printStackTrace(); |
|
119 |
} |
|
120 |
|
|
121 |
// TODO raise a propertyChange event |
|
122 |
thematicMap = newMap; |
|
123 |
|
|
124 |
} |
|
125 |
|
|
96 | 126 |
@Override |
97 | 127 |
public void setCreationDate(String string) { |
98 | 128 |
throw new UnsupportedOperationException(); |
... | ... | |
186 | 216 |
* the sourceView to set |
187 | 217 |
*/ |
188 | 218 |
public void setSourceView(ViewDocument sourceView) { |
219 |
// TODO raise a propertyChange event |
|
189 | 220 |
this.sourceView = sourceView; |
190 | 221 |
} |
191 | 222 |
|
... | ... | |
196 | 227 |
return sourceView; |
197 | 228 |
} |
198 | 229 |
|
199 |
/** |
|
200 |
* @return the thematicMapFile |
|
201 |
*/ |
|
202 |
public File getThematicMapFile() { |
|
203 |
return thematicMapFile; |
|
204 |
} |
|
205 | 230 |
} |
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/java/org/gvsig/educa/thematicmap/app/viewer/ui/ThematicMapDocumentViewer.java | ||
---|---|---|
22 | 22 |
package org.gvsig.educa.thematicmap.app.viewer.ui; |
23 | 23 |
|
24 | 24 |
import java.awt.GridLayout; |
25 |
import java.beans.PropertyChangeEvent; |
|
26 |
import java.beans.PropertyChangeListener; |
|
25 | 27 |
import java.io.IOException; |
26 | 28 |
|
29 |
import javax.help.UnsupportedOperationException; |
|
30 |
import javax.swing.BorderFactory; |
|
27 | 31 |
import javax.swing.JPanel; |
28 | 32 |
|
29 | 33 |
import org.gvsig.andami.PluginServices; |
... | ... | |
40 | 44 |
import org.gvsig.educa.thematicmap.swing.viewer.ThematicMapViewer; |
41 | 45 |
|
42 | 46 |
/** |
47 |
* Document Window to show ThematicMaps |
|
48 |
* |
|
43 | 49 |
* @author gvSIG Team |
44 | 50 |
* @version $Id$ |
45 | 51 |
* |
46 | 52 |
*/ |
47 | 53 |
public class ThematicMapDocumentViewer extends JPanel implements |
48 |
IDocumentWindow, IWindowTransform { |
|
54 |
IDocumentWindow, IWindowTransform, PropertyChangeListener {
|
|
49 | 55 |
|
50 | 56 |
/** |
51 | 57 |
* |
... | ... | |
62 | 68 |
|
63 | 69 |
private final ThematicMapSwingManager tmSwingManager; |
64 | 70 |
|
65 |
private final ThematicMapViewer viewer;
|
|
71 |
private ThematicMapViewer viewer; |
|
66 | 72 |
|
73 |
private String title; |
|
74 |
|
|
67 | 75 |
/** |
76 |
* Default contructor |
|
77 |
* |
|
68 | 78 |
* @throws IOException |
69 | 79 |
* @throws CantLoadContextException |
70 | 80 |
* @throws InvalidThematicMapFormatException |
... | ... | |
76 | 86 |
super(); |
77 | 87 |
model = (ThematicMapDocument) document; |
78 | 88 |
tmSwingManager = ThematicMapSwingLocator.getSwingManager(); |
89 |
setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
|
90 |
setLayout(new GridLayout(1, 1)); |
|
91 |
|
|
92 |
model.addPropertyChangeListener(this); |
|
93 |
|
|
94 |
updateViewer(); |
|
95 |
updateTitle(); |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Gets the title for this window |
|
100 |
* |
|
101 |
* @return |
|
102 |
*/ |
|
103 |
public String getTitle() { |
|
104 |
return title; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Update the panel title |
|
109 |
* |
|
110 |
*/ |
|
111 |
protected void updateTitle() { |
|
112 |
title = |
|
113 |
tmSwingManager.getTranslation("Thematic_Map").concat(": ") |
|
114 |
.concat(this.model.getName()); |
|
115 |
if (windowInfo != null) { |
|
116 |
windowInfo.setTitle(title); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* Update the view contained in the panel |
|
122 |
* |
|
123 |
* @throws InvalidThematicMapFormatException |
|
124 |
* @throws CantLoadContextException |
|
125 |
* @throws IOException |
|
126 |
*/ |
|
127 |
protected void updateViewer() throws InvalidThematicMapFormatException, |
|
128 |
CantLoadContextException, IOException { |
|
129 |
String toolId = null; |
|
130 |
|
|
131 |
// Remove previous viewer |
|
132 |
if (viewer != null) { |
|
133 |
// backup current tool |
|
134 |
toolId = viewer.getMapControl().getCurrentTool(); |
|
135 |
remove(viewer.getSwingComponent()); |
|
136 |
viewer.dispose(); |
|
137 |
viewer = null; |
|
138 |
} |
|
139 |
|
|
140 |
// create new viewer |
|
79 | 141 |
viewer = tmSwingManager.getViewer(model.getThematicMap()); |
80 |
setLayout(new GridLayout(1, 1)); |
|
81 | 142 |
add(viewer.getSwingComponent()); |
143 |
|
|
144 |
// restore tool (if any) |
|
145 |
if (toolId != null) { |
|
146 |
viewer.getMapControl().setTool(toolId); |
|
147 |
} |
|
82 | 148 |
} |
83 | 149 |
|
84 | 150 |
// IWindow interface |
... | ... | |
89 | 155 |
new WindowInfo(WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE |
90 | 156 |
| WindowInfo.RESIZABLE); |
91 | 157 |
|
92 |
if (this.model == null) { |
|
93 |
windowInfo.setTitle("Tabla"); |
|
94 |
} else { |
|
95 |
windowInfo.setTitle(this.model.getName()); |
|
96 |
} |
|
158 |
windowInfo.setTitle(getTitle()); |
|
97 | 159 |
|
98 | 160 |
windowInfo.setWidth(DEFAULT_WIDTH); |
99 | 161 |
windowInfo.setHeight(DEFAULT_HEIGHT); |
... | ... | |
146 | 208 |
} |
147 | 209 |
|
148 | 210 |
public void setDocument(Document document) { |
149 |
|
|
211 |
throw new UnsupportedOperationException(); |
|
150 | 212 |
} |
151 | 213 |
|
152 | 214 |
public Document getDocument() { |
153 | 215 |
return model; |
154 | 216 |
} |
155 | 217 |
|
218 |
/** |
|
219 |
* Changes in source document |
|
220 |
* |
|
221 |
*/ |
|
222 |
public void propertyChange(PropertyChangeEvent evt) { |
|
223 |
if (evt.getPropertyName().equals("name")) { |
|
224 |
updateTitle(); |
|
225 |
} else |
|
226 |
if (evt.getPropertyName().equals("thematicMap")) { |
|
227 |
|
|
228 |
} |
|
229 |
|
|
230 |
} |
|
231 |
|
|
156 | 232 |
} |
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/java/org/gvsig/educa/thematicmap/app/viewer/ui/ThematicMapSelector.java | ||
---|---|---|
24 | 24 |
import java.awt.BorderLayout; |
25 | 25 |
import java.awt.Dimension; |
26 | 26 |
import java.awt.event.ActionEvent; |
27 |
import java.awt.event.MouseAdapter; |
|
28 |
import java.awt.event.MouseEvent; |
|
27 | 29 |
import java.util.ArrayList; |
30 |
import java.util.Collections; |
|
28 | 31 |
import java.util.List; |
29 | 32 |
|
30 | 33 |
import javax.swing.AbstractAction; |
34 |
import javax.swing.BorderFactory; |
|
31 | 35 |
import javax.swing.Box; |
32 | 36 |
import javax.swing.BoxLayout; |
33 | 37 |
import javax.swing.JButton; |
34 |
import javax.swing.JLabel; |
|
35 | 38 |
import javax.swing.JList; |
36 | 39 |
import javax.swing.JPanel; |
37 | 40 |
import javax.swing.JScrollPane; |
... | ... | |
50 | 53 |
|
51 | 54 |
/** |
52 | 55 |
* Open Thematic Map dialog |
56 |
* <p> |
|
57 |
* Allows user to select one o many Thematic map to open |
|
58 |
* </p> |
|
53 | 59 |
* |
54 | 60 |
* @author gvSIG Team |
55 | 61 |
* @version $Id$ |
... | ... | |
63 | 69 |
*/ |
64 | 70 |
private static final long serialVersionUID = 1L; |
65 | 71 |
|
72 |
@SuppressWarnings("unused") |
|
66 | 73 |
private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory |
67 | 74 |
.getLogger(ThematicMapSelector.class); |
68 | 75 |
|
... | ... | |
79 | 86 |
private JPanel actionPanel; |
80 | 87 |
private JButton botOpen; |
81 | 88 |
private JButton botCancel; |
82 |
private ThematicMap curMap; |
|
83 |
private ThematicMapDocument document; |
|
89 |
private ThematicMap lastSelected; |
|
84 | 90 |
|
85 | 91 |
private int lastSelectedIndex; |
86 | 92 |
|
87 | 93 |
private final ThematicMapDocumentManager documentManager; |
88 | 94 |
|
95 |
private List<ThematicMapDocument> documents; |
|
96 |
|
|
89 | 97 |
public ThematicMapSelector(ThematicMapDocumentManager documentManager, |
90 | 98 |
List<ThematicMap> installedMaps) { |
91 | 99 |
super(); |
... | ... | |
101 | 109 |
for (ThematicMap map : maps) { |
102 | 110 |
mapNames.add(map.getInformation().getName()); |
103 | 111 |
} |
104 |
curMap = null;
|
|
112 |
lastSelected = null;
|
|
105 | 113 |
lastSelectedIndex = -1; |
106 | 114 |
|
107 | 115 |
initializeUI(); |
... | ... | |
113 | 121 |
* |
114 | 122 |
*/ |
115 | 123 |
private void initializeUI() { |
116 |
setLayout(new BorderLayout(5, 5)); |
|
124 |
setLayout(new BorderLayout(10, 10)); |
|
125 |
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
117 | 126 |
|
118 | 127 |
setMaximumSize(new Dimension(300, 200)); |
119 | 128 |
setPreferredSize(new Dimension(800, 600)); |
... | ... | |
122 | 131 |
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
123 | 132 |
list.addListSelectionListener(this); |
124 | 133 |
|
134 |
// Listen to click so it can change map information |
|
135 |
list.addMouseListener(new MouseAdapter() { |
|
136 |
|
|
137 |
@Override |
|
138 |
public void mouseClicked(MouseEvent e) { |
|
139 |
int itemClicked = -1; |
|
140 |
|
|
141 |
// check in visible list element which was clicked |
|
142 |
for (int index = list.getFirstVisibleIndex(); index <= list |
|
143 |
.getLastVisibleIndex(); index++) { |
|
144 |
if (list.getCellBounds(index, index).contains(e.getX(), |
|
145 |
e.getY())) { |
|
146 |
itemClicked = index; |
|
147 |
break; |
|
148 |
} |
|
149 |
} |
|
150 |
if (itemClicked > -1) { |
|
151 |
lastSelection(itemClicked); |
|
152 |
} |
|
153 |
} |
|
154 |
}); |
|
155 |
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
|
156 |
|
|
125 | 157 |
listPanel = new JPanel(); |
126 |
listPanel.setLayout(new BorderLayout(5, 5)); |
|
127 |
listPanel.add(new JLabel("Thematic Maps availables:"), |
|
128 |
BorderLayout.NORTH); |
|
129 |
listPanel.add(list, BorderLayout.CENTER); |
|
158 |
listPanel.setLayout(new BorderLayout(10, 10)); |
|
159 |
listPanel.setBorder(BorderFactory.createTitledBorder(swingManager |
|
160 |
.getTranslation("thematic_maps_availables"))); |
|
130 | 161 |
|
131 |
add(new JScrollPane(listPanel), BorderLayout.WEST);
|
|
162 |
listPanel.add(new JScrollPane(list), BorderLayout.CENTER);
|
|
132 | 163 |
|
164 |
add(listPanel, BorderLayout.WEST); |
|
165 |
|
|
133 | 166 |
informationPanel = new JPanel(); |
134 | 167 |
informationPanel.setLayout(new BorderLayout(5, 5)); |
168 |
informationPanel.setBorder(BorderFactory |
|
169 |
.createTitledBorder(swingManager |
|
170 |
.getTranslation("thematic_map_information"))); |
|
135 | 171 |
|
136 |
informationPanel.add(new JLabel("Thematic Map information:"), |
|
137 |
BorderLayout.NORTH); |
|
138 |
|
|
139 | 172 |
information = swingManager.newInformationViewer(); |
140 | 173 |
informationPanel.add(information.getSwingComponent(), |
141 | 174 |
BorderLayout.CENTER); |
... | ... | |
148 | 181 |
actionPanel.setLayout(actionPanelLayout); |
149 | 182 |
|
150 | 183 |
actionPanel.add(Box.createHorizontalGlue()); |
184 |
actionPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
151 | 185 |
|
152 |
botOpen = usabManager.createJButton(new AbstractAction("Open Map") { |
|
186 |
botOpen = |
|
187 |
usabManager.createJButton(new AbstractAction(swingManager |
|
188 |
.getTranslation("open_thematic_map")) { |
|
153 | 189 |
|
154 |
/** |
|
190 |
/**
|
|
155 | 191 |
* |
156 | 192 |
*/ |
157 |
private static final long serialVersionUID = -3437007146684939225L; |
|
193 |
private static final long serialVersionUID = |
|
194 |
-3437007146684939225L; |
|
158 | 195 |
|
159 |
public void actionPerformed(ActionEvent e) { |
|
160 |
openSelected();
|
|
161 |
} |
|
162 |
}); |
|
196 |
public void actionPerformed(ActionEvent e) {
|
|
197 |
openSelecteds();
|
|
198 |
}
|
|
199 |
});
|
|
163 | 200 |
botOpen.setEnabled(false); |
164 | 201 |
|
165 |
botCancel = usabManager.createJButton(new AbstractAction("Cancel") { |
|
202 |
botCancel = |
|
203 |
usabManager.createJButton(new AbstractAction(swingManager |
|
204 |
.getTranslation("cancel")) { |
|
166 | 205 |
|
167 |
/** |
|
206 |
/**
|
|
168 | 207 |
* |
169 | 208 |
*/ |
170 |
private static final long serialVersionUID = -2227776656041247582L; |
|
209 |
private static final long serialVersionUID = |
|
210 |
-2227776656041247582L; |
|
171 | 211 |
|
172 |
public void actionPerformed(ActionEvent e) { |
|
173 |
close(); |
|
174 |
} |
|
175 |
}); |
|
212 |
public void actionPerformed(ActionEvent e) {
|
|
213 |
close();
|
|
214 |
}
|
|
215 |
});
|
|
176 | 216 |
|
177 | 217 |
actionPanel.add(botOpen); |
178 | 218 |
actionPanel.add(Box.createHorizontalStrut(10)); |
... | ... | |
184 | 224 |
} |
185 | 225 |
|
186 | 226 |
/** |
187 |
* Opens selected thematic map |
|
227 |
* Opens selecteds thematic map
|
|
188 | 228 |
*/ |
189 |
private void openSelected() { |
|
190 |
document = null; |
|
191 |
if (curMap == null) { |
|
192 |
return; |
|
193 |
} |
|
229 |
private void openSelecteds() { |
|
230 |
int[] selecteds = list.getSelectedIndices(); |
|
231 |
List<ThematicMapDocument> documents = |
|
232 |
new ArrayList<ThematicMapDocument>(selecteds.length); |
|
194 | 233 |
|
195 |
ThematicMapDocument document = |
|
196 |
documentManager.getDocumentForMap(curMap); |
|
197 |
|
|
198 |
if (document == null) { |
|
199 |
document = (ThematicMapDocument) documentManager.createDocument(); |
|
200 |
document.setThematicMap(curMap); |
|
234 |
ThematicMapDocument document; |
|
235 |
ThematicMap map; |
|
236 |
for (int index : selecteds) { |
|
237 |
map = maps.get(index); |
|
238 |
// create a new document |
|
239 |
document = documentManager.createDocument(map); |
|
240 |
documents.add(document); |
|
201 | 241 |
} |
202 |
this.document = document;
|
|
242 |
this.documents = Collections.unmodifiableList(documents);
|
|
203 | 243 |
|
204 | 244 |
close(); |
205 | 245 |
} |
... | ... | |
210 | 250 |
private void close() { |
211 | 251 |
this.setVisible(false); |
212 | 252 |
maps = null; |
213 |
curMap = null;
|
|
253 |
lastSelected = null;
|
|
214 | 254 |
} |
215 | 255 |
|
216 | 256 |
/** |
... | ... | |
223 | 263 |
} |
224 | 264 |
lastSelectedIndex = index; |
225 | 265 |
if (index < 0) { |
226 |
if (information != null) { |
|
227 |
information.clean(); |
|
228 |
} |
|
266 |
cleanInformation(); |
|
229 | 267 |
botOpen.setEnabled(false); |
230 | 268 |
return; |
231 | 269 |
} |
232 | 270 |
botOpen.setEnabled(true); |
233 |
curMap = maps.get(index); |
|
234 |
information.loadMapInfromation(curMap); |
|
271 |
|
|
235 | 272 |
} |
236 | 273 |
|
237 | 274 |
/** |
275 |
* Cleans information map panel |
|
276 |
*/ |
|
277 |
private void cleanInformation() { |
|
278 |
if (information != null) { |
|
279 |
information.clean(); |
|
280 |
} |
|
281 |
} |
|
282 |
|
|
283 |
/** |
|
284 |
* Set last selected item |
|
285 |
* |
|
286 |
* @param index |
|
287 |
*/ |
|
288 |
private void lastSelection(int index) { |
|
289 |
cleanInformation(); |
|
290 |
lastSelected = maps.get(index); |
|
291 |
information.loadMapInfromation(lastSelected); |
|
292 |
} |
|
293 |
|
|
294 |
/** |
|
295 |
* Return user document (Thematic map) selection |
|
296 |
* |
|
238 | 297 |
* @return the document |
239 | 298 |
*/ |
240 |
public ThematicMapDocument getDocument() {
|
|
241 |
return document; |
|
299 |
public List<ThematicMapDocument> getDocuments() {
|
|
300 |
return documents;
|
|
242 | 301 |
} |
302 |
|
|
243 | 303 |
} |
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/java/org/gvsig/educa/thematicmap/app/viewer/ui/TocImageProvider.java | ||
---|---|---|
26 | 26 |
import org.gvsig.andami.PluginServices; |
27 | 27 |
import org.gvsig.educa.thematicmap.swing.viewer.ThematicMapTocImageProvider; |
28 | 28 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
29 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
29 | 30 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
30 | 31 |
|
31 | 32 |
/** |
33 |
* Image provider for Thematic Map TOC items |
|
34 |
* |
|
32 | 35 |
* @author gvSIG Team |
33 | 36 |
* @version $Id$ |
34 | 37 |
* |
... | ... | |
36 | 39 |
public class TocImageProvider implements ThematicMapTocImageProvider { |
37 | 40 |
|
38 | 41 |
public ImageIcon getImageIconForLayer(FLayer layer) { |
42 |
if (layer instanceof FLyrVect) { |
|
43 |
// TODO remove it |
|
44 |
return PluginServices.getIconTheme().get("icon-layer-vect-shp"); |
|
45 |
} |
|
39 | 46 |
return PluginServices.getIconTheme().get(layer.getTocImageIcon()); |
40 | 47 |
} |
41 | 48 |
|
Also available in: Unified diff