Revision 2381
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/pom.xml | ||
---|---|---|
2 | 2 |
<modelVersion>4.0.0</modelVersion> |
3 | 3 |
<parent> |
4 | 4 |
<groupId>org.gvsig</groupId> |
5 |
<artifactId>org.gvsig.cvsgis</artifactId>
|
|
5 |
<artifactId>org.gvsig.vcsgis</artifactId>
|
|
6 | 6 |
<version>1.0.0-SNAPSHOT</version> |
7 | 7 |
</parent> |
8 |
<artifactId>org.gvsig.cvsgis.app</artifactId>
|
|
8 |
<artifactId>org.gvsig.vcsgis.app</artifactId>
|
|
9 | 9 |
<packaging>pom</packaging> |
10 | 10 |
<name>${project.artifactId}</name> |
11 | 11 |
<modules> |
12 |
<module>org.gvsig.cvsgis.app.mainplugin</module>
|
|
12 |
<module>org.gvsig.vcsgis.app.mainplugin</module>
|
|
13 | 13 |
</modules> |
14 | 14 |
|
15 | 15 |
</project> |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Wed Mar 11 01:55:07 CET 2020 |
|
2 |
buildNumber=1 |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 |
_connection=Conexi\u00f3n |
|
2 |
initialize=Inicializar |
|
3 |
initialize_server=Inicializar servidor |
|
4 |
init_server=Inicializar servidor |
|
5 |
initialize_workspace=Inicializar espacio de trabajo |
|
6 |
init_workspace=Inicializar espacio de trabajo |
|
7 |
_name=Nombre |
|
8 |
_file=Archivo |
|
9 |
_repository=Repositorio |
|
10 |
_url=URL |
|
11 |
_layers=Capas |
|
12 |
_tables=Tablas |
|
13 |
add_to_workspace=A\u00f1adir al espacio de trabajo |
|
14 |
_workspace=Espacio de trabajo |
|
15 |
cant_initialize_server_{0}=No se ha podido inicializar el servidor ''{0}''. |
|
16 |
cant_initialize_workspace_{0}=No se ha podido inicializar el espacio de trabajo ''{0}''. |
|
17 |
cant_add_{0}_as_{1}_in_{2}=No se ha podido a\u00f1adir ''{0}'' como ''{1}'' en ''{2}''. |
|
18 |
_table=Tabla |
|
19 |
_branch=Rama |
|
20 |
_revision=Revisi\u00f3n |
|
21 |
checkout=Obtener copia local |
|
22 |
failed_checkout_of_{0}=Ha fallado la obtenci\u00f3n de la copia local de ''{0}'' |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 |
_connection=Connection |
|
2 |
initialize=Initialize |
|
3 |
initialize_server=Initialize server |
|
4 |
init_server=Initialize server |
|
5 |
initialize_workspace=Initialize workspace |
|
6 |
init_workspace=Initialize workspace |
|
7 |
_name=Name |
|
8 |
_file=File |
|
9 |
_repository=Repository |
|
10 |
_url=URL |
|
11 |
_layers=Layers |
|
12 |
_tables=Tables |
|
13 |
add_to_workspace=Add to workspace |
|
14 |
_workspace=Workspace |
|
15 |
cant_initialize_server_{0}=Can't initialize server ''{0}''. |
|
16 |
cant_initialize_workspace_{0}=Can't initialize workspace ''{0}''. |
|
17 |
cant_add_{0}_as_{1}_in_{2}=Can't add ''{0}' as ''{1}'' in ''{2}''. |
|
18 |
_table=Table |
|
19 |
_branch=Branch |
|
20 |
_revision=Revision |
|
21 |
checkout=Checkout |
|
22 |
failed_checkout_of_{0}=failed checkout of ''{0}'' |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG |
|
3 |
Association. This program is free software; you can redistribute it and/or modify |
|
4 |
it under the terms of the GNU General Public License as published by the Free Software |
|
5 |
Foundation; either version 3 of the License, or (at your option) any later version. |
|
6 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
7 |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
8 |
PURPOSE. See the GNU General Public License for more details. You should have received |
|
9 |
a copy of the GNU General Public License along with this program; if not, write to |
|
10 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
|
11 |
USA. For any additional information, do not hesitate to contact us at info AT gvsig.com, |
|
12 |
or visit our website www.gvsig.com. --> |
|
13 |
<plugin-config> |
|
14 |
<depends plugin-name="org.gvsig.app.mainplugin" /> |
|
15 |
<depends plugin-name="org.gvsig.app.document.table.app.mainplugin" /> |
|
16 |
<depends plugin-name="org.gvsig.shp.app.mainplugin" /> |
|
17 |
<resourceBundle name="text" /> |
|
18 |
<libraries library-dir="lib" /> |
|
19 |
<extensions> |
|
20 |
<extension class-name="org.gvsig.vcsgis.app.VCSGisExtension" |
|
21 |
description="" active="true" priority="1"> |
|
22 |
|
|
23 |
<action name="tools-vcsgis-init-server" label="tools_vcsgis_init_server" tooltip="init_server" |
|
24 |
position="900700100" action-command="tools-vcsgis-init-server" icon="tools-vcsgis-init-server" |
|
25 |
accelerator="" /> |
|
26 |
|
|
27 |
<action name="tools-vcsgis-init-workspace" label="tools_vcsgis_init_workspace" tooltip="init_workspace" |
|
28 |
position="900700200" action-command="tools-vcsgis-init-workspace" icon="tools-vcsgis-init-workspace" |
|
29 |
accelerator="" /> |
|
30 |
|
|
31 |
<action name="tools-vcsgis-add-to-workspace" label="tools_vcsgis_add_to_workspace" tooltip="add_to_workspace" |
|
32 |
position="900700300" action-command="tools-vcsgis-add-to-workspace" icon="tools-vcsgis-add-to-workspace" |
|
33 |
accelerator="" /> |
|
34 |
|
|
35 |
<action name="tools-vcsgis-checkout" label="tools_vcsgis_checkout" tooltip="checkout" |
|
36 |
position="900700400" action-command="tools-vcsgis-checkout" icon="tools-vcsgis-checkout" |
|
37 |
accelerator="" /> |
|
38 |
|
|
39 |
<menu text="tools/vcsgis/init_server" name="tools-vcsgis-init-server" /> |
|
40 |
<menu text="tools/vcsgis/init_workspace" name="tools-vcsgis-init-workspace" /> |
|
41 |
<menu text="tools/vcsgis/add_to_workspace" name="tools-vcsgis-add-to-workspace" /> |
|
42 |
<menu text="tools/vcsgis/checkout" name="tools-vcsgis-checkout" /> |
|
43 |
|
|
44 |
<!--<tool-bar name="vcsgis" position="900700100"> |
|
45 |
<action-tool name="tools-vcsgis-init-server" /> |
|
46 |
</tool-bar> |
|
47 |
|
|
48 |
<tool-bar name="vcsgis" position="900700200"> |
|
49 |
<action-tool name="tools-vcsgis-init-workspace" /> |
|
50 |
</tool-bar>--> |
|
51 |
|
|
52 |
<tool-bar name="vcsgis" position="900700300"> |
|
53 |
<action-tool name="tools-vcsgis-add-to-workspace" /> |
|
54 |
</tool-bar> |
|
55 |
|
|
56 |
<tool-bar name="vcsgis" position="900700400"> |
|
57 |
<action-tool name="tools-vcsgis-checkout" /> |
|
58 |
</tool-bar> |
|
59 |
|
|
60 |
</extension> |
|
61 |
</extensions> |
|
62 |
</plugin-config> |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG |
|
2 |
Association. This program is free software; you can redistribute it and/or modify |
|
3 |
it under the terms of the GNU General Public License as published by the Free Software |
|
4 |
Foundation; either version 3 of the License, or (at your option) any later version. |
|
5 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
6 |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
7 |
PURPOSE. See the GNU General Public License for more details. You should have received |
|
8 |
a copy of the GNU General Public License along with this program; if not, write to |
|
9 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
|
10 |
USA. For any additional information, do not hesitate to contact us at info AT gvsig.com, |
|
11 |
or visit our website www.gvsig.com. --> |
|
12 |
<assembly> |
|
13 |
<id>gvsig-plugin-package</id> |
|
14 |
<formats> |
|
15 |
<format>zip</format> |
|
16 |
</formats> |
|
17 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
18 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
19 |
<files> |
|
20 |
<file> |
|
21 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
22 |
<outputDirectory>lib</outputDirectory> |
|
23 |
</file> |
|
24 |
<file> |
|
25 |
<source>target/package.info</source> |
|
26 |
</file> |
|
27 |
</files> |
|
28 |
|
|
29 |
<fileSets> |
|
30 |
<fileSet> |
|
31 |
<directory>src/main/resources-plugin</directory> |
|
32 |
<outputDirectory>.</outputDirectory> |
|
33 |
</fileSet> |
|
34 |
</fileSets> |
|
35 |
|
|
36 |
|
|
37 |
<dependencySets> |
|
38 |
<dependencySet> |
|
39 |
<useProjectArtifact>false</useProjectArtifact> |
|
40 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
41 |
<outputDirectory>lib</outputDirectory> |
|
42 |
<includes> |
|
43 |
<include>org.gvsig:org.gvsig.vcsgis.lib.api</include> |
|
44 |
<include>org.gvsig:org.gvsig.vcsgis.lib.impl</include> |
|
45 |
<include>org.gvsig:org.gvsig.vcsgis.swing.api</include> |
|
46 |
<include>org.gvsig:org.gvsig.vcsgis.swing.impl</include> |
|
47 |
</includes> |
|
48 |
</dependencySet> |
|
49 |
</dependencySets> |
|
50 |
|
|
51 |
</assembly> |
|
52 |
|
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/java/org/gvsig/vcsgis/app/FeatureStoresListModel.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.vcsgis.app; |
|
7 |
|
|
8 |
import java.util.List; |
|
9 |
import javax.swing.DefaultListModel; |
|
10 |
import org.gvsig.app.ApplicationLocator; |
|
11 |
import org.gvsig.app.ApplicationManager; |
|
12 |
import org.gvsig.app.project.Project; |
|
13 |
import org.gvsig.app.project.documents.Document; |
|
14 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
15 |
import org.gvsig.app.project.documents.table.TableManager; |
|
16 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
* @author fdiaz |
|
21 |
*/ |
|
22 |
public class FeatureStoresListModel extends DefaultListModel<FeatureStore>{ |
|
23 |
|
|
24 |
public FeatureStoresListModel() { |
|
25 |
super(); |
|
26 |
ApplicationManager appManager = ApplicationLocator.getApplicationManager(); |
|
27 |
Project project = appManager.getCurrentProject(); |
|
28 |
List<Document> tables = project.getDocuments(TableManager.TYPENAME); |
|
29 |
for (Document document : tables) { |
|
30 |
TableDocument table = (TableDocument) document; |
|
31 |
this.addElement(table.getFeatureStore()); |
|
32 |
} |
|
33 |
} |
|
34 |
|
|
35 |
|
|
36 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/java/org/gvsig/vcsgis/app/VCSGisExtension.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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 3 |
|
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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.app; |
|
23 |
|
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import javax.swing.JOptionPane; |
|
26 |
import org.gvsig.andami.IconThemeHelper; |
|
27 |
import org.gvsig.andami.plugins.Extension; |
|
28 |
import org.gvsig.vcsgis.app.VCSGisSwingServicesImpl; |
|
29 |
import org.gvsig.vcsgis.lib.VCSGisWorkspace; |
|
30 |
import org.gvsig.vcsgis.swing.VCSGisJAddToWorkspace; |
|
31 |
import org.gvsig.vcsgis.swing.VCSGisJCheckout; |
|
32 |
import org.gvsig.vcsgis.swing.VCSGisJInitServer; |
|
33 |
import org.gvsig.vcsgis.swing.VCSGisJInitWorkspace; |
|
34 |
import org.gvsig.vcsgis.swing.VCSGisSwingLocator; |
|
35 |
import org.gvsig.vcsgis.swing.VCSGisSwingManager; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
37 |
import org.gvsig.tools.ToolsLocator; |
|
38 |
import org.gvsig.tools.i18n.I18nManager; |
|
39 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
40 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
41 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
42 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
43 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
44 |
|
|
45 |
/** |
|
46 |
* |
|
47 |
* @author gvSIG Team |
|
48 |
*/ |
|
49 |
public class VCSGisExtension extends Extension { |
|
50 |
|
|
51 |
@Override |
|
52 |
public void initialize() { |
|
53 |
IconThemeHelper.registerIcon("action", "tools-vcsgis-init-server", this); |
|
54 |
IconThemeHelper.registerIcon("action", "tools-vcsgis-init-workspace", this); |
|
55 |
IconThemeHelper.registerIcon("action", "tools-vcsgis-add-to-workspace", this); |
|
56 |
IconThemeHelper.registerIcon("action", "tools-vcsgis-checkout", this); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public void postInitialize() { |
|
61 |
super.postInitialize(); |
|
62 |
VCSGisSwingManager swingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
|
63 |
swingManager.setDefaultServices(new VCSGisSwingServicesImpl()); |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public void execute(String actionCommand) { |
|
68 |
|
|
69 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
70 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
71 |
VCSGisSwingManager swingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
|
72 |
|
|
73 |
switch (actionCommand) { |
|
74 |
case "tools-vcsgis-changes-show": |
|
75 |
this.showChangesDialog(); |
|
76 |
break; |
|
77 |
|
|
78 |
case "tools-vcsgis-init-server": |
|
79 |
showInitServerDialog(); |
|
80 |
break; |
|
81 |
case "tools-vcsgis-init-workspace": |
|
82 |
showInitWorkspaceDialog(); |
|
83 |
break; |
|
84 |
case "tools-vcsgis-add-to-workspace": |
|
85 |
showAddToWorkspaceDialog(); |
|
86 |
break; |
|
87 |
case "tools-vcsgis-checkout": |
|
88 |
showCheckoutDialog(); |
|
89 |
break; |
|
90 |
|
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
private void showAddToWorkspaceDialog() { |
|
95 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
96 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
97 |
VCSGisSwingManager swingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
|
98 |
|
|
99 |
final VCSGisJAddToWorkspace panelAddToWorkspace = swingManager.createAddToWorkspacePanel(); |
|
100 |
final Dialog dialogAddToWorkspace = winManager.createDialog( |
|
101 |
panelAddToWorkspace.asJComponent(), |
|
102 |
i18nManager.getTranslation("add_to_workspace"), |
|
103 |
i18nManager.getTranslation("add_to_workspace"), |
|
104 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
105 |
); |
|
106 |
|
|
107 |
panelAddToWorkspace.setDialog(dialogAddToWorkspace); |
|
108 |
dialogAddToWorkspace.setButtonLabel(WindowManager_v2.BUTTON_OK, i18nManager.getTranslation("add")); |
|
109 |
dialogAddToWorkspace.addActionListener((ActionEvent e) -> { |
|
110 |
switch (dialogAddToWorkspace.getAction()) { |
|
111 |
case WindowManager_v2.BUTTON_OK: |
|
112 |
|
|
113 |
int r = panelAddToWorkspace.add(); |
|
114 |
|
|
115 |
if (r != 0) { |
|
116 |
FeatureStore featureStore = panelAddToWorkspace.getFeatureStore(); |
|
117 |
String targetName = panelAddToWorkspace.getTargetName(); |
|
118 |
VCSGisWorkspace workspace = panelAddToWorkspace.getWorkspace(); |
|
119 |
|
|
120 |
String message = "cant_add_{0}_as_{1}_in_{2}"; |
|
121 |
|
|
122 |
StringBuilder compoundMessage = new StringBuilder(); |
|
123 |
String[] messageArgs = new String[]{featureStore.getName(), targetName, workspace.getLabel()}; |
|
124 |
|
|
125 |
compoundMessage.append(i18nManager.getTranslation( |
|
126 |
message, |
|
127 |
messageArgs |
|
128 |
)); |
|
129 |
compoundMessage.append("\n"); |
|
130 |
compoundMessage.append(workspace.getErrorMessage(r)); |
|
131 |
ThreadSafeDialogsManager dialogsManager = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
132 |
dialogsManager.messageDialog(compoundMessage.toString(), i18nManager.getTranslation("add_to_workspace"), JOptionPane.WARNING_MESSAGE); |
|
133 |
} |
|
134 |
break; |
|
135 |
|
|
136 |
} |
|
137 |
}); |
|
138 |
dialogAddToWorkspace.show(WindowManager.MODE.WINDOW); |
|
139 |
} |
|
140 |
|
|
141 |
private void showInitWorkspaceDialog() { |
|
142 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
143 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
144 |
VCSGisSwingManager swingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
|
145 |
|
|
146 |
final VCSGisJInitWorkspace panelInitWorkspace = swingManager.createInitWorkspacePanel(); |
|
147 |
final Dialog dialogInitWorkspace = winManager.createDialog( |
|
148 |
panelInitWorkspace.asJComponent(), |
|
149 |
i18nManager.getTranslation("initialize_workspace"), |
|
150 |
i18nManager.getTranslation("initialize_workspace"), |
|
151 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
152 |
); |
|
153 |
|
|
154 |
panelInitWorkspace.setDialog(dialogInitWorkspace); |
|
155 |
dialogInitWorkspace.setButtonLabel(WindowManager_v2.BUTTON_OK, i18nManager.getTranslation("initialize")); |
|
156 |
dialogInitWorkspace.addActionListener((ActionEvent e) -> { |
|
157 |
switch (dialogInitWorkspace.getAction()) { |
|
158 |
case WindowManager_v2.BUTTON_OK: |
|
159 |
int r = panelInitWorkspace.initialize(); |
|
160 |
if (r != 0) { |
|
161 |
String message = "cant_initialize_workspace_{0}"; |
|
162 |
|
|
163 |
StringBuilder compoundMessage = new StringBuilder(); |
|
164 |
String[] messageArgs = new String[]{panelInitWorkspace.getTargetName()}; |
|
165 |
|
|
166 |
compoundMessage.append(i18nManager.getTranslation( |
|
167 |
message, |
|
168 |
messageArgs |
|
169 |
)); |
|
170 |
|
|
171 |
ThreadSafeDialogsManager dialogsManager = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
172 |
dialogsManager.messageDialog(compoundMessage.toString(), i18nManager.getTranslation("initialize_workspace"), JOptionPane.WARNING_MESSAGE); |
|
173 |
} |
|
174 |
|
|
175 |
break; |
|
176 |
|
|
177 |
} |
|
178 |
}); |
|
179 |
dialogInitWorkspace.show(WindowManager.MODE.WINDOW); |
|
180 |
} |
|
181 |
|
|
182 |
private void showInitServerDialog() { |
|
183 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
184 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
185 |
VCSGisSwingManager swingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
|
186 |
|
|
187 |
final VCSGisJInitServer panel = swingManager.createInitServerPanel(); |
|
188 |
final Dialog dialog = winManager.createDialog( |
|
189 |
panel.asJComponent(), |
|
190 |
i18nManager.getTranslation("initialize_server"), |
|
191 |
i18nManager.getTranslation("initialize_server"), |
|
192 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
193 |
); |
|
194 |
|
|
195 |
panel.setDialog(dialog); |
|
196 |
dialog.setButtonLabel(WindowManager_v2.BUTTON_OK, i18nManager.getTranslation("initialize")); |
|
197 |
dialog.addActionListener((ActionEvent e) -> { |
|
198 |
switch (dialog.getAction()) { |
|
199 |
case WindowManager_v2.BUTTON_OK: |
|
200 |
int r = panel.initialize(); |
|
201 |
if (r != 0) { |
|
202 |
String message = "cant_initialize_server_{0}"; |
|
203 |
|
|
204 |
StringBuilder compoundMessage = new StringBuilder(); |
|
205 |
String[] messageArgs = new String[]{ |
|
206 |
panel.getConnectionLabel()}; |
|
207 |
|
|
208 |
ThreadSafeDialogsManager dialogsManager = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
209 |
dialogsManager.messageDialog( |
|
210 |
i18nManager.getTranslation( |
|
211 |
message, |
|
212 |
messageArgs |
|
213 |
), |
|
214 |
i18nManager.getTranslation("initialize_server"), |
|
215 |
JOptionPane.WARNING_MESSAGE); |
|
216 |
} |
|
217 |
|
|
218 |
break; |
|
219 |
} |
|
220 |
}); |
|
221 |
dialog.show(WindowManager.MODE.WINDOW); |
|
222 |
} |
|
223 |
|
|
224 |
private void showCheckoutDialog() { |
|
225 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
226 |
WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
227 |
VCSGisSwingManager swingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
|
228 |
|
|
229 |
final VCSGisJCheckout panel = swingManager.createCheckoutPanel(); |
|
230 |
final Dialog dialog = winManager.createDialog( |
|
231 |
panel.asJComponent(), |
|
232 |
i18nManager.getTranslation("checkout"), |
|
233 |
i18nManager.getTranslation("checkout"), |
|
234 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
235 |
); |
|
236 |
|
|
237 |
panel.setDialog(dialog); |
|
238 |
dialog.setButtonLabel(WindowManager_v2.BUTTON_OK, i18nManager.getTranslation("checkout")); |
|
239 |
dialog.addActionListener((ActionEvent e) -> { |
|
240 |
switch (dialog.getAction()) { |
|
241 |
case WindowManager_v2.BUTTON_OK: |
|
242 |
int r = panel.checkout(); |
|
243 |
if (r != 0) { |
|
244 |
String message = "failed_checkout_of_{0}"; |
|
245 |
|
|
246 |
VCSGisWorkspace.Entity entity = panel.getTable();; |
|
247 |
String[] messageArgs = new String[]{ |
|
248 |
entity.toString() |
|
249 |
}; |
|
250 |
|
|
251 |
ThreadSafeDialogsManager dialogsManager = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
252 |
dialogsManager.messageDialog( |
|
253 |
i18nManager.getTranslation( |
|
254 |
message, |
|
255 |
messageArgs |
|
256 |
), |
|
257 |
i18nManager.getTranslation("checkout"), |
|
258 |
JOptionPane.WARNING_MESSAGE); |
|
259 |
} |
|
260 |
|
|
261 |
break; |
|
262 |
} |
|
263 |
}); |
|
264 |
dialog.show(WindowManager.MODE.WINDOW); |
|
265 |
} |
|
266 |
|
|
267 |
@Override |
|
268 |
public boolean isEnabled() { |
|
269 |
return true; |
|
270 |
} |
|
271 |
|
|
272 |
@Override |
|
273 |
public boolean isVisible() { |
|
274 |
return true; |
|
275 |
} |
|
276 |
|
|
277 |
private void showChangesDialog() { |
|
278 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
279 |
} |
|
280 |
|
|
281 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/java/org/gvsig/vcsgis/app/FeatureStoresTreeModel.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.vcsgis.app; |
|
7 |
|
|
8 |
import javax.swing.event.TreeModelListener; |
|
9 |
import javax.swing.tree.TreeModel; |
|
10 |
import javax.swing.tree.TreePath; |
|
11 |
import org.gvsig.app.ApplicationLocator; |
|
12 |
import org.gvsig.fmap.dal.DataStore; |
|
13 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
14 |
import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer; |
|
15 |
import org.gvsig.fmap.mapcontext.layers.vectorial.VectorLayer; |
|
16 |
import org.gvsig.fmap.mapcontrol.LayersTreeModel; |
|
17 |
import org.gvsig.tools.evaluator.Evaluator; |
|
18 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
19 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
20 |
import org.gvsig.tools.evaluator.EvaluatorFieldsInfo; |
|
21 |
import org.gvsig.tools.swing.api.ListElement; |
|
22 |
|
|
23 |
|
|
24 |
/** |
|
25 |
* |
|
26 |
* @author fdiaz |
|
27 |
*/ |
|
28 |
public class FeatureStoresTreeModel implements TreeModel { |
|
29 |
|
|
30 |
private final LayersTreeModel delegated; |
|
31 |
private final ListElement<Object> root; |
|
32 |
|
|
33 |
public FeatureStoresTreeModel() { |
|
34 |
this.delegated = (LayersTreeModel) ApplicationLocator.getApplicationManager().createProjectLayersTreeModel(); |
|
35 |
this.delegated.setFilter(new Evaluator() { |
|
36 |
@Override |
|
37 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
38 |
FLayer layer = (FLayer) data.getDataValue("layer"); |
|
39 |
return (layer instanceof VectorLayer); |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public String getName() { |
|
44 |
return "VectorialLayersFilter"; |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public String getDescription() { |
|
49 |
return null; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public String getSQL() { |
|
54 |
return null; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public EvaluatorFieldsInfo getFieldsInfo() { |
|
59 |
return null; |
|
60 |
} |
|
61 |
}); |
|
62 |
this.root = new ListElement<>("Project", this.delegated.getRoot()); |
|
63 |
} |
|
64 |
|
|
65 |
private Object getNode(Object value) { |
|
66 |
if( value instanceof ListElement ) { |
|
67 |
return ((ListElement) value).getValue(); |
|
68 |
} |
|
69 |
return value; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public Object getRoot() { |
|
74 |
return this.root; |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public Object getChild(Object parent, int index) { |
|
79 |
parent = this.getNode(parent); |
|
80 |
Object x = this.delegated.getChild(parent, index); |
|
81 |
if( x instanceof VectorLayer ) { |
|
82 |
SingleLayer layer = (SingleLayer)x; |
|
83 |
DataStore store = (DataStore) layer.getDataStore(); |
|
84 |
return store; |
|
85 |
} |
|
86 |
return x; |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
public int getChildCount(Object parent) { |
|
91 |
parent = this.getNode(parent); |
|
92 |
return this.delegated.getChildCount(parent); |
|
93 |
} |
|
94 |
|
|
95 |
@Override |
|
96 |
public boolean isLeaf(Object node) { |
|
97 |
node = this.getNode(node); |
|
98 |
return this.delegated.isLeaf(node); |
|
99 |
} |
|
100 |
|
|
101 |
@Override |
|
102 |
public void valueForPathChanged(TreePath path, Object newValue) { |
|
103 |
this.delegated.valueForPathChanged(path, newValue); |
|
104 |
} |
|
105 |
|
|
106 |
@Override |
|
107 |
public int getIndexOfChild(Object parent, Object child) { |
|
108 |
parent = this.getNode(parent); |
|
109 |
return this.delegated.getIndexOfChild(parent, child); |
|
110 |
} |
|
111 |
|
|
112 |
@Override |
|
113 |
public void addTreeModelListener(TreeModelListener l) { |
|
114 |
this.delegated.addTreeModelListener(l); |
|
115 |
} |
|
116 |
|
|
117 |
@Override |
|
118 |
public void removeTreeModelListener(TreeModelListener l) { |
|
119 |
this.delegated.removeTreeModelListener(l); |
|
120 |
} |
|
121 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/java/org/gvsig/vcsgis/app/VCSGisSwingServicesImpl.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.vcsgis.app; |
|
7 |
|
|
8 |
import javax.swing.ListModel; |
|
9 |
import javax.swing.tree.TreeModel; |
|
10 |
import org.gvsig.vcsgis.swing.VCSGisSwingServices; |
|
11 |
|
|
12 |
/** |
|
13 |
* |
|
14 |
* @author fdiaz |
|
15 |
*/ |
|
16 |
public class VCSGisSwingServicesImpl implements VCSGisSwingServices { |
|
17 |
|
|
18 |
@Override |
|
19 |
public TreeModel getFeatureStoresTreeModel() { |
|
20 |
return new FeatureStoresTreeModel(); |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
public ListModel getFeatureStoresListModel() { |
|
25 |
return new FeatureStoresListModel(); |
|
26 |
} |
|
27 |
|
|
28 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/pom.xml | ||
---|---|---|
1 |
<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"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.vcsgis.app</artifactId> |
|
6 |
<version>1.0.0-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vcsgis.app.mainplugin</artifactId> |
|
9 |
<packaging>jar</packaging> |
|
10 |
<name>${project.artifactId}</name> |
|
11 |
<properties> |
|
12 |
<!-- Package info property values --> |
|
13 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
14 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
15 |
<gvsig.package.info.name>vcsgis</gvsig.package.info.name> |
|
16 |
<gvsig.package.info.description>Provides tools for Version Control System (VCS) of GIS information.</gvsig.package.info.description> |
|
17 |
<gvsig.package.info.categories>Database</gvsig.package.info.categories> |
|
18 |
<gvsig.package.info.javaVM>j1_8</gvsig.package.info.javaVM> |
|
19 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-vcsgis/pool</gvsig.package.info.poolURL> |
|
20 |
</properties> |
|
21 |
|
|
22 |
<dependencies> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.andami</artifactId> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>org.gvsig</groupId> |
|
29 |
<artifactId>org.gvsig.vcsgis.swing.api</artifactId> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.vcsgis.lib.api</artifactId> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.vcsgis.lib.impl</artifactId> |
|
38 |
</dependency> |
|
39 |
<dependency> |
|
40 |
<groupId>org.gvsig</groupId> |
|
41 |
<artifactId>org.gvsig.vcsgis.swing.impl</artifactId> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
46 |
</dependency> |
|
47 |
<dependency> |
|
48 |
<groupId>org.gvsig</groupId> |
|
49 |
<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId> |
|
50 |
<type>jar</type> |
|
51 |
</dependency> |
|
52 |
</dependencies> |
|
53 |
</project> |
|
0 | 54 |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.main/src/main/java/org/gvsig/vcsgis/main/Main.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2020 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 |
package org.gvsig.vcsgis.main; |
|
25 |
|
|
26 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
27 |
|
|
28 |
/** |
|
29 |
* Main executable class of vcsgis tool. |
|
30 |
* |
|
31 |
* @author gvSIG Team |
|
32 |
*/ |
|
33 |
public class Main { |
|
34 |
|
|
35 |
public static void main(String args[]) { |
|
36 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
37 |
} |
|
38 |
|
|
39 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.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.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.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()] %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"> |
|
48 |
<priority value="WARN" /> |
|
49 |
</category> |
|
50 |
<category name="org.cresques"> |
|
51 |
<priority value="WARN" /> |
|
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.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.main/src/main/assembly/package-main.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
|
|
3 |
<id>package-main</id> |
|
4 |
<formats> |
|
5 |
<format>dir</format> |
|
6 |
<format>zip</format> |
|
7 |
</formats> |
|
8 |
|
|
9 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
10 |
<includeBaseDirectory>false</includeBaseDirectory> |
|
11 |
|
|
12 |
<files> |
|
13 |
<file> |
|
14 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
15 |
<outputDirectory>.</outputDirectory> |
|
16 |
</file> |
|
17 |
</files> |
|
18 |
|
|
19 |
<fileSets> |
|
20 |
<fileSet> |
|
21 |
<directory>src/main/resources/data</directory> |
|
22 |
<outputDirectory>data</outputDirectory> |
|
23 |
</fileSet> |
|
24 |
</fileSets> |
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>true</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
</dependencySet> |
|
32 |
</dependencySets> |
|
33 |
|
|
34 |
</assembly> |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.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.vcsgis.main</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.vcsgis</artifactId> |
|
10 |
<version>1.0.0-SNAPSHOT</version> |
|
11 |
</parent> |
|
12 |
|
|
13 |
|
|
14 |
<build> |
|
15 |
<plugins> |
|
16 |
<plugin> |
|
17 |
<artifactId>maven-assembly-plugin</artifactId> |
|
18 |
<executions> |
|
19 |
<execution> |
|
20 |
<id>package-main</id> |
|
21 |
<phase>package</phase> |
|
22 |
<goals> |
|
23 |
<goal>single</goal> |
|
24 |
</goals> |
|
25 |
<configuration> |
|
26 |
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> |
|
27 |
<appendAssemblyId>false</appendAssemblyId> |
|
28 |
<finalName>${project.artifactId}-${project.version}</finalName> |
|
29 |
<descriptors> |
|
30 |
<descriptor>src/main/assembly/package-main.xml</descriptor> |
|
31 |
</descriptors> |
|
32 |
</configuration> |
|
33 |
</execution> |
|
34 |
</executions> |
|
35 |
</plugin> |
|
36 |
|
|
37 |
<plugin> |
|
38 |
<groupId>org.apache.maven.plugins</groupId> |
|
39 |
<artifactId>maven-jar-plugin</artifactId> |
|
40 |
<configuration> |
|
41 |
<archive> |
|
42 |
<manifest> |
|
43 |
<addClasspath>true</addClasspath> |
|
44 |
<mainClass>org.gvsig.vcsgis.main.Main</mainClass> |
|
45 |
<classpathPrefix>lib</classpathPrefix> |
|
46 |
</manifest> |
|
47 |
</archive> |
|
48 |
</configuration> |
|
49 |
</plugin> |
|
50 |
|
|
51 |
</plugins> |
|
52 |
|
|
53 |
</build> |
|
54 |
|
|
55 |
|
|
56 |
<dependencies> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.vcsgis.lib.api</artifactId> |
|
60 |
<scope>compile</scope> |
|
61 |
</dependency> |
|
62 |
<dependency> |
|
63 |
<groupId>org.gvsig</groupId> |
|
64 |
<artifactId>org.gvsig.vcsgis.swing.api</artifactId> |
|
65 |
<scope>compile</scope> |
|
66 |
</dependency> |
|
67 |
|
|
68 |
<!-- runtime dependencies --> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.vcsgis.lib.impl</artifactId> |
|
72 |
<scope>runtime</scope> |
|
73 |
</dependency> |
|
74 |
<dependency> |
|
75 |
<groupId>org.gvsig</groupId> |
|
76 |
<artifactId>org.gvsig.vcsgis.swing.impl</artifactId> |
|
77 |
<scope>compile</scope> |
|
78 |
</dependency> |
|
79 |
<dependency> |
|
80 |
<groupId>org.gvsig</groupId> |
|
81 |
<artifactId>${org.gvsig.metadata.lib.basic.impl}</artifactId> |
|
82 |
<scope>runtime</scope> |
|
83 |
</dependency> |
|
84 |
<dependency> |
|
85 |
<groupId>org.gvsig</groupId> |
|
86 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
87 |
<scope>runtime</scope> |
|
88 |
</dependency> |
|
89 |
<dependency> |
|
90 |
<groupId>org.gvsig</groupId> |
|
91 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
92 |
<scope>runtime</scope> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.gvsig</groupId> |
|
96 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
97 |
<scope>runtime</scope> |
|
98 |
</dependency> |
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.fmap.dal.file.shp</artifactId> |
|
102 |
<scope>runtime</scope> |
|
103 |
</dependency> |
|
104 |
<dependency> |
|
105 |
<groupId>org.gvsig</groupId> |
|
106 |
<artifactId>org.gvsig.fmap.dal.file.dbf</artifactId> |
|
107 |
<scope>runtime</scope> |
|
108 |
</dependency> |
|
109 |
<dependency> |
|
110 |
<groupId>org.gvsig</groupId> |
|
111 |
<artifactId>org.gvsig.fmap.dal.db.lib</artifactId> |
|
112 |
<scope>runtime</scope> |
|
113 |
</dependency> |
|
114 |
<dependency> |
|
115 |
<groupId>org.gvsig</groupId> |
|
116 |
<artifactId>org.gvsig.fmap.dal.db.h2</artifactId> |
|
117 |
<scope>runtime</scope> |
|
118 |
</dependency> |
|
119 |
|
|
120 |
<dependency> |
|
121 |
<groupId>org.gvsig</groupId> |
|
122 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
123 |
<scope>runtime</scope> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>org.gvsig</groupId> |
|
127 |
<artifactId>${org.gvsig.timesupport.lib.impl}</artifactId> |
|
128 |
<scope>runtime</scope> |
|
129 |
</dependency> |
|
130 |
|
|
131 |
<dependency> |
|
132 |
<groupId>org.gvsig</groupId> |
|
133 |
<artifactId>${org.gvsig.compat.impl}</artifactId> |
|
134 |
<scope>runtime</scope> |
|
135 |
</dependency> |
|
136 |
<dependency> |
|
137 |
<groupId>org.gvsig</groupId> |
|
138 |
<artifactId>${org.gvsig.fmap.geometry.impl}</artifactId> |
|
139 |
<scope>runtime</scope> |
|
140 |
</dependency> |
|
141 |
|
|
142 |
<dependency> |
|
143 |
<groupId>org.gvsig</groupId> |
|
144 |
<artifactId>${org.gvsig.proj.lib.impl}</artifactId> |
|
145 |
<scope>runtime</scope> |
|
146 |
</dependency> |
|
147 |
|
|
148 |
<dependency> |
|
149 |
<groupId>org.gvsig</groupId> |
|
150 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
151 |
<scope>runtime</scope> |
|
152 |
</dependency> |
|
153 |
<dependency> |
|
154 |
<groupId>org.gvsig</groupId> |
|
155 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
156 |
<scope>runtime</scope> |
|
157 |
</dependency> |
|
158 |
|
|
159 |
|
|
160 |
</dependencies> |
|
161 |
</project> |
|
0 | 162 |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/client/VCSGisWorkspaceEx.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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 3 |
|
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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
package org.gvsig.vcsgis.client; |
|
23 |
|
|
24 |
import java.util.Collection; |
|
25 |
import java.util.Iterator; |
|
26 |
import org.gvsig.vcsgis.client.tables.EntitiesTable.EntityRow; |
|
27 |
import org.gvsig.fmap.dal.feature.Feature; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
30 |
import org.gvsig.vcsgis.lib.VCSGisWorkspace; |
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
* @author jjdelcerro |
|
35 |
*/ |
|
36 |
public interface VCSGisWorkspaceEx extends VCSGisWorkspace { |
|
37 |
|
|
38 |
public Collection<EntityRow> getEntitiesAsEntityRow(); |
|
39 |
|
|
40 |
@Override |
|
41 |
public EntityRow getEntityByName(String name); |
|
42 |
|
|
43 |
public EntityRow getEntityByCode(String code); |
|
44 |
|
|
45 |
public String createUniqueID(); |
|
46 |
|
|
47 |
public int add_changes(FeatureStore store, Iterator<Feature> insertedsFeatures, Iterator<Feature> updatedsFeatures, Iterator<FeatureReference> deletedsFeatures); |
|
48 |
|
|
49 |
public boolean contains(FeatureStore store); |
|
50 |
|
|
51 |
@Override |
|
52 |
public void create_table(String tableName); |
|
53 |
|
|
54 |
public int add_change(int op, FeatureStore store, Feature feature); |
|
55 |
|
|
56 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/client/tables/AbstractTable.java | ||
---|---|---|
1 |
/* |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2020 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 3 |
|
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, see <https://www.gnu.org/licenses/>. |
|
18 |
* |
|
19 |
* For any additional information, do not hesitate to contact us |
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.vcsgis.client.tables; |
|
24 |
|
|
25 |
import org.gvsig.vcsgis.client.tables.EntitiesTable.EntityRow; |
|
26 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
27 |
import org.gvsig.fmap.dal.feature.Feature; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
30 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
31 |
import org.slf4j.Logger; |
|
32 |
import org.slf4j.LoggerFactory; |
|
33 |
import org.gvsig.vcsgis.client.VCSGisWorkspaceEx; |
|
34 |
|
|
35 |
/** |
|
36 |
* |
|
37 |
* @author gvSIG Team |
|
38 |
*/ |
|
39 |
@SuppressWarnings(value = "UseSpecificCatch") |
|
40 |
public abstract class AbstractTable { |
|
41 |
|
|
42 |
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractTable.class); |
|
43 |
|
|
44 |
public static abstract class AbstractRow { |
|
45 |
protected final VCSGisWorkspaceEx workspace; |
|
46 |
protected EntityRow entity; |
|
47 |
protected EditableFeature feature; |
|
48 |
private final String tableName; |
|
49 |
private final String codeName; |
|
50 |
|
|
51 |
public AbstractRow(VCSGisWorkspaceEx workspace, String tableName, String codeName, Feature feature) { |
|
52 |
this.tableName = tableName; |
|
53 |
this.codeName = codeName; |
|
54 |
this.workspace = workspace; |
|
55 |
this.entity = null; |
|
56 |
if (feature == null) { |
|
57 |
this.feature = create_feature(); |
|
58 |
} else { |
|
59 |
if (feature instanceof EditableFeature) { |
|
60 |
this.feature = (EditableFeature) feature.getCopy(); |
|
61 |
} else { |
|
62 |
this.feature = feature.getCopy().getEditable(); |
|
63 |
} |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
private EditableFeature create_feature() { |
|
68 |
try { |
|
69 |
FeatureStore store = workspace.getFeatureStore(this.tableName); |
|
70 |
EditableFeature f = store.createNewFeature(); |
|
71 |
f.set(this.codeName, workspace.createUniqueID()); |
|
72 |
return f; |
|
73 |
} catch (Exception ex) { |
|
74 |
throw new RuntimeException("Can't create a new feature for table '" + this.tableName + "'.", ex); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
public void update() { |
|
79 |
FeatureStore store = null; |
|
80 |
try { |
|
81 |
store = this.workspace.getFeatureStore(this.tableName); |
|
82 |
store.edit(FeatureStore.MODE_FULLEDIT); |
|
83 |
this.feature.setUpdatable(true); |
|
84 |
store.update(this.feature); |
|
85 |
store.finishEditing(); |
|
86 |
} catch (Exception ex) { |
|
87 |
throw new RuntimeException("Can't update feature on '"+this.tableName+"'.", ex); |
|
88 |
} finally { |
|
89 |
DisposeUtils.disposeQuietly(store); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
public void insert() { |
|
94 |
FeatureStore store = null; |
|
95 |
boolean pendingFinishEditing = false; |
|
96 |
try { |
|
97 |
store = this.workspace.getFeatureStore(this.tableName); |
|
98 |
if( !store.isEditing() && !store.isAppending() ) { |
|
99 |
store.edit(FeatureStore.MODE_APPEND); |
|
100 |
pendingFinishEditing = true; |
|
101 |
} |
|
102 |
this.insert(store); |
|
103 |
if( pendingFinishEditing ) { |
|
104 |
store.finishEditing(); |
|
105 |
} |
|
106 |
} catch (Exception ex) { |
|
107 |
if( store!=null && pendingFinishEditing ) { |
|
108 |
store.cancelEditingQuietly(); |
|
109 |
} |
|
110 |
throw new RuntimeException("Can't update feature on '"+this.tableName+"'.", ex); |
|
111 |
} finally { |
|
112 |
DisposeUtils.disposeQuietly(store); |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 |
public void insert(FeatureStore store) { |
|
117 |
try { |
|
118 |
store.insert(feature); |
|
119 |
} catch (Exception ex) { |
|
120 |
throw new RuntimeException("Can't insert feature on '"+this.tableName+"'.", ex); |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
public void update(FeatureStore store) { |
|
125 |
try { |
|
126 |
this.feature.setUpdatable(true); |
|
127 |
store.update(this.feature); |
|
128 |
} catch (Exception ex) { |
|
129 |
throw new RuntimeException("Can't update feature on '"+this.tableName+"'.", ex); |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
public String getCode() { |
|
134 |
return this.feature.getString(this.codeName); |
|
135 |
} |
|
136 |
|
|
137 |
public void newCode() { |
|
138 |
this.feature.set(this.codeName, workspace.createUniqueID()); |
|
139 |
} |
|
140 |
|
|
141 |
public void setCode(String code) { |
|
142 |
this.feature.set(this.codeName, code); |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 |
private final String tableName; |
|
147 |
private final FeatureType featureType; |
|
148 |
|
|
149 |
public AbstractTable(String tableName, FeatureType featureType) { |
|
150 |
this.tableName = tableName; |
|
151 |
this.featureType = featureType; |
|
152 |
} |
|
153 |
|
|
154 |
public String getTableName() { |
|
155 |
return this.tableName; |
|
156 |
} |
|
157 |
|
|
158 |
public FeatureType getFeatureType() { |
|
159 |
return this.featureType; |
|
160 |
} |
|
161 |
|
|
162 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/client/tables/EntitiesTable.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.client.tables; |
|
2 |
|
|
3 |
import javax.json.JsonObject; |
|
4 |
import org.gvsig.vcsgis.client.tables.AbstractTable.AbstractRow; |
|
5 |
import org.gvsig.vcsgis.lib.VCSGisWorkspace.Entity; |
|
6 |
import static org.gvsig.vcsgis.lib.VCSGisWorkspace.STATE_CONFLICT; |
|
7 |
import static org.gvsig.vcsgis.lib.VCSGisWorkspace.STATE_MODIFIED; |
|
8 |
import static org.gvsig.vcsgis.lib.VCSGisWorkspace.STATE_NEW; |
|
9 |
import static org.gvsig.vcsgis.lib.VCSGisWorkspace.STATE_OUTDATED; |
|
10 |
import static org.gvsig.vcsgis.lib.VCSGisWorkspace.STATE_OUTDATED_AND_MODIFIED; |
|
11 |
import static org.gvsig.vcsgis.lib.VCSGisWorkspace.STATE_UNMODIFIED; |
|
12 |
import org.gvsig.fmap.dal.DALLocator; |
|
13 |
import org.gvsig.fmap.dal.DataManager; |
|
14 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
15 |
import org.gvsig.fmap.dal.feature.Feature; |
|
16 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
17 |
import org.gvsig.fmap.dal.feature.FeatureSet.DisposableFeatureSetIterable; |
|
18 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
19 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
20 |
import org.gvsig.json.Json; |
|
21 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
22 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
23 |
import org.gvsig.vcsgis.client.VCSGisWorkspaceEx; |
|
24 |
|
|
25 |
/** |
|
26 |
* |
|
27 |
* @author gvSIG Team |
|
28 |
*/ |
|
29 |
@SuppressWarnings("UseSpecificCatch") |
|
30 |
public class EntitiesTable extends AbstractTable { |
|
31 |
|
|
32 |
public static final String TABLE_NAME = "VCSGIS_ENTITIES"; |
|
33 |
|
|
34 |
private static final String COD_ENTITY = "COD_ENTITY"; |
|
35 |
private static final String ENTITY_NAME = "ENT_NAME"; |
|
36 |
private static final String ENTITY_STATE = "ENT_STATE"; |
|
37 |
private static final String DATATABLE_NAME = "ENT_DATATABLE"; |
|
38 |
private static final String FEATUREID_FIELD_NAME = "ENT_FEATURECODE"; |
|
39 |
private static final String GEOMETRY_FIELD_NAME = "ENT_GEOMNAME"; |
|
40 |
private static final String DESCRIPTION = "ENT_DESCRIPTION"; |
|
41 |
private static final String FEATURETYPE = "ENT_FEATURETYPE"; |
|
42 |
private static final String BRACNH_NAME = "ENT_BRANCHNAME"; |
|
43 |
private static final String COD_LOCAL_REVISION = "COD_LOCAL_REVISION"; |
|
44 |
private static final String COD_REPOSITORY_REVISION = "COD_REPO_REVISION"; |
|
45 |
|
|
46 |
public static class EntityRow extends AbstractRow implements Entity { |
|
47 |
|
|
48 |
private FeatureType featureType; |
|
49 |
|
|
50 |
public EntityRow(VCSGisWorkspaceEx workspace) { |
|
51 |
super(workspace, TABLE_NAME, COD_ENTITY, null); |
|
52 |
} |
|
53 |
|
|
54 |
public EntityRow(VCSGisWorkspaceEx workspace, Feature feature) { |
|
55 |
super(workspace, TABLE_NAME, COD_ENTITY, feature); |
|
56 |
} |
|
57 |
|
|
58 |
@Override |
|
59 |
public String getEntityName() { |
|
60 |
return this.feature.getString(ENTITY_NAME); |
|
61 |
} |
|
62 |
|
|
63 |
@Override |
|
64 |
public String getDataTableName() { |
|
65 |
return this.feature.getString(DATATABLE_NAME); |
|
66 |
} |
|
67 |
|
|
68 |
public String getDataCodeFieldName() { |
|
69 |
return this.feature.getString(FEATUREID_FIELD_NAME); |
|
70 |
} |
|
71 |
|
|
72 |
public String getGeometryFieldName() { |
|
73 |
return this.feature.getString(GEOMETRY_FIELD_NAME); |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public String getDescription() { |
|
78 |
return this.feature.getString(DESCRIPTION); |
|
79 |
} |
|
80 |
|
|
81 |
@Override |
|
82 |
public String getBranchName() { |
|
83 |
return this.feature.getString(BRACNH_NAME); |
|
84 |
} |
|
85 |
|
|
86 |
public String getFeatureTypeAsJson() { |
|
87 |
return this.feature.getString(FEATURETYPE); |
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
public FeatureType getFeatureType() { |
|
92 |
if (this.featureType == null) { |
|
93 |
JsonObject json = Json.createObject(this.getFeatureTypeAsJson()); |
|
94 |
this.featureType = DALLocator.getDataManager().createFeatureType(json); |
|
95 |
} |
|
96 |
return this.featureType; |
|
97 |
} |
|
98 |
|
|
99 |
public void setEntityName(String entityName) { |
|
100 |
this.feature.set(ENTITY_NAME, entityName); |
|
101 |
} |
|
102 |
|
|
103 |
public void setDataTableName(String dataTableName) { |
|
104 |
this.feature.set(DATATABLE_NAME, dataTableName); |
|
105 |
} |
Also available in: Unified diff