Revision 294
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/src/main/assembly/package-main.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>package-main</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
<format>zip</format> |
|
6 |
</formats> |
|
7 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
8 |
<includeBaseDirectory>false</includeBaseDirectory> |
|
9 |
<files> |
|
10 |
<file> |
|
11 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
12 |
<outputDirectory>.</outputDirectory> |
|
13 |
</file> |
|
14 |
</files> |
|
15 |
|
|
16 |
<fileSets> |
|
17 |
<fileSet> |
|
18 |
<directory>src/main/resources/data</directory> |
|
19 |
<outputDirectory>data</outputDirectory> |
|
20 |
</fileSet> |
|
21 |
</fileSets> |
|
22 |
|
|
23 |
<dependencySets> |
|
24 |
<dependencySet> |
|
25 |
<useProjectArtifact>false</useProjectArtifact> |
|
26 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
27 |
<outputDirectory>lib</outputDirectory> |
|
28 |
</dependencySet> |
|
29 |
</dependencySets> |
|
30 |
|
|
31 |
</assembly> |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/src/main/java/org/gvsig/educa/portableview/main/Main.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.educa.portableview.main; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
import java.io.File; |
|
28 |
import java.io.IOException; |
|
29 |
import java.net.URL; |
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.AbstractAction; |
|
33 |
import javax.swing.Box; |
|
34 |
import javax.swing.JButton; |
|
35 |
import javax.swing.JFileChooser; |
|
36 |
import javax.swing.JFrame; |
|
37 |
import javax.swing.JMenu; |
|
38 |
import javax.swing.JMenuBar; |
|
39 |
import javax.swing.JMenuItem; |
|
40 |
import javax.swing.JToolBar; |
|
41 |
import javax.swing.WindowConstants; |
|
42 |
|
|
43 |
import org.slf4j.Logger; |
|
44 |
import org.slf4j.LoggerFactory; |
|
45 |
import org.gvsig.educa.portableview.PortableViewLocator; |
|
46 |
import org.gvsig.educa.portableview.PortableViewManager; |
|
47 |
import org.gvsig.educa.portableview.compilation.PortableViewCompilation; |
|
48 |
import org.gvsig.educa.portableview.compilation.PortableViewCompiler; |
|
49 |
import org.gvsig.educa.portableview.compilation.PortableViewCompilerListener; |
|
50 |
import org.gvsig.educa.portableview.compilation.PortableViewCompilerStatus; |
|
51 |
import org.gvsig.educa.portableview.map.PortableView; |
|
52 |
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator; |
|
53 |
import org.gvsig.educa.portableview.swing.PortableViewSwingManager; |
|
54 |
import org.gvsig.educa.portableview.swing.PortableViewWindowManager; |
|
55 |
import org.gvsig.educa.portableview.swing.PortableViewWindowManager.CONFIRM_DIALOG_OPTION; |
|
56 |
import org.gvsig.educa.portableview.swing.PortableViewWindowManager.CONFIRM_DIALOG_TYPE; |
|
57 |
import org.gvsig.educa.portableview.swing.PortableViewWindowManager.MESSAGE_DIALOG_TYPE; |
|
58 |
import org.gvsig.educa.portableview.swing.editor.PortableViewCompilationEditor; |
|
59 |
import org.gvsig.educa.portableview.swing.editor.PortableViewCompilationEditorListener; |
|
60 |
import org.gvsig.educa.portableview.swing.viewer.PortableViewViewer; |
|
61 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
62 |
import org.gvsig.installer.swing.api.SwingInstallerManager; |
|
63 |
import org.gvsig.installer.swing.api.execution.InstallPackageWizardException; |
|
64 |
import org.gvsig.installer.swing.api.wizard.AbstractInstallerWizard; |
|
65 |
import org.gvsig.tools.ToolsLocator; |
|
66 |
import org.gvsig.tools.dispose.DisposableManager; |
|
67 |
import org.gvsig.tools.exception.BaseException; |
|
68 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
69 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
70 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
71 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE; |
|
72 |
|
|
73 |
/** |
|
74 |
* Main executable class for testing the PortableView library. |
|
75 |
* |
|
76 |
* @author gvSIG Team |
|
77 |
* @version $Id$ |
|
78 |
*/ |
|
79 |
public class Main { |
|
80 |
|
|
81 |
private static final Logger LOG = LoggerFactory.getLogger(Main.class); |
|
82 |
|
|
83 |
private final PortableViewManager manager; |
|
84 |
private final PortableViewSwingManager swingManager; |
|
85 |
private final PortableViewWindowManager winManager; |
|
86 |
private final UsabilitySwingManager usabManager; |
|
87 |
private final DisposableManager disposeManager; |
|
88 |
private final SwingInstallerManager swingInstallerManager; |
|
89 |
|
|
90 |
private final JFileChooser fileChooser; |
|
91 |
private JFrame mainFrame; |
|
92 |
private PortableViewViewer curViewer = null; |
|
93 |
|
|
94 |
private AbstractAction setPanToolAction; |
|
95 |
private AbstractAction setZoomToolAction; |
|
96 |
private AbstractAction zoomAllAction; |
|
97 |
private AbstractAction setThematiMapFolderAction; |
|
98 |
private AbstractAction showOpenPortableViewDialogAction; |
|
99 |
private AbstractAction exitAction; |
|
100 |
private AbstractAction closePortableViewAction; |
|
101 |
|
|
102 |
private AbstractAction createCompilationAction; |
|
103 |
|
|
104 |
private AbstractAction createCompilationFromMapAction; |
|
105 |
|
|
106 |
private AbstractAction installPortableViews; |
|
107 |
|
|
108 |
private AbstractAction addInstallUrl; |
|
109 |
|
|
110 |
public static void main(String args[]) { |
|
111 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
112 |
|
|
113 |
Main main = new Main(); |
|
114 |
main.show(); |
|
115 |
} |
|
116 |
|
|
117 |
/** |
|
118 |
* New instance of Main |
|
119 |
*/ |
|
120 |
public Main() { |
|
121 |
manager = PortableViewLocator.getManager(); |
|
122 |
swingManager = PortableViewSwingLocator.getSwingManager(); |
|
123 |
winManager = swingManager.getWindowManager(); |
|
124 |
usabManager = ToolsSwingLocator.getUsabilitySwingManager(); |
|
125 |
disposeManager = ToolsLocator.getDisposableManager(); |
|
126 |
swingInstallerManager = |
|
127 |
SwingInstallerLocator.getSwingInstallerManager(); |
|
128 |
|
|
129 |
String defaultFolderPath = |
|
130 |
"gvSIG/plugins/org.gvsig.educa.portableview.app.viewer/portableView"; |
|
131 |
File defaultFolder = |
|
132 |
new File(System.getProperty("user.home"), defaultFolderPath); |
|
133 |
|
|
134 |
if (defaultFolder.exists() && defaultFolder.isDirectory()) { |
|
135 |
manager.setInstallationMapFolder(defaultFolder.getAbsolutePath()); |
|
136 |
} |
|
137 |
|
|
138 |
swingManager.addMapControlRegistrant(new MapToolsRegistrant()); |
|
139 |
|
|
140 |
fileChooser = new JFileChooser(); |
|
141 |
|
|
142 |
} |
|
143 |
|
|
144 |
/** |
|
145 |
* Shows main frame |
|
146 |
*/ |
|
147 |
public void show() { |
|
148 |
|
|
149 |
// Create actions |
|
150 |
createActions(); |
|
151 |
|
|
152 |
// Create JFrame to show data |
|
153 |
mainFrame = new JFrame("PortableView example app"); |
|
154 |
mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
|
155 |
mainFrame.setLayout(new BorderLayout(10, 10)); |
|
156 |
|
|
157 |
// Create menu bar |
|
158 |
createMenu(); |
|
159 |
|
|
160 |
// Create tools bar |
|
161 |
createToolBar(); |
|
162 |
|
|
163 |
updateControls(); |
|
164 |
|
|
165 |
// Display the window. |
|
166 |
mainFrame.pack(); |
|
167 |
mainFrame.setSize(800, 600); |
|
168 |
mainFrame.setVisible(true); |
|
169 |
|
|
170 |
} |
|
171 |
|
|
172 |
/** |
|
173 |
* Creates all the action for menu and tools bar |
|
174 |
* |
|
175 |
*/ |
|
176 |
@SuppressWarnings("serial") |
|
177 |
private void createActions() { |
|
178 |
setThematiMapFolderAction = |
|
179 |
new AbstractAction("Set portable view folder") { |
|
180 |
|
|
181 |
public void actionPerformed(ActionEvent e) { |
|
182 |
setPortableViewFolder(); |
|
183 |
} |
|
184 |
}; |
|
185 |
|
|
186 |
showOpenPortableViewDialogAction = |
|
187 |
new AbstractAction("Open a Portable View") { |
|
188 |
|
|
189 |
public void actionPerformed(ActionEvent e) { |
|
190 |
showOpenPortableViewDialog(); |
|
191 |
} |
|
192 |
}; |
|
193 |
showOpenPortableViewDialogAction.setEnabled(false); |
|
194 |
|
|
195 |
setZoomToolAction = new AbstractAction("Tool Zoom") { |
|
196 |
|
|
197 |
public void actionPerformed(ActionEvent e) { |
|
198 |
setZoomTool(); |
|
199 |
} |
|
200 |
}; |
|
201 |
setZoomToolAction.setEnabled(false); |
|
202 |
|
|
203 |
setPanToolAction = new AbstractAction("Tool Pan") { |
|
204 |
|
|
205 |
public void actionPerformed(ActionEvent e) { |
|
206 |
setPanTool(); |
|
207 |
} |
|
208 |
}; |
|
209 |
setPanToolAction.setEnabled(false); |
|
210 |
|
|
211 |
zoomAllAction = new AbstractAction("Zoom all") { |
|
212 |
|
|
213 |
public void actionPerformed(ActionEvent e) { |
|
214 |
zoomAll(); |
|
215 |
} |
|
216 |
}; |
|
217 |
zoomAllAction.setEnabled(false); |
|
218 |
|
|
219 |
closePortableViewAction = new AbstractAction("Close Map") { |
|
220 |
|
|
221 |
public void actionPerformed(ActionEvent e) { |
|
222 |
closeMap(); |
|
223 |
} |
|
224 |
}; |
|
225 |
closePortableViewAction.setEnabled(false); |
|
226 |
|
|
227 |
exitAction = new AbstractAction("Exit") { |
|
228 |
|
|
229 |
public void actionPerformed(ActionEvent e) { |
|
230 |
exit(); |
|
231 |
} |
|
232 |
}; |
|
233 |
|
|
234 |
createCompilationAction = new AbstractAction("Create a compilation") { |
|
235 |
|
|
236 |
public void actionPerformed(ActionEvent e) { |
|
237 |
createCompilation(); |
|
238 |
} |
|
239 |
}; |
|
240 |
createCompilationAction.setEnabled(false); |
|
241 |
|
|
242 |
createCompilationFromMapAction = |
|
243 |
new AbstractAction("Create compilation from current map") { |
|
244 |
|
|
245 |
public void actionPerformed(ActionEvent e) { |
|
246 |
createCompilationFromMap(); |
|
247 |
} |
|
248 |
}; |
|
249 |
createCompilationFromMapAction.setEnabled(false); |
|
250 |
|
|
251 |
addInstallUrl = new AbstractAction("Add a PortableView install URL") { |
|
252 |
|
|
253 |
public void actionPerformed(ActionEvent e) { |
|
254 |
addPortableViewUrl(); |
|
255 |
} |
|
256 |
|
|
257 |
}; |
|
258 |
|
|
259 |
installPortableViews = new AbstractAction("Install PortableViews") { |
|
260 |
|
|
261 |
public void actionPerformed(ActionEvent e) { |
|
262 |
installPortableView(); |
|
263 |
} |
|
264 |
|
|
265 |
}; |
|
266 |
installPortableViews.setEnabled(false); |
|
267 |
|
|
268 |
} |
|
269 |
|
|
270 |
/** |
|
271 |
* Creates the menu bar |
|
272 |
*/ |
|
273 |
private void createMenu() { |
|
274 |
// Create the menu bar. |
|
275 |
JMenuBar menuBar = new JMenuBar(); |
|
276 |
|
|
277 |
// Build the menu. |
|
278 |
JMenu menuFile = new JMenu("File"); |
|
279 |
menuFile.add(new JMenuItem(setThematiMapFolderAction)); |
|
280 |
menuFile.addSeparator(); |
|
281 |
menuFile.add(new JMenuItem(showOpenPortableViewDialogAction)); |
|
282 |
menuFile.add(new JMenuItem(closePortableViewAction)); |
|
283 |
menuFile.addSeparator(); |
|
284 |
menuFile.add(new JMenuItem(createCompilationAction)); |
|
285 |
menuFile.add(new JMenuItem(createCompilationFromMapAction)); |
|
286 |
menuFile.addSeparator(); |
|
287 |
menuFile.add(new JMenuItem(addInstallUrl)); |
|
288 |
menuFile.add(new JMenuItem(installPortableViews)); |
|
289 |
menuFile.addSeparator(); |
|
290 |
menuFile.add(new JMenuItem(exitAction)); |
|
291 |
|
|
292 |
JMenu menuViewer = new JMenu("Viewer"); |
|
293 |
menuViewer.add(setPanToolAction); |
|
294 |
menuViewer.add(setZoomToolAction); |
|
295 |
menuViewer.addSeparator(); |
|
296 |
menuViewer.add(zoomAllAction); |
|
297 |
|
|
298 |
menuBar.add(menuFile); |
|
299 |
menuBar.add(menuViewer); |
|
300 |
|
|
301 |
mainFrame.setJMenuBar(menuBar); |
|
302 |
} |
|
303 |
|
|
304 |
/** |
|
305 |
* Creates the tools bar |
|
306 |
*/ |
|
307 |
private void createToolBar() { |
|
308 |
Dimension sepSize = new Dimension(20, 5); |
|
309 |
JToolBar toolBar = new JToolBar(); |
|
310 |
toolBar.add(usabManager.createJButton(showOpenPortableViewDialogAction)); |
|
311 |
toolBar.add(usabManager.createJButton(closePortableViewAction)); |
|
312 |
|
|
313 |
toolBar.addSeparator(sepSize); |
|
314 |
toolBar.add(usabManager.createJButton(setPanToolAction)); |
|
315 |
toolBar.add(usabManager.createJButton(setZoomToolAction)); |
|
316 |
|
|
317 |
toolBar.addSeparator(sepSize); |
|
318 |
toolBar.add(usabManager.createJButton(zoomAllAction)); |
|
319 |
|
|
320 |
toolBar.add(Box.createHorizontalGlue()); |
|
321 |
toolBar.add(new JButton(exitAction)); |
|
322 |
|
|
323 |
mainFrame.add(toolBar, BorderLayout.PAGE_START); |
|
324 |
} |
|
325 |
|
|
326 |
/** |
|
327 |
* Shows file chooser to select portable view folder |
|
328 |
*/ |
|
329 |
public void setPortableViewFolder() { |
|
330 |
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
|
331 |
int result = |
|
332 |
fileChooser.showDialog(mainFrame, "Select PortableView folder"); |
|
333 |
if (result != JFileChooser.APPROVE_OPTION) { |
|
334 |
return; |
|
335 |
} |
|
336 |
File folder = fileChooser.getSelectedFile(); |
|
337 |
List<PortableView> maps = |
|
338 |
manager.getInstalledMaps(folder.getAbsolutePath()); |
|
339 |
if (maps.isEmpty()) { |
|
340 |
LOG.info("No maps foudn in required folder: {}", |
|
341 |
folder.getAbsolutePath()); |
|
342 |
CONFIRM_DIALOG_OPTION resp = |
|
343 |
winManager.showConfirmDialog(mainFrame, |
|
344 |
"No maps found. Select this folder anyway?", |
|
345 |
"Set PortableView folder", CONFIRM_DIALOG_TYPE.YES_NO, |
|
346 |
MESSAGE_DIALOG_TYPE.WARNING); |
|
347 |
if (resp != CONFIRM_DIALOG_OPTION.OK_YES) { |
|
348 |
return; |
|
349 |
} |
|
350 |
} |
|
351 |
LOG.info("Selected map folder: {}", folder.getAbsolutePath()); |
|
352 |
try { |
|
353 |
manager.setInstallationMapFolder(folder.getAbsolutePath()); |
|
354 |
} catch (Exception e) { |
|
355 |
LOG.error("Error setting portable view folder", e); |
|
356 |
winManager |
|
357 |
.showMessageDialog( |
|
358 |
mainFrame, |
|
359 |
"Setting folder", |
|
360 |
"Problem foudn setting Portable View folder (See log for more information)", |
|
361 |
MESSAGE_DIALOG_TYPE.ERROR); |
|
362 |
} |
|
363 |
updateControls(); |
|
364 |
} |
|
365 |
|
|
366 |
/** |
|
367 |
* Shows a dialog to select a Portable View to open |
|
368 |
*/ |
|
369 |
public void showOpenPortableViewDialog() { |
|
370 |
if (manager.getInstallationMapFolder() == null) { |
|
371 |
LOG.warn("portable view folder not set on open Portable View request"); |
|
372 |
winManager.showMessageDialog(mainFrame, "Open a Portable View", |
|
373 |
"Select a Portable View folder first", MESSAGE_DIALOG_TYPE.INFO); |
|
374 |
return; |
|
375 |
} |
|
376 |
OpenPortableView openPortableView = |
|
377 |
new OpenPortableView(this, manager.getInstalledMaps()); |
|
378 |
winManager.showWindow(openPortableView, "Open a Portable View...", |
|
379 |
MODE.DIALOG); |
|
380 |
} |
|
381 |
|
|
382 |
/** |
|
383 |
* Opens a portable view in main frame |
|
384 |
* |
|
385 |
* @param curMap |
|
386 |
* @return |
|
387 |
*/ |
|
388 |
public boolean openMap(PortableView curMap) { |
|
389 |
PortableViewViewer viewer; |
|
390 |
try { |
|
391 |
viewer = swingManager.getViewer(curMap); |
|
392 |
} catch (Exception e) { |
|
393 |
LOG.error("Can't open map", e); |
|
394 |
winManager.showMessageDialog(mainFrame, "Open Portable View", |
|
395 |
"Problem found opening map (see log for details)", |
|
396 |
MESSAGE_DIALOG_TYPE.ERROR); |
|
397 |
return false; |
|
398 |
} |
|
399 |
doCloseMap(); |
|
400 |
|
|
401 |
mainFrame.add(viewer.getSwingComponent(), BorderLayout.CENTER); |
|
402 |
curViewer = viewer; |
|
403 |
updateControls(); |
|
404 |
return true; |
|
405 |
} |
|
406 |
|
|
407 |
/** |
|
408 |
* Closes the current portable view |
|
409 |
*/ |
|
410 |
public void closeMap() { |
|
411 |
doCloseMap(); |
|
412 |
updateControls(); |
|
413 |
} |
|
414 |
|
|
415 |
/** |
|
416 |
* Removes portable view view from main frame |
|
417 |
*/ |
|
418 |
private void doCloseMap() { |
|
419 |
if (curViewer != null) { |
|
420 |
mainFrame.remove(curViewer.getSwingComponent()); |
|
421 |
try { |
|
422 |
curViewer.getPortableView().close(); |
|
423 |
} catch (IOException e) { |
|
424 |
LOG.warn("Exception clossing map", e); |
|
425 |
} |
|
426 |
curViewer = null; |
|
427 |
} |
|
428 |
} |
|
429 |
|
|
430 |
/** |
|
431 |
* Update actions ability and updates main frame content |
|
432 |
*/ |
|
433 |
public void updateControls() { |
|
434 |
showOpenPortableViewDialogAction.setEnabled(manager |
|
435 |
.getInstallationMapFolder() != null); |
|
436 |
createCompilationAction |
|
437 |
.setEnabled(manager.getInstallationMapFolder() != null); |
|
438 |
createCompilationFromMapAction.setEnabled(curViewer != null); |
|
439 |
setZoomToolAction.setEnabled(curViewer != null); |
|
440 |
setPanToolAction.setEnabled(curViewer != null); |
|
441 |
closePortableViewAction.setEnabled(curViewer != null); |
|
442 |
zoomAllAction.setEnabled(curViewer != null); |
|
443 |
installPortableViews |
|
444 |
.setEnabled(manager.getInstallationMapFolder() != null); |
|
445 |
|
|
446 |
mainFrame.getContentPane().invalidate(); |
|
447 |
mainFrame.doLayout(); |
|
448 |
Dimension d = mainFrame.getSize(); |
|
449 |
d.width--; |
|
450 |
mainFrame.setSize(d); |
|
451 |
d.width++; |
|
452 |
mainFrame.setSize(d); |
|
453 |
|
|
454 |
} |
|
455 |
|
|
456 |
/** |
|
457 |
* Sets the zoom tool |
|
458 |
*/ |
|
459 |
public void setZoomTool() { |
|
460 |
if (curViewer != null) { |
|
461 |
curViewer.setTool(MapToolsRegistrant.TOOL_ZOOM_ID); |
|
462 |
} |
|
463 |
} |
|
464 |
|
|
465 |
/** |
|
466 |
* Sets the pan tool |
|
467 |
*/ |
|
468 |
public void setPanTool() { |
|
469 |
if (curViewer != null) { |
|
470 |
curViewer.setTool(MapToolsRegistrant.TOOL_PAN_ID); |
|
471 |
} |
|
472 |
} |
|
473 |
|
|
474 |
/** |
|
475 |
* Zoom to all portable view contents |
|
476 |
*/ |
|
477 |
public void zoomAll() { |
|
478 |
if (curViewer != null) { |
|
479 |
curViewer.zoomAll(); |
|
480 |
} |
|
481 |
} |
|
482 |
|
|
483 |
/** |
|
484 |
* Exit from app |
|
485 |
*/ |
|
486 |
public void exit() { |
|
487 |
// Close current portable view |
|
488 |
closeMap(); |
|
489 |
|
|
490 |
// clean resources |
|
491 |
try { |
|
492 |
disposeManager.releaseAll(); |
|
493 |
} catch (BaseException e) { |
|
494 |
LOG.warn("Problems dispossing", e); |
|
495 |
} |
|
496 |
|
|
497 |
try { |
|
498 |
Thread.sleep(200); |
|
499 |
} catch (InterruptedException e) { |
|
500 |
// Do nothing |
|
501 |
} |
|
502 |
|
|
503 |
// exit app |
|
504 |
System.exit(0); |
|
505 |
} |
|
506 |
|
|
507 |
public void createCompilation() { |
|
508 |
PortableViewCompilation compilation = |
|
509 |
manager.createCompilationInstance(); |
|
510 |
|
|
511 |
PortableViewCompilationEditor editor = |
|
512 |
swingManager.getCopilationEditor(compilation, true); |
|
513 |
|
|
514 |
editor.setListener(new PortableViewCompilationEditorListener() { |
|
515 |
|
|
516 |
public void finished(PortableViewCompilationEditor editor) { |
|
517 |
CONFIRM_DIALOG_OPTION resp = |
|
518 |
winManager.showConfirmDialog(mainFrame, |
|
519 |
"Compile portable view", "Create a compilation", |
|
520 |
CONFIRM_DIALOG_TYPE.YES_NO, |
|
521 |
MESSAGE_DIALOG_TYPE.QUESTION); |
|
522 |
if (resp != CONFIRM_DIALOG_OPTION.OK_YES) { |
|
523 |
winManager.showMessageDialog(mainFrame, |
|
524 |
"Create a compilation", |
|
525 |
"Process finished: no compiled", |
|
526 |
MESSAGE_DIALOG_TYPE.INFO); |
|
527 |
return; |
|
528 |
} |
|
529 |
compileMap(editor.getCompilation()); |
|
530 |
|
|
531 |
} |
|
532 |
|
|
533 |
public void canceled(PortableViewCompilationEditor editor) { |
|
534 |
// Do nothing |
|
535 |
|
|
536 |
} |
|
537 |
}); |
|
538 |
|
|
539 |
winManager.showCompilationEditor(editor, MODE.WINDOW); |
|
540 |
|
|
541 |
} |
|
542 |
|
|
543 |
public void createCompilationFromMap() { |
|
544 |
PortableViewCompilation compilation; |
|
545 |
try { |
|
546 |
compilation = |
|
547 |
manager.createCompilationInstanceFromMap(curViewer |
|
548 |
.getPortableView()); |
|
549 |
} catch (Exception ex) { |
|
550 |
winManager.showMessageDialog(mainFrame, |
|
551 |
"Create Compilation from Portable View", |
|
552 |
"Problems creating compilation (show log for more info)", |
|
553 |
MESSAGE_DIALOG_TYPE.ERROR); |
|
554 |
LOG.error("Problems creating compilation from map", ex); |
|
555 |
return; |
|
556 |
} |
|
557 |
|
|
558 |
PortableViewCompilationEditor editor = |
|
559 |
swingManager.getCopilationEditor(compilation, true); |
|
560 |
|
|
561 |
editor.setListener(new PortableViewCompilationEditorListener() { |
|
562 |
|
|
563 |
public void finished(PortableViewCompilationEditor editor) { |
|
564 |
CONFIRM_DIALOG_OPTION resp = |
|
565 |
winManager.showConfirmDialog(mainFrame, |
|
566 |
"Compile portable view", "Create a compilation", |
|
567 |
CONFIRM_DIALOG_TYPE.YES_NO, |
|
568 |
MESSAGE_DIALOG_TYPE.QUESTION); |
|
569 |
if (resp != CONFIRM_DIALOG_OPTION.OK_YES) { |
|
570 |
winManager.showMessageDialog(mainFrame, |
|
571 |
"Create a compilation", |
|
572 |
"Process finished: no compiled", |
|
573 |
MESSAGE_DIALOG_TYPE.INFO); |
|
574 |
return; |
|
575 |
} |
|
576 |
compileMap(editor.getCompilation()); |
|
577 |
|
|
578 |
} |
|
579 |
|
|
580 |
public void canceled(PortableViewCompilationEditor editor) { |
|
581 |
// Do nothing |
|
582 |
|
|
583 |
} |
|
584 |
}); |
|
585 |
|
|
586 |
winManager.showCompilationEditor(editor, MODE.WINDOW); |
|
587 |
|
|
588 |
} |
|
589 |
|
|
590 |
public void installPortableView() { |
|
591 |
AbstractInstallerWizard panel; |
|
592 |
try { |
|
593 |
panel = |
|
594 |
swingInstallerManager.createInstallPackageWizard(new File("."), |
|
595 |
new File(manager.getInstallationMapFolder())); |
|
596 |
} catch (InstallPackageWizardException ex) { |
|
597 |
LOG.error("Error opening installer panel", ex); |
|
598 |
winManager.showMessageDialog("Install Portable Views", |
|
599 |
"Error opening installer panel", MESSAGE_DIALOG_TYPE.ERROR); |
|
600 |
return; |
|
601 |
|
|
602 |
} |
|
603 |
|
|
604 |
winManager.showWindow(panel, "Install Portable View", MODE.DIALOG); |
|
605 |
|
|
606 |
} |
|
607 |
|
|
608 |
public void addPortableViewUrl() { |
|
609 |
String inUrl = |
|
610 |
winManager.showInputStringDialog("Input the url", |
|
611 |
"Add install Portable View URL", "http://", |
|
612 |
MESSAGE_DIALOG_TYPE.QUESTION); |
|
613 |
URL url; |
|
614 |
try { |
|
615 |
url = new URL(inUrl); |
|
616 |
} catch (Exception ex) { |
|
617 |
LOG.error("Invalid URL: ".concat(inUrl).concat("'"), ex); |
|
618 |
winManager.showMessageDialog("Add install Portable View URL", |
|
619 |
"Invalid URL: '".concat(inUrl).concat("'"), |
|
620 |
MESSAGE_DIALOG_TYPE.ERROR); |
|
621 |
return; |
|
622 |
} |
|
623 |
swingInstallerManager.addDefaultDownloadURL(url); |
|
624 |
} |
|
625 |
|
|
626 |
public void compileMap(PortableViewCompilation compilation) { |
|
627 |
PortableViewCompiler compiler = manager.createCompilerInstance(); |
|
628 |
compiler.setTargetFolder(manager.getInstallationMapFolder()); |
|
629 |
File workFolder = |
|
630 |
new File(manager.getTemporalFolder() + File.separatorChar |
|
631 |
+ "compiler"); |
|
632 |
workFolder.mkdirs(); |
|
633 |
compiler.setWorkFolder(workFolder.getAbsolutePath() |
|
634 |
+ File.separatorChar); |
|
635 |
|
|
636 |
compiler.setCompilerListener(new CompilerProcessListener(LOG)); |
|
637 |
PortableViewCompilerStatus resul = compiler.compile(compilation); |
|
638 |
|
|
639 |
if (resul.getStatus() != PortableViewCompilerStatus.Status.finished_ok) { |
|
640 |
winManager.showMessageDialog(mainFrame, "Compile Portable View", |
|
641 |
"Problems found in process (show log for more info)", |
|
642 |
MESSAGE_DIALOG_TYPE.ERROR); |
|
643 |
return; |
|
644 |
|
|
645 |
} |
|
646 |
winManager.showMessageDialog(mainFrame, "Compile Portable View", |
|
647 |
"<html>Process successful:<br>" |
|
648 |
+ resul.getGeneratedPortableViewFile().getAbsolutePath() |
|
649 |
+ "</html>", MESSAGE_DIALOG_TYPE.INFO); |
|
650 |
|
|
651 |
CONFIRM_DIALOG_OPTION generatePkg = |
|
652 |
winManager.showConfirmDialog( |
|
653 |
"Would you like to generete a gvSIG pakage file?", |
|
654 |
"Compile Portable View", CONFIRM_DIALOG_TYPE.YES_NO, |
|
655 |
MESSAGE_DIALOG_TYPE.QUESTION); |
|
656 |
|
|
657 |
if (generatePkg != CONFIRM_DIALOG_OPTION.OK_YES) { |
|
658 |
return; |
|
659 |
} |
|
660 |
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
|
661 |
int targetFolderAnswere = |
|
662 |
fileChooser.showDialog(mainFrame, |
|
663 |
"Select folder where store the package file"); |
|
664 |
if (targetFolderAnswere != JFileChooser.APPROVE_OPTION) { |
|
665 |
return; |
|
666 |
} |
|
667 |
File gvsigPkg = null; |
|
668 |
try { |
|
669 |
gvsigPkg = |
|
670 |
manager.generatePackageFile( |
|
671 |
resul.getGeneratedInstalationPortableViewFolder(), |
|
672 |
fileChooser.getSelectedFile()); |
|
673 |
} catch (Exception ex) { |
|
674 |
LOG.error("Error generating gvSIG package", ex); |
|
675 |
winManager |
|
676 |
.showMessageDialog( |
|
677 |
mainFrame, |
|
678 |
"Compile Portable View", |
|
679 |
"Problems found generating gvSIG package (show log for more info)", |
|
680 |
MESSAGE_DIALOG_TYPE.ERROR); |
|
681 |
return; |
|
682 |
|
|
683 |
} |
|
684 |
winManager.showMessageDialog(mainFrame, "Compile Portable View", |
|
685 |
"<html>Generated gvSIG package:<br>" + gvsigPkg.getAbsolutePath() |
|
686 |
+ "</html>", MESSAGE_DIALOG_TYPE.INFO); |
|
687 |
} |
|
688 |
|
|
689 |
private class CompilerProcessListener implements |
|
690 |
PortableViewCompilerListener { |
|
691 |
|
|
692 |
private final Logger log; |
|
693 |
|
|
694 |
public CompilerProcessListener(Logger log) { |
|
695 |
this.log = log; |
|
696 |
} |
|
697 |
|
|
698 |
public void updatedStatus(PortableViewCompilerStatus currentStatus) { |
|
699 |
if (log.isDebugEnabled()) { |
|
700 |
log.debug( |
|
701 |
"Process status:\n\tStatus: {}\n\tStep: {}/{} ({}%)\n\tMessage: '{}'", |
|
702 |
new Object[] { currentStatus.getStatus().name(), |
|
703 |
currentStatus.getCurrentStep(), |
|
704 |
currentStatus.getTotalSteps(), |
|
705 |
currentStatus.getCompleted(), currentStatus.getLabel() }); |
|
706 |
} |
|
707 |
|
|
708 |
} |
|
709 |
|
|
710 |
public void notifyWarning(String message, |
|
711 |
PortableViewCompilerStatus currentStatus) { |
|
712 |
log.warn("Process warining: {}", message); |
|
713 |
|
|
714 |
} |
|
715 |
|
|
716 |
public void notifyException(PortableViewCompilerStatus currentStatus) { |
|
717 |
log.error("Process error: {}", currentStatus.getFailMessage()); |
|
718 |
} |
|
719 |
|
|
720 |
} |
|
721 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/src/main/java/org/gvsig/educa/portableview/main/OpenPortableView.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.educa.portableview.main; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.List; |
|
29 |
|
|
30 |
import javax.swing.AbstractAction; |
|
31 |
import javax.swing.Box; |
|
32 |
import javax.swing.BoxLayout; |
|
33 |
import javax.swing.JButton; |
|
34 |
import javax.swing.JLabel; |
|
35 |
import javax.swing.JList; |
|
36 |
import javax.swing.JPanel; |
|
37 |
import javax.swing.JScrollPane; |
|
38 |
import javax.swing.ListSelectionModel; |
|
39 |
import javax.swing.event.ListSelectionEvent; |
|
40 |
import javax.swing.event.ListSelectionListener; |
|
41 |
|
|
42 |
import org.gvsig.educa.portableview.map.PortableView; |
|
43 |
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator; |
|
44 |
import org.gvsig.educa.portableview.swing.PortableViewSwingManager; |
|
45 |
import org.gvsig.educa.portableview.swing.viewer.PortableViewInforamtionViewer; |
|
46 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
47 |
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager; |
|
48 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
49 |
|
|
50 |
/** |
|
51 |
* Open Portable View dialog |
|
52 |
* |
|
53 |
* @author gvSIG Team |
|
54 |
* @version $Id$ |
|
55 |
* |
|
56 |
*/ |
|
57 |
public class OpenPortableView extends JPanel implements ListSelectionListener { |
|
58 |
|
|
59 |
/** |
|
60 |
* |
|
61 |
*/ |
|
62 |
private static final long serialVersionUID = 1L; |
|
63 |
|
|
64 |
private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory |
|
65 |
.getLogger(OpenPortableView.class); |
|
66 |
|
|
67 |
private final PortableViewSwingManager swingManager; |
|
68 |
private final DynObjectSwingManager dynSwingManager; |
|
69 |
private final UsabilitySwingManager usabManager; |
|
70 |
|
|
71 |
private final Main main; |
|
72 |
|
|
73 |
private List<PortableView> maps; |
|
74 |
private final List<String> mapNames; |
|
75 |
private JPanel listPanel; |
|
76 |
private JList list; |
|
77 |
private JPanel informationPanel; |
|
78 |
private PortableViewInforamtionViewer information; |
|
79 |
|
|
80 |
private JPanel actionPanel; |
|
81 |
private JButton botOpen; |
|
82 |
private JButton botCancel; |
|
83 |
private PortableView curMap; |
|
84 |
|
|
85 |
private int lastSelectedIndex; |
|
86 |
|
|
87 |
private JPanel container; |
|
88 |
|
|
89 |
public OpenPortableView(Main main, List<PortableView> installedMaps) { |
|
90 |
super(); |
|
91 |
|
|
92 |
this.main = main; |
|
93 |
swingManager = PortableViewSwingLocator.getSwingManager(); |
|
94 |
|
|
95 |
dynSwingManager = ToolsSwingLocator.getDynObjectSwingManager(); |
|
96 |
usabManager = ToolsSwingLocator.getUsabilitySwingManager(); |
|
97 |
|
|
98 |
maps = installedMaps; |
|
99 |
mapNames = new ArrayList<String>(installedMaps.size()); |
|
100 |
for (PortableView map : maps) { |
|
101 |
mapNames.add(map.getInformation().getName()); |
|
102 |
} |
|
103 |
curMap = null; |
|
104 |
lastSelectedIndex = -1; |
|
105 |
|
|
106 |
initializeUI(); |
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Initialize user interface |
|
112 |
* |
|
113 |
*/ |
|
114 |
private void initializeUI() { |
|
115 |
setLayout(new BorderLayout(5, 5)); |
|
116 |
|
|
117 |
setMaximumSize(new Dimension(300, 200)); |
|
118 |
setPreferredSize(new Dimension(800, 600)); |
|
119 |
|
|
120 |
list = new JList(mapNames.toArray()); |
|
121 |
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
|
122 |
list.addListSelectionListener(this); |
|
123 |
|
|
124 |
listPanel = new JPanel(); |
|
125 |
listPanel.setLayout(new BorderLayout(5, 5)); |
|
126 |
listPanel.add(new JLabel("Portable Views availables:"), |
|
127 |
BorderLayout.NORTH); |
|
128 |
listPanel.add(list, BorderLayout.CENTER); |
|
129 |
|
|
130 |
add(new JScrollPane(listPanel), BorderLayout.WEST); |
|
131 |
|
|
132 |
informationPanel = new JPanel(); |
|
133 |
informationPanel.setLayout(new BorderLayout(5, 5)); |
|
134 |
|
|
135 |
informationPanel.add(new JLabel("Portable View information:"), |
|
136 |
BorderLayout.NORTH); |
|
137 |
|
|
138 |
information = swingManager.newInformationViewer(); |
|
139 |
informationPanel.add(information.getSwingComponent(), |
|
140 |
BorderLayout.CENTER); |
|
141 |
|
|
142 |
add(informationPanel, BorderLayout.CENTER); |
|
143 |
|
|
144 |
actionPanel = new JPanel(); |
|
145 |
BoxLayout actionPanelLayout = |
|
146 |
new BoxLayout(actionPanel, BoxLayout.X_AXIS); |
|
147 |
actionPanel.setLayout(actionPanelLayout); |
|
148 |
|
|
149 |
actionPanel.add(Box.createHorizontalGlue()); |
|
150 |
|
|
151 |
botOpen = usabManager.createJButton(new AbstractAction("Open Map") { |
|
152 |
|
|
153 |
/** |
|
154 |
* |
|
155 |
*/ |
|
156 |
private static final long serialVersionUID = -3437007146684939225L; |
|
157 |
|
|
158 |
public void actionPerformed(ActionEvent e) { |
|
159 |
openSelected(); |
|
160 |
} |
|
161 |
}); |
|
162 |
botOpen.setEnabled(false); |
|
163 |
|
|
164 |
botCancel = usabManager.createJButton(new AbstractAction("Cancel") { |
|
165 |
|
|
166 |
/** |
|
167 |
* |
|
168 |
*/ |
|
169 |
private static final long serialVersionUID = -2227776656041247582L; |
|
170 |
|
|
171 |
public void actionPerformed(ActionEvent e) { |
|
172 |
close(); |
|
173 |
} |
|
174 |
}); |
|
175 |
|
|
176 |
actionPanel.add(botOpen); |
|
177 |
actionPanel.add(Box.createHorizontalStrut(10)); |
|
178 |
actionPanel.add(botCancel); |
|
179 |
actionPanel.add(Box.createHorizontalStrut(5)); |
|
180 |
|
|
181 |
add(actionPanel, BorderLayout.SOUTH); |
|
182 |
|
|
183 |
} |
|
184 |
|
|
185 |
/** |
|
186 |
* Opens selected portable view |
|
187 |
*/ |
|
188 |
private void openSelected() { |
|
189 |
if (curMap == null) { |
|
190 |
return; |
|
191 |
} |
|
192 |
main.openMap(curMap); |
|
193 |
close(); |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* Close this dialog |
|
198 |
*/ |
|
199 |
private void close() { |
|
200 |
this.setVisible(false); |
|
201 |
maps = null; |
|
202 |
curMap = null; |
|
203 |
} |
|
204 |
|
|
205 |
/** |
|
206 |
* Update UI with Portable list selection |
|
207 |
*/ |
|
208 |
public void valueChanged(ListSelectionEvent e) { |
|
209 |
int index = list.getSelectedIndex(); |
|
210 |
if (index == lastSelectedIndex) { |
|
211 |
return; |
|
212 |
} |
|
213 |
lastSelectedIndex = index; |
|
214 |
if (index < 0) { |
|
215 |
if (information != null) { |
|
216 |
information.clean(); |
|
217 |
} |
|
218 |
botOpen.setEnabled(false); |
|
219 |
return; |
|
220 |
} |
|
221 |
botOpen.setEnabled(true); |
|
222 |
curMap = maps.get(index); |
|
223 |
information.loadMapInformation(curMap); |
|
224 |
} |
|
225 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/src/main/java/org/gvsig/educa/portableview/main/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.educa.portableview package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>PortableView library testing and demo application.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/src/main/java/org/gvsig/educa/portableview/main/MapToolsRegistrant.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.educa.portableview.main; |
|
23 |
|
|
24 |
import org.gvsig.educa.portableview.swing.viewer.MapControlToolRegistrant; |
|
25 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
26 |
import org.gvsig.fmap.mapcontrol.tools.PanListenerImpl; |
|
27 |
import org.gvsig.fmap.mapcontrol.tools.ZoomInListenerImpl; |
|
28 |
import org.gvsig.fmap.mapcontrol.tools.ZoomOutRightButtonListener; |
|
29 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
|
30 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior; |
|
31 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MoveBehavior; |
|
32 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior; |
|
33 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.RectangleBehavior; |
|
34 |
|
|
35 |
/** |
|
36 |
* @author gvSIG Team |
|
37 |
* @version $Id$ |
|
38 |
* |
|
39 |
*/ |
|
40 |
public class MapToolsRegistrant implements MapControlToolRegistrant { |
|
41 |
|
|
42 |
public static final String TOOL_ZOOM_ID = "zoom"; |
|
43 |
|
|
44 |
public static final String TOOL_PAN_ID = "pan"; |
|
45 |
|
|
46 |
public void registerTools(MapControl mapControl) { |
|
47 |
// Adds tools to mapControl |
|
48 |
// mouseWhell |
|
49 |
mapControl.addCombinedBehavior(new MouseWheelBehavior()); |
|
50 |
// zoom |
|
51 |
mapControl.addBehavior(TOOL_ZOOM_ID, new Behavior[] { |
|
52 |
new RectangleBehavior(new ZoomInListenerImpl(mapControl)), |
|
53 |
new PointBehavior(new ZoomOutRightButtonListener(mapControl)) }); |
|
54 |
// pan |
|
55 |
mapControl.addBehavior(TOOL_PAN_ID, new MoveBehavior( |
|
56 |
new PanListenerImpl(mapControl))); |
|
57 |
|
|
58 |
mapControl.setTool(TOOL_PAN_ID); |
|
59 |
} |
|
60 |
|
|
61 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/src/main/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 2 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<!-- |
|
30 |
Log4J configuration file for unit tests execution. |
|
31 |
--> |
|
32 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
33 |
|
|
34 |
<!-- Appender configuration to show logging messages through the console --> |
|
35 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
36 |
<layout class="org.apache.log4j.PatternLayout"> |
|
37 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
38 |
</layout> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<!-- |
|
42 |
Activate logging messages of DEBUG level of higher only for the |
|
43 |
org.gvsig.tools packages. |
|
44 |
You can put full classes names or packages instead, to configure |
|
45 |
logging for all the classes and subpackages of the package. |
|
46 |
--> |
|
47 |
<category name="org.gvsig.tools"> |
|
48 |
<priority value="DEBUG" /> |
|
49 |
</category> |
|
50 |
<category name="org.gvsig.construc"> |
|
51 |
<priority value="DEBUG" /> |
|
52 |
</category> |
|
53 |
|
|
54 |
<!-- |
|
55 |
By default, show only logging messages of INFO level or higher, |
|
56 |
through the previously configured CONSOLE appender. |
|
57 |
--> |
|
58 |
<root> |
|
59 |
<priority value="INFO" /> |
|
60 |
<appender-ref ref="CONSOLE" /> |
|
61 |
</root> |
|
62 |
</log4j:configuration> |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/src/main/resources/README.txt | ||
---|---|---|
1 |
==== |
|
2 |
gvSIG. Desktop Geographic Information System. |
|
3 |
|
|
4 |
Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
|
|
6 |
This program is free software; you can redistribute it and/or |
|
7 |
modify it under the terms of the GNU General Public License |
|
8 |
as published by the Free Software Foundation; either version 2 |
|
9 |
of the License, or (at your option) any later version. |
|
10 |
|
|
11 |
This program is distributed in the hope that it will be useful, |
|
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
GNU General Public License for more details. |
|
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
|
17 |
along with this program; if not, write to the Free Software |
|
18 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
MA 02110-1301, USA. |
|
20 |
|
|
21 |
For any additional information, do not hesitate to contact us |
|
22 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
==== |
|
24 |
|
|
25 |
Put into this folder the resources needed by your classes. |
|
26 |
|
|
27 |
This folder is added to the classpath, so you can load any resources |
|
28 |
through the ClassLoader. |
|
29 |
|
|
30 |
By default, in this folder you can find an example of log4j configuration, |
|
31 |
prepared to log messages through the console, so logging works when you |
|
32 |
run your classes. |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.3/org.gvsig.educa.portableview.main/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.educa.portableview.main</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.educa.portableview.main</name> |
|
7 |
<version>1.0.2-SNAPSHOT</version> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.educa.portableview</artifactId> |
|
12 |
<version>1.0.2-SNAPSHOT</version> |
|
13 |
</parent> |
|
14 |
<build> |
|
15 |
|
|
16 |
<plugins> |
|
17 |
<plugin> |
|
18 |
<artifactId>maven-assembly-plugin</artifactId> |
|
19 |
<executions> |
|
20 |
<execution> |
|
21 |
<id>package-main</id> |
|
22 |
<phase>package</phase> |
|
23 |
<goals> |
|
24 |
<goal>single</goal> |
|
25 |
</goals> |
|
26 |
<configuration> |
|
27 |
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> |
|
28 |
<appendAssemblyId>false</appendAssemblyId> |
|
29 |
<finalName>${project.artifactId}-${project.version}</finalName> |
|
30 |
<descriptors> |
|
31 |
<descriptor>src/main/assembly/package-main.xml</descriptor> |
|
32 |
</descriptors> |
|
33 |
</configuration> |
|
34 |
</execution> |
|
35 |
</executions> |
|
36 |
</plugin> |
|
37 |
|
|
38 |
<plugin> |
|
39 |
<groupId>org.apache.maven.plugins</groupId> |
|
40 |
<artifactId>maven-jar-plugin</artifactId> |
|
41 |
<configuration> |
|
42 |
<archive> |
|
43 |
<manifest> |
|
44 |
<addClasspath>true</addClasspath> |
|
45 |
<mainClass>${main.class}</mainClass> |
|
46 |
<classpathPrefix>lib</classpathPrefix> |
|
47 |
</manifest> |
|
48 |
</archive> |
|
49 |
</configuration> |
|
50 |
</plugin> |
|
51 |
<plugin> |
|
52 |
<groupId>org.codehaus.mojo</groupId> |
|
53 |
<artifactId>exec-maven-plugin</artifactId> |
|
54 |
<executions> |
|
55 |
<execution> |
|
56 |
<goals> |
|
57 |
<goal>java</goal> |
|
58 |
</goals> |
|
59 |
</execution> |
|
60 |
</executions> |
|
61 |
<configuration> |
|
62 |
<mainClass>${main.class}</mainClass> |
|
63 |
</configuration> |
|
64 |
</plugin> |
|
65 |
</plugins> |
|
66 |
</build> |
|
67 |
|
|
68 |
<dependencies> |
|
69 |
<dependency> |
|
70 |
<groupId>org.slf4j</groupId> |
|
71 |
<artifactId>slf4j-api</artifactId> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.gvsig</groupId> |
|
75 |
<artifactId> |
|
76 |
org.gvsig.educa.portableview.lib.api |
|
77 |
</artifactId> |
|
78 |
</dependency> |
|
79 |
<dependency> |
|
80 |
<groupId>org.gvsig</groupId> |
|
81 |
<artifactId> |
|
82 |
org.gvsig.educa.portableview.lib.impl |
|
83 |
</artifactId> |
|
84 |
<scope>runtime</scope> |
|
85 |
</dependency> |
|
86 |
<dependency> |
|
87 |
<groupId>org.gvsig</groupId> |
|
88 |
<artifactId> |
|
89 |
org.gvsig.educa.portableview.swing.api |
|
90 |
</artifactId> |
|
91 |
</dependency> |
|
92 |
<dependency> |
|
93 |
<groupId>org.gvsig</groupId> |
|
94 |
<artifactId> |
|
95 |
org.gvsig.educa.portableview.swing.impl |
|
96 |
</artifactId> |
|
97 |
<scope>runtime</scope> |
|
98 |
</dependency> |
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.installer.swing.api</artifactId> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.installer.swing.impl</artifactId> |
|
106 |
<scope>runtime</scope> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.gvsig</groupId> |
|
110 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
111 |
</dependency> |
|
112 |
<dependency> |
|
113 |
<groupId>org.gvsig</groupId> |
|
114 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
115 |
</dependency> |
|
116 |
<dependency> |
|
117 |
<groupId>org.gvsig</groupId> |
|
118 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
119 |
</dependency> |
|
120 |
<dependency> |
|
121 |
<groupId>org.gvsig</groupId> |
|
122 |
<artifactId>org.gvsig.fmap.geometry.impl</artifactId> |
|
123 |
<scope>runtime</scope> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>org.gvsig</groupId> |
|
127 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
128 |
</dependency> |
|
129 |
<dependency> |
|
130 |
<groupId>org.gvsig</groupId> |
|
131 |
<artifactId>org.gvsig.timesupport.lib.impl</artifactId> |
|
132 |
<scope>runtime</scope> |
|
133 |
</dependency> |
|
134 |
<dependency> |
|
135 |
<groupId>org.gvsig</groupId> |
|
136 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
137 |
<scope>runtime</scope> |
|
138 |
</dependency> |
|
139 |
<dependency> |
|
140 |
<groupId>org.gvsig</groupId> |
|
141 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
142 |
</dependency> |
|
143 |
<dependency> |
|
144 |
<groupId>org.gvsig</groupId> |
|
145 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
146 |
<scope>runtime</scope> |
|
147 |
</dependency> |
|
148 |
<dependency> |
|
149 |
<groupId>org.gvsig</groupId> |
|
150 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
151 |
</dependency> |
|
152 |
<dependency> |
|
153 |
<groupId>org.gvsig</groupId> |
|
154 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
155 |
<scope>runtime</scope> |
|
156 |
</dependency> |
|
157 |
<dependency> |
|
158 |
<groupId>org.gvsig</groupId> |
|
159 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
160 |
</dependency> |
|
161 |
<dependency> |
|
162 |
<groupId>org.gvsig</groupId> |
|
163 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
164 |
</dependency> |
|
165 |
<dependency> |
|
166 |
<groupId>org.gvsig</groupId> |
|
167 |
<artifactId>org.gvsig.fmap.dal.file.dbf</artifactId> |
|
168 |
<scope>runtime</scope> |
|
169 |
</dependency> |
|
170 |
<dependency> |
|
171 |
<groupId>org.gvsig</groupId> |
|
172 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
173 |
<scope>runtime</scope> |
|
174 |
</dependency> |
|
175 |
<dependency> |
|
176 |
<groupId>org.gvsig</groupId> |
|
177 |
<artifactId>org.gvsig.symbology.lib.impl</artifactId> |
|
178 |
<scope>runtime</scope> |
|
179 |
</dependency> |
|
180 |
<dependency> |
|
181 |
<groupId>org.gvsig</groupId> |
|
182 |
<artifactId>org.gvsig.fmap.dal.db.jdbc</artifactId> |
|
183 |
<scope>runtime</scope> |
|
184 |
</dependency> |
|
185 |
<dependency> |
|
186 |
<groupId>org.gvsig</groupId> |
|
187 |
<artifactId>org.gvsig.fmap.dal.db.lib</artifactId> |
|
188 |
<scope>runtime</scope> |
|
189 |
</dependency> |
|
190 |
<dependency> |
|
191 |
<groupId>org.gvsig</groupId> |
|
192 |
<artifactId>org.gvsig.postgresql.provider</artifactId> |
|
193 |
<scope>runtime</scope> |
|
194 |
</dependency> |
|
195 |
<dependency> |
|
196 |
<groupId>org.gvsig</groupId> |
|
197 |
<artifactId>org.gvsig.mysql.provider</artifactId> |
|
198 |
<scope>runtime</scope> |
|
199 |
</dependency> |
|
200 |
<dependency> |
|
201 |
<groupId>org.gvsig</groupId> |
|
202 |
<artifactId>org.gvsig.fmap.mapcontext.operation</artifactId> |
Also available in: Unified diff