Revision 1205
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/LEEME.txt | ||
---|---|---|
1 |
=============== |
|
2 |
gvSIG Educa |
|
3 |
=============== |
|
4 |
|
|
5 |
--------------------- |
|
6 |
Vistas Portables |
|
7 |
--------------------- |
|
8 |
|
|
9 |
Descripci?n |
|
10 |
============== |
|
11 |
|
|
12 |
Este directorio contiene los fuentes de la funcionalidad Vistas Portables. |
|
13 |
|
|
14 |
Requisitos |
|
15 |
============== |
|
16 |
|
|
17 |
* Maven 2.6 or higher |
|
18 |
|
|
19 |
* Java JDK 1.5 or higher |
|
20 |
|
|
21 |
Para trabajar con eclipse |
|
22 |
-------------------------- |
|
23 |
|
|
24 |
Ver `Gu?a del desarrollador en gvSIG.org <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/>`_ y el fichero ``REAME-ECLIPSE.txt`` |
|
25 |
|
|
26 |
Contenido |
|
27 |
========== |
|
28 |
|
|
29 |
org.gvsig.educa.portableview.lib |
|
30 |
--------------------------------- |
|
31 |
|
|
32 |
Fuentes de la funcionalidad. Estos proyectos contienen los procesos y l?gica principal sin dependencias de interface de usuario. |
|
33 |
|
|
34 |
org.gvsig.educa.portableview.swing |
|
35 |
------------------------------------- |
|
36 |
|
|
37 |
Componentes de interface de usuario para gestionar los servicios que ofrece la librer??a. |
|
38 |
|
|
39 |
org.gvsig.educa.portableview.main |
|
40 |
----------------------------------- |
|
41 |
|
|
42 |
Peque?a aplicaci?n que permite ejecutar las funcionalidades y realizar pruebas funcionales. |
|
43 |
|
|
44 |
Ver `Ejecutar aplicaci?n de pruebas`_ para saber como arrancarla. |
|
45 |
|
|
46 |
pom.xml |
|
47 |
--------- |
|
48 |
|
|
49 |
Archivo de definici?n de proyecto Maven. |
|
50 |
|
|
51 |
README.txt LEEME.txt |
|
52 |
---------------------- |
|
53 |
|
|
54 |
Este fichero (en formato reStructureText, para mas informaci?n sobre este ver el `portal de gvSIG <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/guia-para-documentar/el-formato-restructuredtext>`_ en la `referencia de docUtils <http://docutils.sourceforge.net/rst.html>`_) |
|
55 |
|
|
56 |
|
|
57 |
Compilaci?n |
|
58 |
================ |
|
59 |
|
|
60 |
Desde el shell |
|
61 |
---------------- |
|
62 |
|
|
63 |
Ejecute este comando:: |
|
64 |
|
|
65 |
org.gvsig.educa.portablewview$ mvn clean install |
|
66 |
|
|
67 |
|
|
68 |
Desde eclipse |
|
69 |
-------------- |
|
70 |
Ver `Trabajar con un proyecto de la gu?a de desarrollador en gvSIG.org <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/trabajar-con-un-proyecto>`_ |
|
71 |
|
|
72 |
En algunos proyectos puede que sea necesario user el comando ``mvn eclipse:clean eclipse:eclipse`` e importar como *Standar/Import existing project...* en vez de cargar como *Maven Project*. Esto es debido a que, en algunas circunstancias, parece que el plugin de Maven del eclipse no prepara el *classpath* de forma correcta. |
|
73 |
|
|
74 |
|
|
75 |
Empaquetado |
|
76 |
=============== |
|
77 |
|
|
78 |
Esta funcionalidad no tiene ning?n proyecto pensado para empaquetar de forma independiente. |
|
79 |
|
|
80 |
Versionado |
|
81 |
-------------- |
|
82 |
|
|
83 |
Para cambiar el n?mero de versi?n de los plugins solo es necesario ajustar la etiqueta ``project/version`` del fichero *pom.xml*. Los subproyectos heredar?n el valor. |
|
84 |
|
|
85 |
La pol??tica de versi?n es la est?ndar. Los cambios en los numeroso son: |
|
86 |
|
|
87 |
* tercer n?mero: Arreglo de errores y mejoras menores. Sin cambios en el API. |
|
88 |
* segundo n?mero: Arreglo de erroes y mejoras. Pueden haber cambios menores en el API. Los elementos marcados como *deprecated* en versiones anteriores pueden eliminarse. Sin cambios de arquitectura. |
|
89 |
* primer n?mero: Cambios mayores. |
|
90 |
|
|
91 |
Crear un tag |
|
92 |
------------------ |
|
93 |
|
|
94 |
TODO: usar el plugin *release* de maven |
|
95 |
|
|
96 |
Usar el comando *svn copy*. El proceso podr?a ser: |
|
97 |
|
|
98 |
#. Comprobar que no hay cambios en la copia local:: |
|
99 |
|
|
100 |
svn up ; svn status |
|
101 |
|
|
102 |
#. Comprobar que los proyecto compilan y pasan todas las bater?as de test:: |
|
103 |
|
|
104 |
mvn clean install |
|
105 |
|
|
106 |
#. Actualizar el fichero *pom.xml* con la versi?n de tag (normalmente quitando el sufijo *-SNAPSHOT*) |
|
107 |
#. Crear el directorio para el tag en el servidor:: |
|
108 |
|
|
109 |
svn mkdir -m "Create {version} tag folder" https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.portablewview.app/tags/{version} |
|
110 |
|
|
111 |
#. Subir la copia local al directorio del tag en el servidor:: |
|
112 |
|
|
113 |
svn copy -m "Create {version} tag" * https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.portablewview.app/tags/{version} |
|
114 |
|
|
115 |
#. Actualizar el *pom.xml* a la siguiente version (y a?adirle el sufijo *-SNAPSHOT*) |
|
116 |
#. Subir los cambios del *pom.xml*:: |
|
117 |
|
|
118 |
svn commit -m "Set new version {version}-SNAPSHOT" pom.xml |
|
119 |
|
|
120 |
|
|
121 |
i18n |
|
122 |
====== |
|
123 |
|
|
124 |
Los ficheros de internacionalizaci?n se pueden encontrar en los directorios: |
|
125 |
|
|
126 |
+ */org.gvsig.educa.portableview.swing/org.gvsig.educa.portableview.swing.impl/src/main/resources/org/gvsig/educa/portableview/swing/impl/i18n* |
|
127 |
+ *org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.impl/src/main/resources/org/gvsig/educa/portableview/impl/i18n* |
|
128 |
|
|
129 |
La internacionalizaci?n est? basada en el mecanismo est?ndar de los *resource bundle*. Para a?adir un nuevo idioma es necesario a?adir el fichero de propiedades en todos los directorio con el codigo de idioma adecuado. |
|
130 |
|
|
131 |
Ejecutar aplicaci?n de pruebas |
|
132 |
================================= |
|
133 |
|
|
134 |
Desde el Shell |
|
135 |
---------------- |
|
136 |
|
|
137 |
Despu?s del proceso de `Compilaci?n`_ , ejecute estos comandos:: |
|
138 |
|
|
139 |
org.gvsig.educa.portablewview$ cd org.gvsig.educa.portablewview.main |
|
140 |
org.gvsig.educa.portablewview/org.gvsig.educa.portablewview.main$ mvn exec:java |
|
141 |
|
|
142 |
Desde el eclipse |
|
143 |
------------------ |
|
144 |
|
|
145 |
Seleccione el proyecto ``org.gvsig.educa.portableview.main`` en el *Project tree* de la *Java perspective*, haga click con el bot?n derecho y seleccione ``Run as.../Java application``. Seleccione la clase ``Main`` del propio proyecto. |
|
146 |
|
|
147 |
Si tiene problemas al ejecutar, compruebe la nota de la secci?n `Compilaci?n`_ sobre la importaci?n del proyecto. |
|
148 |
|
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<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/xsd/maven-4.0.0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<groupId>org.gvsig</groupId> |
|
6 |
<artifactId>org.gvsig.educa.portableview.app</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<name>org.gvsig.educa.portableview.app</name> |
|
9 |
<description>Educa.PortableView plugins</description> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.educa.portableview</artifactId> |
|
13 |
<version>1.0.182</version> |
|
14 |
</parent> |
|
15 |
<properties> |
|
16 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-educa/pool</gvsig.package.info.poolURL> |
|
17 |
</properties> |
|
18 |
<dependencies> |
|
19 |
<dependency> |
|
20 |
<groupId>org.slf4j</groupId> |
|
21 |
<artifactId>slf4j-api</artifactId> |
|
22 |
<scope>compile</scope> |
|
23 |
</dependency> |
|
24 |
</dependencies> |
|
25 |
<modules> |
|
26 |
<module>org.gvsig.educa.portableview.app.viewer</module> |
|
27 |
<module>org.gvsig.educa.portableview.app.editor</module> |
|
28 |
</modules> |
|
29 |
</project> |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
<dependencySets> |
|
26 |
<dependencySet> |
|
27 |
<useProjectArtifact>false</useProjectArtifact> |
|
28 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
29 |
<outputDirectory>lib</outputDirectory> |
|
30 |
<includes> |
|
31 |
<include>org.gvsig:org.gvsig.educa.portableview.app.editor</include> |
|
32 |
</includes> |
|
33 |
</dependencySet> |
|
34 |
</dependencySets> |
|
35 |
|
|
36 |
</assembly> |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/OpenRelatedDocumentExtension.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.app.editor; |
|
23 |
|
|
24 |
import javax.swing.SwingUtilities; |
|
25 |
|
|
26 |
import org.gvsig.andami.PluginServices; |
|
27 |
import org.gvsig.andami.plugins.Extension; |
|
28 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
29 |
import org.gvsig.app.project.documents.Document; |
|
30 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
31 |
import org.gvsig.educa.portableview.app.viewer.ui.PortableViewDocumentViewer; |
|
32 |
|
|
33 |
/** |
|
34 |
* Abstract Andami extension which opens a the related document: source view of |
|
35 |
* a portable view or related portable view of a view |
|
36 |
* |
|
37 |
* @author gvSIG Team |
|
38 |
* @version $Id$ |
|
39 |
*/ |
|
40 |
public abstract class OpenRelatedDocumentExtension extends Extension { |
|
41 |
|
|
42 |
private PortableViewEditorManager editorManager; |
|
43 |
|
|
44 |
public void initialize() { |
|
45 |
// Do nothing |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void postInitialize() { |
|
50 |
editorManager = PortableViewEditorLocator.getManager(); |
|
51 |
} |
|
52 |
|
|
53 |
public void execute(String actionCommand) { |
|
54 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
55 |
final Document docToShow = getRelatedDocument(window); |
|
56 |
if (docToShow == null) { |
|
57 |
return; |
|
58 |
} |
|
59 |
|
|
60 |
SwingUtilities.invokeLater(new Runnable() { |
|
61 |
|
|
62 |
public void run() { |
|
63 |
PluginServices.getMDIManager().addWindow( |
|
64 |
docToShow.getFactory().getMainWindow(docToShow)); |
|
65 |
} |
|
66 |
}); |
|
67 |
|
|
68 |
} |
|
69 |
|
|
70 |
public boolean isEnabled() { |
|
71 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
72 |
return getRelatedDocument(window) != null; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* <p> |
|
77 |
* Returns related document to window |
|
78 |
* </p> |
|
79 |
* <p> |
|
80 |
* if window is a view return the Portable View. if it's a Portable view |
|
81 |
* returns a view. |
|
82 |
* </p> |
|
83 |
* |
|
84 |
* @param window |
|
85 |
* @return |
|
86 |
*/ |
|
87 |
private Document getRelatedDocument(IWindow window) { |
|
88 |
if (editorManager == null) { |
|
89 |
// initialization process not finished yet |
|
90 |
return null; |
|
91 |
} |
|
92 |
if (window instanceof IView) { |
|
93 |
return editorManager.getPortableViewDocumentByView(((IView) window) |
|
94 |
.getViewDocument()); |
|
95 |
} else |
|
96 |
if (window instanceof PortableViewDocumentViewer) { |
|
97 |
return ((PortableViewDocumentViewer) window) |
|
98 |
.getPortableViewDocument().getSourceView(); |
|
99 |
|
|
100 |
} |
|
101 |
return null; |
|
102 |
|
|
103 |
} |
|
104 |
|
|
105 |
public boolean isVisible() { |
|
106 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
107 |
return window instanceof IView |
|
108 |
|| window instanceof PortableViewDocumentViewer; |
|
109 |
} |
|
110 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/PortableViewEditorLocator.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.app.editor; |
|
23 |
|
|
24 |
import org.gvsig.educa.portableview.map.PortableView; |
|
25 |
import org.gvsig.tools.locator.BaseLocator; |
|
26 |
import org.gvsig.tools.locator.Locator; |
|
27 |
import org.gvsig.tools.locator.LocatorException; |
|
28 |
|
|
29 |
/** |
|
30 |
* Locator which provide access to the services to create, modify and share |
|
31 |
* {@link PortableView} |
|
32 |
* |
|
33 |
* @author gvSIG team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class PortableViewEditorLocator extends BaseLocator { |
|
37 |
|
|
38 |
/** |
|
39 |
* PortableView manager name. |
|
40 |
*/ |
|
41 |
public static final String MANAGER_NAME = "PortableViewEditor.manager"; |
|
42 |
|
|
43 |
/** |
|
44 |
* PortableView manager description. |
|
45 |
*/ |
|
46 |
public static final String MANAGER_DESCRIPTION = |
|
47 |
"PortableView Editor Manager"; |
|
48 |
|
|
49 |
private static final String LOCATOR_NAME = "PortableViewEditor.locator"; |
|
50 |
|
|
51 |
/** |
|
52 |
* Unique instance. |
|
53 |
*/ |
|
54 |
private static final PortableViewEditorLocator INSTANCE = |
|
55 |
new PortableViewEditorLocator(); |
|
56 |
|
|
57 |
/** |
|
58 |
* Return the singleton instance. |
|
59 |
* |
|
60 |
* @return the singleton instance |
|
61 |
*/ |
|
62 |
public static PortableViewEditorLocator getInstance() { |
|
63 |
return INSTANCE; |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Return the Locator's name. |
|
68 |
* |
|
69 |
* @return a String with the Locator's name |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public final String getLocatorName() { |
|
73 |
return LOCATOR_NAME; |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Return a reference to the PortableViewEditorManager. |
|
78 |
* |
|
79 |
* @return a reference to the PortableViewEditorManager |
|
80 |
* @throws LocatorException |
|
81 |
* if there is no access to the class or the class cannot be |
|
82 |
* instantiated |
|
83 |
* @see Locator#get(String) |
|
84 |
*/ |
|
85 |
public static PortableViewEditorManager getManager() throws LocatorException { |
|
86 |
return (PortableViewEditorManager) getInstance().get(MANAGER_NAME); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Registers the Class implementing the PortableViewEditorManager interface. |
|
91 |
* |
|
92 |
* @param clazz |
|
93 |
* implementing the PortableViewManager interface |
|
94 |
*/ |
|
95 |
public static void registerManager( |
|
96 |
Class<? extends PortableViewEditorManager> clazz) { |
|
97 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
98 |
} |
|
99 |
|
|
100 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/document/OpenRelatedPortableViewAction.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.app.editor.document; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.SwingUtilities; |
|
27 |
|
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
30 |
import org.gvsig.app.project.ProjectManager; |
|
31 |
import org.gvsig.app.project.documents.AbstractDocumentAction; |
|
32 |
import org.gvsig.app.project.documents.Document; |
|
33 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
34 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorLocator; |
|
35 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorManager; |
|
36 |
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument; |
|
37 |
|
|
38 |
/** |
|
39 |
* <p> |
|
40 |
* Document action which opens the Portable View related to a View |
|
41 |
* </p> |
|
42 |
* |
|
43 |
* <p> |
|
44 |
* This action can be set on PortableViewDocuments or ViewDocuments |
|
45 |
* </p> |
|
46 |
* |
|
47 |
* @author gvSIG Team |
|
48 |
* @version $Id$ |
|
49 |
* |
|
50 |
*/ |
|
51 |
public class OpenRelatedPortableViewAction extends AbstractDocumentAction { |
|
52 |
|
|
53 |
private final PortableViewEditorManager editorManager; |
|
54 |
|
|
55 |
/** |
|
56 |
* |
|
57 |
*/ |
|
58 |
public OpenRelatedPortableViewAction() { |
|
59 |
super("OpenRelatedPortableView"); |
|
60 |
this.order = 0; |
|
61 |
this.title = PluginServices.getText(this, "open_related_portable_view"); |
|
62 |
this.group = |
|
63 |
ProjectManager.getInstance().addDocumentActionGroup( |
|
64 |
"PortableViewActions", "Portable View actions", null, 0); |
|
65 |
editorManager = PortableViewEditorLocator.getManager(); |
|
66 |
} |
|
67 |
|
|
68 |
/** {@inheridDoc} */ |
|
69 |
public boolean isVisible(Document document, List<Document> documents) { |
|
70 |
if (document != null || documents.size() != 1) { |
|
71 |
return false; |
|
72 |
} |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
76 |
/** {@inheridDoc} */ |
|
77 |
public boolean isAvailable(Document document, List<Document> documents) { |
|
78 |
Document doc = null; |
|
79 |
if (document != null) { |
|
80 |
doc = document; |
|
81 |
} else { |
|
82 |
if (documents != null && !documents.isEmpty()) { |
|
83 |
doc = documents.get(0); |
|
84 |
} |
|
85 |
} |
|
86 |
if (doc == null) { |
|
87 |
return false; |
|
88 |
} |
|
89 |
|
|
90 |
if (doc instanceof ViewDocument) { |
|
91 |
return editorManager |
|
92 |
.getPortableViewDocumentByView((ViewDocument) doc) != null; |
|
93 |
} |
|
94 |
|
|
95 |
return false; |
|
96 |
} |
|
97 |
|
|
98 |
/** {@inheridDoc} */ |
|
99 |
public void execute(Document document, List<Document> documents) { |
|
100 |
Document doc; |
|
101 |
final IWindow window; |
|
102 |
if (document != null) { |
|
103 |
doc = document; |
|
104 |
} else { |
|
105 |
if (documents.size() != 1) { |
|
106 |
return; |
|
107 |
} |
|
108 |
doc = documents.get(0); |
|
109 |
} |
|
110 |
|
|
111 |
PortableViewDocument tmDocument; |
|
112 |
|
|
113 |
if (doc instanceof ViewDocument) { |
|
114 |
tmDocument = |
|
115 |
editorManager.getPortableViewDocumentByView((ViewDocument) doc); |
|
116 |
if (tmDocument == null) { |
|
117 |
return; |
|
118 |
} |
|
119 |
window = tmDocument.getFactory().getMainWindow(tmDocument); |
|
120 |
} else { |
|
121 |
return; |
|
122 |
} |
|
123 |
|
|
124 |
SwingUtilities.invokeLater(new Runnable() { |
|
125 |
|
|
126 |
public void run() { |
|
127 |
PluginServices.getMDIManager().addWindow(window); |
|
128 |
|
|
129 |
} |
|
130 |
}); |
|
131 |
} |
|
132 |
|
|
133 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/document/OpenSourceViewAction.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.app.editor.document; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.SwingUtilities; |
|
27 |
|
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
30 |
import org.gvsig.app.project.ProjectManager; |
|
31 |
import org.gvsig.app.project.documents.AbstractDocumentAction; |
|
32 |
import org.gvsig.app.project.documents.Document; |
|
33 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
34 |
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument; |
|
35 |
|
|
36 |
/** |
|
37 |
* <p> |
|
38 |
* Document action which opens the source View of a Portable View |
|
39 |
* </p> |
|
40 |
* |
|
41 |
* <p> |
|
42 |
* This action can be set on PortableViewDocuments or ViewDocuments |
|
43 |
* </p> |
|
44 |
* |
|
45 |
* @author gvSIG Team |
|
46 |
* @version $Id$ |
|
47 |
* |
|
48 |
*/ |
|
49 |
public class OpenSourceViewAction extends AbstractDocumentAction { |
|
50 |
|
|
51 |
/** |
|
52 |
* |
|
53 |
*/ |
|
54 |
public OpenSourceViewAction() { |
|
55 |
super("OpenSourceViewExtension"); |
|
56 |
this.order = 0; |
|
57 |
this.title = PluginServices.getText(this, "open_source_view"); |
|
58 |
this.group = |
|
59 |
ProjectManager.getInstance().addDocumentActionGroup( |
|
60 |
"PortableViewActions", "Portable View actions", null, 0); |
|
61 |
} |
|
62 |
|
|
63 |
/** {@inheridDoc} */ |
|
64 |
public boolean isVisible(Document document, List<Document> documents) { |
|
65 |
if (document != null || documents.size() != 1) { |
|
66 |
return false; |
|
67 |
} |
|
68 |
return true; |
|
69 |
} |
|
70 |
|
|
71 |
/** {@inheridDoc} */ |
|
72 |
public boolean isAvailable(Document document, List<Document> documents) { |
|
73 |
Document doc = null; |
|
74 |
if (document != null) { |
|
75 |
doc = document; |
|
76 |
} else { |
|
77 |
if (documents != null && !documents.isEmpty()) { |
|
78 |
doc = documents.get(0); |
|
79 |
} |
|
80 |
} |
|
81 |
if (doc == null) { |
|
82 |
return false; |
|
83 |
} |
|
84 |
if (doc instanceof PortableViewDocument) { |
|
85 |
return ((PortableViewDocument) doc).getSourceView() != null; |
|
86 |
|
|
87 |
} |
|
88 |
|
|
89 |
return false; |
|
90 |
} |
|
91 |
|
|
92 |
/** {@inheridDoc} */ |
|
93 |
public void execute(Document document, List<Document> documents) { |
|
94 |
Document doc; |
|
95 |
final IWindow window; |
|
96 |
if (document != null) { |
|
97 |
doc = document; |
|
98 |
} else { |
|
99 |
if (documents.size() != 1) { |
|
100 |
return; |
|
101 |
} |
|
102 |
doc = documents.get(0); |
|
103 |
} |
|
104 |
|
|
105 |
PortableViewDocument tmDocument; |
|
106 |
if (doc instanceof PortableViewDocument) { |
|
107 |
tmDocument = ((PortableViewDocument) doc); |
|
108 |
ViewDocument view = tmDocument.getSourceView(); |
|
109 |
if (view == null) { |
|
110 |
return; |
|
111 |
} |
|
112 |
window = view.getFactory().getMainWindow(view); |
|
113 |
|
|
114 |
} else { |
|
115 |
return; |
|
116 |
} |
|
117 |
|
|
118 |
SwingUtilities.invokeLater(new Runnable() { |
|
119 |
|
|
120 |
public void run() { |
|
121 |
PluginServices.getMDIManager().addWindow(window); |
|
122 |
|
|
123 |
} |
|
124 |
}); |
|
125 |
} |
|
126 |
|
|
127 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/document/GeneratePackageOfPortableViewAction.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.app.editor.document; |
|
23 |
|
|
24 |
import java.io.File; |
|
25 |
import java.util.List; |
|
26 |
|
|
27 |
import javax.swing.SwingUtilities; |
|
28 |
|
|
29 |
import org.gvsig.andami.PluginServices; |
|
30 |
import org.gvsig.andami.messages.NotificationManager; |
|
31 |
import org.gvsig.app.project.ProjectManager; |
|
32 |
import org.gvsig.app.project.documents.AbstractDocumentAction; |
|
33 |
import org.gvsig.app.project.documents.Document; |
|
34 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorLocator; |
|
35 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorManager; |
|
36 |
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument; |
|
37 |
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator; |
|
38 |
import org.gvsig.educa.portableview.swing.PortableViewSwingManager; |
|
39 |
import org.gvsig.educa.portableview.swing.PortableViewWindowManager.MESSAGE_DIALOG_TYPE; |
|
40 |
|
|
41 |
/** |
|
42 |
* Document action which launch the process to generate a <i>gvpkg</i> of a |
|
43 |
* Portable View |
|
44 |
* |
|
45 |
* @author gvSIG Team |
|
46 |
* @version $Id$ |
|
47 |
* |
|
48 |
*/ |
|
49 |
public class GeneratePackageOfPortableViewAction extends AbstractDocumentAction { |
|
50 |
|
|
51 |
private final PortableViewEditorManager editorManager; |
|
52 |
private final PortableViewSwingManager swingManager; |
|
53 |
|
|
54 |
/** |
|
55 |
* |
|
56 |
*/ |
|
57 |
public GeneratePackageOfPortableViewAction() { |
|
58 |
super("GeneratePackageOfPortableView"); |
|
59 |
this.order = 0; |
|
60 |
this.title = PluginServices.getText(this, "generate_package"); |
|
61 |
this.group = |
|
62 |
ProjectManager.getInstance().addDocumentActionGroup( |
|
63 |
"PortableViewActions", "Portable View actions", null, 0); |
|
64 |
|
|
65 |
editorManager = PortableViewEditorLocator.getManager(); |
|
66 |
swingManager = PortableViewSwingLocator.getSwingManager(); |
|
67 |
} |
|
68 |
|
|
69 |
/** {@inheridDoc} */ |
|
70 |
public boolean isVisible(Document document, List<Document> documents) { |
|
71 |
if (document != null || documents.size() != 1) { |
|
72 |
return false; |
|
73 |
} |
|
74 |
return true; |
|
75 |
} |
|
76 |
|
|
77 |
/** {@inheridDoc} */ |
|
78 |
public boolean isAvailable(Document document, List<Document> documents) { |
|
79 |
return true; |
|
80 |
} |
|
81 |
|
|
82 |
/** {@inheridDoc} */ |
|
83 |
public void execute(Document document, List<Document> documents) { |
|
84 |
final PortableViewDocument tmDocument; |
|
85 |
if (document != null) { |
|
86 |
tmDocument = (PortableViewDocument) document; |
|
87 |
} else { |
|
88 |
if (documents.size() != 1) { |
|
89 |
return; |
|
90 |
} |
|
91 |
tmDocument = (PortableViewDocument) documents.get(0); |
|
92 |
} |
|
93 |
SwingUtilities.invokeLater(new Runnable() { |
|
94 |
|
|
95 |
public void run() { |
|
96 |
try { |
|
97 |
File file = editorManager.generatePackage(tmDocument); |
|
98 |
if (file != null) { |
|
99 |
swingManager.getWindowManager().showMessageDialog( |
|
100 |
swingManager.getTranslation("generate_package"), |
|
101 |
swingManager.getTranslation("generated_file") |
|
102 |
.concat(":").concat(file.getAbsolutePath()), |
|
103 |
MESSAGE_DIALOG_TYPE.INFO); |
|
104 |
} |
|
105 |
} catch (Exception ex) { |
|
106 |
NotificationManager.addError( |
|
107 |
"problems_exporting_portable_view_to_view", ex); |
|
108 |
} |
|
109 |
|
|
110 |
} |
|
111 |
}); |
|
112 |
} |
|
113 |
|
|
114 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/document/PortableViewToViewAction.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.app.editor.document; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.SwingUtilities; |
|
27 |
|
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.andami.messages.NotificationManager; |
|
30 |
import org.gvsig.app.project.ProjectManager; |
|
31 |
import org.gvsig.app.project.documents.AbstractDocumentAction; |
|
32 |
import org.gvsig.app.project.documents.Document; |
|
33 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorLocator; |
|
34 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorManager; |
|
35 |
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument; |
|
36 |
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator; |
|
37 |
import org.gvsig.educa.portableview.swing.PortableViewSwingManager; |
|
38 |
|
|
39 |
/** |
|
40 |
* Document action which exports a Portable View into a view |
|
41 |
* |
|
42 |
* @author gvSIG Team |
|
43 |
* @version $Id$ |
|
44 |
* |
|
45 |
*/ |
|
46 |
public class PortableViewToViewAction extends AbstractDocumentAction { |
|
47 |
|
|
48 |
private final PortableViewEditorManager editorManager; |
|
49 |
private final PortableViewSwingManager swingManager; |
|
50 |
|
|
51 |
/** |
|
52 |
* |
|
53 |
*/ |
|
54 |
public PortableViewToViewAction() { |
|
55 |
super("PortableViewToView"); |
|
56 |
this.order = 0; |
|
57 |
this.title = PluginServices.getText(this, "export_to_view"); |
|
58 |
this.group = |
|
59 |
ProjectManager.getInstance().addDocumentActionGroup( |
|
60 |
"PortableViewActions", "Portable View actions", null, 0); |
|
61 |
editorManager = PortableViewEditorLocator.getManager(); |
|
62 |
swingManager = PortableViewSwingLocator.getSwingManager(); |
|
63 |
} |
|
64 |
|
|
65 |
/** {@inheridDoc} */ |
|
66 |
public boolean isVisible(Document document, List<Document> documents) { |
|
67 |
if (document != null || documents.size() != 1) { |
|
68 |
return false; |
|
69 |
} |
|
70 |
return true; |
|
71 |
} |
|
72 |
|
|
73 |
/** {@inheridDoc} */ |
|
74 |
public boolean isAvailable(Document document, List<Document> documents) { |
|
75 |
return true; |
|
76 |
} |
|
77 |
|
|
78 |
/** {@inheridDoc} */ |
|
79 |
public void execute(Document document, List<Document> documents) { |
|
80 |
final PortableViewDocument tmDoc; |
|
81 |
if (document != null) { |
|
82 |
tmDoc = (PortableViewDocument) document; |
|
83 |
} else { |
|
84 |
if (documents.size() != 1) { |
|
85 |
return; |
|
86 |
} |
|
87 |
tmDoc = (PortableViewDocument) documents.get(0); |
|
88 |
} |
|
89 |
|
|
90 |
SwingUtilities.invokeLater(new Runnable() { |
|
91 |
|
|
92 |
public void run() { |
|
93 |
try { |
|
94 |
editorManager.exportPortableViewToView(tmDoc, true); |
|
95 |
} catch (Exception ex) { |
|
96 |
NotificationManager.addError( |
|
97 |
swingManager |
|
98 |
.getTranslation("problems_exporting_portable_view_to_view"), |
|
99 |
ex); |
|
100 |
} |
|
101 |
|
|
102 |
} |
|
103 |
}); |
|
104 |
|
|
105 |
} |
|
106 |
|
|
107 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/document/ViewToPortableViewAction.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.app.editor.document; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.SwingUtilities; |
|
27 |
|
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.andami.messages.NotificationManager; |
|
30 |
import org.gvsig.app.project.ProjectManager; |
|
31 |
import org.gvsig.app.project.documents.AbstractDocumentAction; |
|
32 |
import org.gvsig.app.project.documents.Document; |
|
33 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
34 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorLocator; |
|
35 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorManager; |
|
36 |
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator; |
|
37 |
import org.gvsig.educa.portableview.swing.PortableViewSwingManager; |
|
38 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
39 |
|
|
40 |
/** |
|
41 |
* Document action which create a Portable View from a View |
|
42 |
* |
|
43 |
* @author gvSIG Team |
|
44 |
* @version $Id$ |
|
45 |
* |
|
46 |
*/ |
|
47 |
public class ViewToPortableViewAction extends AbstractDocumentAction { |
|
48 |
|
|
49 |
private final PortableViewEditorManager editorManager; |
|
50 |
private final PortableViewSwingManager swingManager; |
|
51 |
|
|
52 |
/** |
|
53 |
* |
|
54 |
*/ |
|
55 |
public ViewToPortableViewAction() { |
|
56 |
super("ViewToPortableView"); |
|
57 |
this.order = 0; |
|
58 |
this.title = PluginServices.getText(this, "create_portable_view"); |
|
59 |
this.group = ProjectManager.getInstance().addDocumentActionGroup( |
|
60 |
"PortableViewActions", "Portable View actions", null, 0); |
|
61 |
editorManager = PortableViewEditorLocator.getManager(); |
|
62 |
swingManager = PortableViewSwingLocator.getSwingManager(); |
|
63 |
} |
|
64 |
|
|
65 |
/** {@inheridDoc} */ |
|
66 |
public boolean isVisible(Document document, List<Document> documents) { |
|
67 |
if (document != null || documents.size() != 1) { |
|
68 |
return false; |
|
69 |
} |
|
70 |
return true; |
|
71 |
} |
|
72 |
|
|
73 |
/** {@inheridDoc} */ |
|
74 |
public boolean isAvailable(Document document, List<Document> documents) { |
|
75 |
Document doc = null; |
|
76 |
if (document != null) { |
|
77 |
doc = document; |
|
78 |
} else { |
|
79 |
if (documents != null && !documents.isEmpty()) { |
|
80 |
doc = documents.get(0); |
|
81 |
} |
|
82 |
} |
|
83 |
if (doc == null) { |
|
84 |
return false; |
|
85 |
} |
|
86 |
|
|
87 |
if (doc instanceof ViewDocument) { |
|
88 |
MapContext mapContenxt = ((ViewDocument) doc).getMapContext(); |
|
89 |
if(mapContenxt.getLayers().getLayersCount() > 0){ |
|
90 |
return true; |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
return false; |
|
95 |
} |
|
96 |
|
|
97 |
/** {@inheridDoc} */ |
|
98 |
public void execute(Document document, List<Document> documents) { |
|
99 |
final ViewDocument viewDoc; |
|
100 |
if (document != null) { |
|
101 |
viewDoc = (ViewDocument) document; |
|
102 |
} else { |
|
103 |
if (documents.size() != 1) { |
|
104 |
return; |
|
105 |
} |
|
106 |
viewDoc = (ViewDocument) documents.get(0); |
|
107 |
} |
|
108 |
|
|
109 |
SwingUtilities.invokeLater(new Runnable() { |
|
110 |
|
|
111 |
public void run() { |
|
112 |
try { |
|
113 |
editorManager.createPortableViewFromView(viewDoc, null, |
|
114 |
true); |
|
115 |
} catch (Exception ex) { |
|
116 |
NotificationManager.addError( |
|
117 |
swingManager |
|
118 |
.getTranslation("problems_creating_portable_view_from_a_view"), |
|
119 |
ex); |
|
120 |
} |
|
121 |
|
|
122 |
} |
|
123 |
}); |
|
124 |
} |
|
125 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/document/RegeneratePortableViewFromViewAction.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.app.editor.document; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.SwingUtilities; |
|
27 |
|
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.andami.messages.NotificationManager; |
|
30 |
import org.gvsig.app.project.ProjectManager; |
|
31 |
import org.gvsig.app.project.documents.AbstractDocumentAction; |
|
32 |
import org.gvsig.app.project.documents.Document; |
|
33 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
34 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorLocator; |
|
35 |
import org.gvsig.educa.portableview.app.editor.PortableViewEditorManager; |
|
36 |
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument; |
|
37 |
|
|
38 |
/** |
|
39 |
* <p> |
|
40 |
* Document action which regenerates a Portable View from a View |
|
41 |
* </p> |
|
42 |
* |
|
43 |
* <p> |
|
44 |
* This action can be set on PortableViewDocuments or ViewDocuments |
|
45 |
* </p> |
|
46 |
* |
|
47 |
* @author gvSIG Team |
|
48 |
* @version $Id$ |
|
49 |
* |
|
50 |
*/ |
|
51 |
public class RegeneratePortableViewFromViewAction extends AbstractDocumentAction { |
|
52 |
|
|
53 |
private final PortableViewEditorManager editorManager; |
|
54 |
|
|
55 |
/** |
|
56 |
* |
|
57 |
*/ |
|
58 |
public RegeneratePortableViewFromViewAction() { |
|
59 |
super("RegeneratePortableViewFromView"); |
|
60 |
this.order = 0; |
|
61 |
this.title = |
|
62 |
PluginServices.getText(this, "regenerate_portable_view_from_a_view"); |
|
63 |
this.group = |
|
64 |
ProjectManager.getInstance().addDocumentActionGroup( |
|
65 |
"PortableViewActions", "Portable View actions", null, 0); |
|
66 |
editorManager = PortableViewEditorLocator.getManager(); |
|
67 |
} |
|
68 |
|
|
69 |
/** {@inheridDoc} */ |
|
70 |
public boolean isVisible(Document document, List<Document> documents) { |
|
71 |
if (document != null || documents.size() != 1) { |
|
72 |
return false; |
|
73 |
} |
|
74 |
return true; |
|
75 |
} |
|
76 |
|
|
77 |
/** {@inheridDoc} */ |
|
78 |
public boolean isAvailable(Document document, List<Document> documents) { |
|
79 |
Document doc = null; |
|
80 |
if (document != null) { |
|
81 |
doc = document; |
|
82 |
} else { |
|
83 |
if (documents != null && !documents.isEmpty()) { |
|
84 |
doc = documents.get(0); |
|
85 |
} |
|
86 |
} |
|
87 |
if (doc == null) { |
|
88 |
return false; |
|
89 |
} |
|
90 |
if (doc instanceof PortableViewDocument) { |
|
91 |
return ((PortableViewDocument) doc).getSourceView() != null; |
|
92 |
|
|
93 |
} else |
|
94 |
if (doc instanceof ViewDocument) { |
|
95 |
return editorManager |
|
96 |
.getPortableViewDocumentByView((ViewDocument) doc) != null; |
|
97 |
} |
|
98 |
|
|
99 |
return false; |
|
100 |
} |
|
101 |
|
|
102 |
/** {@inheridDoc} */ |
|
103 |
public void execute(Document document, List<Document> documents) { |
|
104 |
Document doc; |
|
105 |
final PortableViewDocument tmDocument; |
|
106 |
if (document != null) { |
|
107 |
doc = document; |
|
108 |
} else { |
|
109 |
if (documents.size() != 1) { |
|
110 |
return; |
|
111 |
} |
|
112 |
doc = documents.get(0); |
|
113 |
} |
|
114 |
|
|
115 |
if (doc instanceof PortableViewDocument) { |
|
116 |
tmDocument = ((PortableViewDocument) doc); |
|
117 |
|
|
118 |
} else |
|
119 |
if (doc instanceof ViewDocument) { |
|
120 |
tmDocument = |
|
121 |
editorManager |
|
122 |
.getPortableViewDocumentByView((ViewDocument) doc); |
|
123 |
if (tmDocument == null) { |
|
124 |
return; |
|
125 |
} |
|
126 |
} else { |
|
127 |
return; |
|
128 |
} |
|
129 |
|
|
130 |
SwingUtilities.invokeLater(new Runnable() { |
|
131 |
|
|
132 |
public void run() { |
|
133 |
try { |
|
134 |
editorManager.regeneratePortableView(tmDocument, null, true); |
|
135 |
} catch (Exception ex) { |
|
136 |
NotificationManager.addError( |
|
137 |
"problems_exporting_portable_view_to_view", ex); |
|
138 |
} |
|
139 |
|
|
140 |
} |
|
141 |
}); |
|
142 |
} |
|
143 |
|
|
144 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/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 gvSIG's editor plugin</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
Allows PortableView creation and editing into gvSIG. |
|
14 |
</p> |
|
15 |
|
|
16 |
</body> |
|
17 |
</html> |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/PortableViewEditorLibrary.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.app.editor; |
|
23 |
|
|
24 |
import org.gvsig.educa.portableview.swing.PortableViewSwingLibrary; |
|
25 |
import org.gvsig.tools.library.AbstractLibrary; |
|
26 |
import org.gvsig.tools.library.LibraryException; |
|
27 |
|
|
28 |
/** |
|
29 |
* Library for API of services to create, export and update PortableView |
|
30 |
* documents. |
|
31 |
* |
|
32 |
* @author gvSIG team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public class PortableViewEditorLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
@Override |
|
38 |
public void doRegistration() { |
|
39 |
registerAsAPI(PortableViewEditorLibrary.class); |
|
40 |
require(PortableViewSwingLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
/** {@inheridDoc} */ |
|
44 |
@Override |
|
45 |
protected void doInitialize() throws LibraryException { |
|
46 |
// Do Nothing |
|
47 |
} |
|
48 |
|
|
49 |
/** {@inheridDoc} */ |
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
// Do Nothing |
|
53 |
} |
|
54 |
|
|
55 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/ExportPortableViewToViewExtension.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.app.editor; |
|
23 |
|
|
24 |
import javax.swing.SwingUtilities; |
|
25 |
|
|
26 |
import org.gvsig.andami.PluginServices; |
|
27 |
import org.gvsig.andami.messages.NotificationManager; |
|
28 |
import org.gvsig.andami.plugins.Extension; |
|
29 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
30 |
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument; |
|
31 |
import org.gvsig.educa.portableview.app.viewer.ui.PortableViewDocumentViewer; |
|
32 |
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator; |
|
33 |
import org.gvsig.educa.portableview.swing.PortableViewSwingManager; |
|
34 |
|
|
35 |
/** |
|
36 |
* Andami extension to create a View from a Portable view data. |
|
37 |
* |
|
38 |
* @author gvSIG Team |
|
39 |
* @version $Id$ |
|
40 |
*/ |
|
41 |
public class ExportPortableViewToViewExtension extends Extension { |
|
42 |
|
|
43 |
private PortableViewEditorManager editorManager; |
|
44 |
private PortableViewSwingManager swingManager; |
|
45 |
|
|
46 |
public void initialize() { |
|
47 |
// Do nothing |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public void postInitialize() { |
|
52 |
editorManager = PortableViewEditorLocator.getManager(); |
|
53 |
swingManager = PortableViewSwingLocator.getSwingManager(); |
|
54 |
} |
|
55 |
|
|
56 |
public void execute(String actionCommand) { |
|
57 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
58 |
if (!(window instanceof PortableViewDocumentViewer)) { |
|
59 |
return; |
|
60 |
} |
|
61 |
final PortableViewDocument tmDocument = |
|
62 |
((PortableViewDocumentViewer) window).getPortableViewDocument(); |
|
63 |
|
|
64 |
SwingUtilities.invokeLater(new Runnable() { |
|
65 |
|
|
66 |
public void run() { |
|
67 |
try { |
|
68 |
editorManager.exportPortableViewToView(tmDocument, true); |
|
69 |
} catch (Exception ex) { |
|
70 |
NotificationManager.addError( |
|
71 |
swingManager |
|
72 |
.getTranslation("problems_exporting_portable_view_to_view"), |
|
73 |
ex); |
|
74 |
} |
|
75 |
|
|
76 |
} |
|
77 |
}); |
|
78 |
} |
|
79 |
|
|
80 |
public boolean isEnabled() { |
|
81 |
return true; |
|
82 |
} |
|
83 |
|
|
84 |
public boolean isVisible() { |
|
85 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
|
86 |
return window instanceof PortableViewDocumentViewer; |
|
87 |
} |
|
88 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/impl/CompilationListenerAdapter.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.app.editor.impl; |
|
23 |
|
|
24 |
import org.gvsig.andami.messages.NotificationManager; |
|
25 |
import org.gvsig.educa.portableview.app.editor.CompilationListener; |
|
26 |
import org.gvsig.educa.portableview.compilation.PortableViewCompilation; |
|
27 |
import org.gvsig.educa.portableview.compilation.PortableViewCompilerStatus; |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
* Utility class which allow just override {@link CompilationListener} that you |
|
32 |
* need without override the other (useful for inner class) |
|
33 |
* |
|
34 |
* @author gvSIG Team |
|
35 |
* @version $Id$ |
|
36 |
* |
|
37 |
*/ |
|
38 |
public abstract class CompilationListenerAdapter implements CompilationListener { |
|
39 |
|
|
40 |
/** {@inheridDoc} */ |
|
41 |
public void finished(PortableViewCompilerStatus status) { |
|
42 |
// Nothing to do |
|
43 |
} |
|
44 |
|
|
45 |
/** {@inheridDoc} */ |
|
46 |
public void fail(PortableViewCompilerStatus status) { |
|
47 |
// Nothing to do |
|
48 |
} |
|
49 |
|
|
50 |
/** {@inheridDoc} */ |
|
51 |
public void canceledCompilation(PortableViewCompilerStatus status) { |
|
52 |
// Nothing to do |
|
53 |
} |
|
54 |
|
|
55 |
/** {@inheridDoc} */ |
|
56 |
public void canceledEditing(PortableViewCompilation compilation) { |
|
57 |
// Nothing to do |
|
58 |
} |
|
59 |
|
|
60 |
public void exception(String message, Throwable exception) { |
|
61 |
// use notification manager by default |
|
62 |
NotificationManager.addError(message, exception); |
|
63 |
} |
|
64 |
} |
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.182/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.editor/src/main/java/org/gvsig/educa/portableview/app/editor/impl/PortableViewEditorDefaultImplLibrary.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.app.editor.impl; |
|
23 |
|
Also available in: Unified diff