Revision 32401
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.prov/org.gvsig.installer.prov.plugin/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.installer.prov.plugin.PluginInstallerProviderLibrary |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.prov/org.gvsig.installer.prov.plugin/src/main/java/org/gvsig/installer/prov/plugin/execution/PluginInstallerExecutionProviderFactory.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.prov.plugin.execution; |
|
29 |
|
|
30 |
import org.gvsig.tools.ToolsLocator; |
|
31 |
import org.gvsig.tools.dynobject.DynClass; |
|
32 |
import org.gvsig.tools.dynobject.DynObject; |
|
33 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
34 |
import org.gvsig.tools.service.spi.AbstractProviderFactory; |
|
35 |
import org.gvsig.tools.service.spi.Provider; |
|
36 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
37 |
|
|
38 |
/** |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
40 |
*/ |
|
41 |
public class PluginInstallerExecutionProviderFactory extends AbstractProviderFactory{ |
|
42 |
public static final String PROVIDER_NAME = "plugin"; |
|
43 |
public static final String PROVIDER_DESCRIPTION = ""; |
|
44 |
|
|
45 |
private DynClass dynclass; |
|
46 |
|
|
47 |
@Override |
|
48 |
protected DynClass createParametersDynClass() { |
|
49 |
if (dynclass == null){ |
|
50 |
initialize(); |
|
51 |
} |
|
52 |
return dynclass; |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
protected Provider doCreate(DynObject parameters, ProviderServices services) { |
|
57 |
return new PluginInstallerExecutionProvider(services); |
|
58 |
} |
|
59 |
|
|
60 |
public void initialize() { |
|
61 |
if (dynclass == null){ |
|
62 |
DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager(); |
|
63 |
dynclass = dynObjectManager.createDynClass(PROVIDER_NAME, PROVIDER_DESCRIPTION); |
|
64 |
dynObjectManager.add(dynclass); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
} |
|
69 |
|
|
0 | 70 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.prov/org.gvsig.installer.prov.plugin/src/main/java/org/gvsig/installer/prov/plugin/execution/PluginInstallerExecutionProvider.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.prov.plugin.execution; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
import java.io.InputStream; |
|
32 |
|
|
33 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
34 |
import org.gvsig.installer.lib.api.InstallerLocator; |
|
35 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
|
36 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
|
37 |
import org.gvsig.installer.lib.spi.InstallerProviderManager; |
|
38 |
import org.gvsig.installer.lib.spi.InstallerProviderServices; |
|
39 |
import org.gvsig.installer.lib.spi.execution.InstallerExecutionProvider; |
|
40 |
import org.gvsig.tools.service.spi.AbstractProvider; |
|
41 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
42 |
|
|
43 |
/** |
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
45 |
*/ |
|
46 |
public class PluginInstallerExecutionProvider extends AbstractProvider implements InstallerExecutionProvider { |
|
47 |
private File pluginsDirectory = null; |
|
48 |
private InputStream inputStream = null; |
|
49 |
private static final InstallerProviderManager installerProviderManager = InstallerProviderLocator.getProviderManager(); |
|
50 |
|
|
51 |
public PluginInstallerExecutionProvider(ProviderServices providerServices) { |
|
52 |
super(providerServices); |
|
53 |
} |
|
54 |
|
|
55 |
public InstallerInfo getInstalledInstallerInfo() { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
return null; |
|
58 |
} |
|
59 |
|
|
60 |
public InstallerInfo getInstallerInfo() { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
return null; |
|
63 |
} |
|
64 |
|
|
65 |
public void install() throws InstallerExecutionServiceException { |
|
66 |
InstallerProviderServices installerProviderServices = installerProviderManager.createInstallerProviderServices(); |
|
67 |
installerProviderServices.decompress(inputStream, pluginsDirectory); |
|
68 |
} |
|
69 |
|
|
70 |
public boolean isInstalled() { |
|
71 |
// TODO Auto-generated method stub |
|
72 |
return false; |
|
73 |
} |
|
74 |
|
|
75 |
public boolean isUpdated() { |
|
76 |
// TODO Auto-generated method stub |
|
77 |
return false; |
|
78 |
} |
|
79 |
|
|
80 |
public void setInstaller(InputStream inputStream) |
|
81 |
throws InstallerExecutionServiceException { |
|
82 |
this.inputStream = inputStream; |
|
83 |
} |
|
84 |
|
|
85 |
public void setApplicationDirectory(File applicationDirectory) throws InstallerExecutionServiceException { |
|
86 |
pluginsDirectory = new File(applicationDirectory + File.separator + "gvSIG" + File.separator + "extensiones"); |
|
87 |
if (!pluginsDirectory.exists()){ |
|
88 |
throw new InstallerExecutionServiceException("plugins_directory_not_found"); |
|
89 |
} |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
0 | 93 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.prov/org.gvsig.installer.prov.plugin/src/main/java/org/gvsig/installer/prov/plugin/PluginInstallerProviderLibrary.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.prov.plugin; |
|
29 |
|
|
30 |
import org.gvsig.installer.lib.spi.InstallerProviderLocator; |
|
31 |
import org.gvsig.installer.prov.plugin.execution.PluginInstallerExecutionProviderFactory; |
|
32 |
import org.gvsig.tools.library.AbstractLibrary; |
|
33 |
import org.gvsig.tools.library.LibraryException; |
|
34 |
import org.gvsig.tools.service.spi.ProviderManager; |
|
35 |
|
|
36 |
/** |
|
37 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
38 |
*/ |
|
39 |
public class PluginInstallerProviderLibrary extends AbstractLibrary{ |
|
40 |
|
|
41 |
@Override |
|
42 |
protected void doInitialize() throws LibraryException { |
|
43 |
|
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doPostInitialize() throws LibraryException { |
|
48 |
ProviderManager providerManager = InstallerProviderLocator.getProviderManager(); |
|
49 |
providerManager.addProviderFactory(new PluginInstallerExecutionProviderFactory()); |
|
50 |
} |
|
51 |
} |
|
0 | 52 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/resources/locale/text_en.properties | ||
---|---|---|
14 | 14 |
installer_progress=Install progress |
15 | 15 |
installer_advanced_mode=The advanced mode option allows to copy resources that are located out of the plugin directory. We don't recommend to use this option. |
16 | 16 |
installer_initializing=Inicializando |
17 |
installer_create_output_file_exception=Error creating the output file |
|
17 |
installer_create_output_file_exception=Error creating the output file |
|
18 |
installer_select_installer=Select the installer |
|
19 |
installer_select_plugins=Select the plugins to install |
|
20 |
installer_execute_adding_error=Error aading a resource |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/panel/ProgressPanel.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.panel; |
|
29 |
|
|
30 |
import java.awt.Font; |
|
31 |
import java.awt.GridBagConstraints; |
|
32 |
import java.awt.GridBagLayout; |
|
33 |
import java.awt.Insets; |
|
34 |
|
|
35 |
import javax.swing.JLabel; |
|
36 |
import javax.swing.JPanel; |
|
37 |
import javax.swing.JProgressBar; |
|
38 |
|
|
39 |
import org.gvsig.installer.lib.api.creation.InstallerCreationServiceException; |
|
40 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
41 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
42 |
|
|
43 |
/** |
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
45 |
*/ |
|
46 |
public class ProgressPanel extends JPanel { |
|
47 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
48 |
private JLabel pluginLabel; |
|
49 |
private JProgressBar progressBar; |
|
50 |
private JLabel progressLabel; |
|
51 |
|
|
52 |
public ProgressPanel() { |
|
53 |
super(); |
|
54 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
55 |
initComponents(); |
|
56 |
initLabels(); |
|
57 |
} |
|
58 |
|
|
59 |
private void initLabels() { |
|
60 |
progressLabel.setText(swingInstallerManager.getText("installer_initializing")); |
|
61 |
} |
|
62 |
|
|
63 |
private void initComponents() { |
|
64 |
java.awt.GridBagConstraints gridBagConstraints; |
|
65 |
|
|
66 |
progressBar = new JProgressBar(); |
|
67 |
progressLabel = new JLabel(); |
|
68 |
pluginLabel = new JLabel(); |
|
69 |
|
|
70 |
setLayout(new GridBagLayout()); |
|
71 |
gridBagConstraints = new GridBagConstraints(); |
|
72 |
gridBagConstraints.gridx = 0; |
|
73 |
gridBagConstraints.gridy = 2; |
|
74 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
75 |
gridBagConstraints.weightx = 1.0; |
|
76 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
77 |
add(progressBar, gridBagConstraints); |
|
78 |
|
|
79 |
progressLabel.setFont(new Font("DejaVu Sans", 0, 11)); // NOI18N |
|
80 |
progressLabel.setText("task"); |
|
81 |
gridBagConstraints = new GridBagConstraints(); |
|
82 |
gridBagConstraints.gridx = 0; |
|
83 |
gridBagConstraints.gridy = 1; |
|
84 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
85 |
gridBagConstraints.insets = new Insets(5, 2, 2, 2); |
|
86 |
add(progressLabel, gridBagConstraints); |
|
87 |
|
|
88 |
pluginLabel.setText("plugin"); |
|
89 |
gridBagConstraints = new GridBagConstraints(); |
|
90 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
91 |
gridBagConstraints.insets = new Insets(5, 2, 2, 2); |
|
92 |
add(pluginLabel, gridBagConstraints); |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* @param plugin the plugin to set |
|
97 |
*/ |
|
98 |
public void setPluginText(String plugin) { |
|
99 |
this.pluginLabel.setText(plugin); |
|
100 |
} |
|
101 |
|
|
102 |
public void setCompressingText(){ |
|
103 |
progressLabel.setText(swingInstallerManager.getText("compressing")); |
|
104 |
} |
|
105 |
|
|
106 |
public void setFinishedText(){ |
|
107 |
progressLabel.setText(swingInstallerManager.getText("finished")); |
|
108 |
} |
|
109 |
|
|
110 |
public void setProgress(int progress){ |
|
111 |
progressBar.setValue(progress); |
|
112 |
} |
|
113 |
|
|
114 |
public void setExceptionText(Exception e) { |
|
115 |
progressLabel.setText(swingInstallerManager.getText("installer_create_output_file_exception")); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
0 | 119 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/DefaultInstallerExecutionWizard.java | ||
---|---|---|
28 | 28 |
package org.gvsig.installer.swing.impl.execution; |
29 | 29 |
|
30 | 30 |
import java.awt.BorderLayout; |
31 |
import java.io.BufferedInputStream; |
|
32 |
import java.io.File; |
|
31 | 33 |
import java.io.InputStream; |
34 |
import java.util.ArrayList; |
|
35 |
import java.util.List; |
|
32 | 36 |
|
33 | 37 |
import javax.swing.ImageIcon; |
34 | 38 |
|
35 | 39 |
import jwizardcomponent.DefaultJWizardComponents; |
36 | 40 |
|
41 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
42 |
import org.gvsig.installer.lib.api.InstallerLocator; |
|
43 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionService; |
|
44 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
|
37 | 45 |
import org.gvsig.installer.swing.api.execution.InstallerExecutionWizard; |
46 |
import org.gvsig.installer.swing.impl.InstallerWizardContainer; |
|
47 |
import org.gvsig.installer.swing.impl.execution.wizard.ProgressWizard; |
|
48 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectInstallersWizard; |
|
49 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectPluginsWizard; |
|
38 | 50 |
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo; |
51 |
import org.gvsig.tools.locator.LocatorException; |
|
52 |
import org.slf4j.Logger; |
|
53 |
import org.slf4j.LoggerFactory; |
|
39 | 54 |
|
40 | 55 |
/** |
41 | 56 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
42 | 57 |
*/ |
43 | 58 |
public class DefaultInstallerExecutionWizard extends InstallerExecutionWizard{ |
44 | 59 |
private WizardPanelWithLogo wizardPanelWithLogo = null; |
60 |
private InstallerExecutionService installerExecutionService = null; |
|
61 |
private File applicationDirectory = null; |
|
62 |
private static final Logger logger = LoggerFactory.getLogger(DefaultInstallerExecutionWizard.class); |
|
63 |
private List<InstallerInfo> installersToInstall = null; |
|
64 |
|
|
65 |
//Wizards |
|
66 |
private SelectInstallersWizard selectInstallersWizard = null; |
|
67 |
private SelectPluginsWizard selectPluginsWizard = null; |
|
68 |
private ProgressWizard progressWizard = null; |
|
45 | 69 |
|
46 |
public DefaultInstallerExecutionWizard(ImageIcon logo)
|
|
70 |
public DefaultInstallerExecutionWizard() |
|
47 | 71 |
{ |
48 |
wizardPanelWithLogo = new WizardPanelWithLogo(logo);
|
|
72 |
wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/createplugininstallicon.png").getFile()));
|
|
49 | 73 |
|
74 |
selectInstallersWizard = new SelectInstallersWizard(this); |
|
75 |
selectPluginsWizard = new SelectPluginsWizard(this); |
|
76 |
progressWizard = new ProgressWizard(this); |
|
77 |
|
|
78 |
installersToInstall = new ArrayList<InstallerInfo>(); |
|
79 |
|
|
80 |
addWizards(); |
|
81 |
|
|
50 | 82 |
this.setLayout(new BorderLayout()); |
51 | 83 |
this.add(wizardPanelWithLogo, BorderLayout.CENTER); |
52 | 84 |
} |
85 |
|
|
86 |
private void addWizards(){ |
|
87 |
getWizardComponents().addWizardPanel( |
|
88 |
new InstallerWizardContainer(getWizardComponents(), |
|
89 |
selectInstallersWizard)); |
|
90 |
getWizardComponents().addWizardPanel( |
|
91 |
new InstallerWizardContainer(getWizardComponents(), |
|
92 |
selectPluginsWizard)); |
|
93 |
getWizardComponents().addWizardPanel( |
|
94 |
new InstallerWizardContainer(getWizardComponents(), |
|
95 |
progressWizard)); |
|
96 |
} |
|
53 | 97 |
|
54 | 98 |
public DefaultJWizardComponents getWizardComponents() |
55 | 99 |
{ |
56 | 100 |
return wizardPanelWithLogo.getWizardComponents(); |
57 | 101 |
} |
58 | 102 |
|
103 |
private void checkInstallerExceutionService() throws InstallerExecutionServiceException{ |
|
104 |
if (installerExecutionService == null){ |
|
105 |
try { |
|
106 |
installerExecutionService = |
|
107 |
InstallerLocator.getInstallerManager().getInstallerExecutionService(); |
|
108 |
} catch (LocatorException e) { |
|
109 |
throw new InstallerExecutionServiceException("Error getting the execution service", e); |
|
110 |
} |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
59 | 114 |
@Override |
60 |
public void setInstaller(InputStream inputStream) { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
|
|
115 |
public void setInstaller(InputStream inputStream) throws InstallerExecutionServiceException { |
|
116 |
checkInstallerExceutionService(); |
|
117 |
installerExecutionService.addInstaller(inputStream); |
|
118 |
} |
|
119 |
|
|
120 |
@Override |
|
121 |
public void setApplicationDirectory(File applicationDirectory) throws InstallerExecutionServiceException { |
|
122 |
checkInstallerExceutionService(); |
|
123 |
installerExecutionService.setApplicationDirectory(applicationDirectory); |
|
63 | 124 |
} |
125 |
|
|
126 |
/** |
|
127 |
* @return the installerExecutionService |
|
128 |
*/ |
|
129 |
public InstallerExecutionService getInstallerExecutionService() { |
|
130 |
return installerExecutionService; |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
/** |
|
135 |
* @return the installersToInstall |
|
136 |
*/ |
|
137 |
public List<InstallerInfo> getInstallersToInstall() { |
|
138 |
return installersToInstall; |
|
139 |
} |
|
64 | 140 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/panel/SelectInstallersPanel.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.panel; |
|
29 |
|
|
30 |
import java.awt.BorderLayout; |
|
31 |
import java.awt.GridBagConstraints; |
|
32 |
import java.awt.GridBagLayout; |
|
33 |
import java.awt.Insets; |
|
34 |
import java.awt.event.ItemEvent; |
|
35 |
import java.awt.event.ItemListener; |
|
36 |
import java.io.File; |
|
37 |
|
|
38 |
import javax.swing.ButtonGroup; |
|
39 |
import javax.swing.JPanel; |
|
40 |
import javax.swing.JRadioButton; |
|
41 |
import javax.swing.JTextField; |
|
42 |
|
|
43 |
import org.gvsig.gui.beans.openfile.FileTextField; |
|
44 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
45 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
46 |
|
|
47 |
/** |
|
48 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
49 |
*/ |
|
50 |
public class SelectInstallersPanel extends JPanel implements ItemListener{ |
|
51 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
52 |
private JRadioButton fileRadioButton; |
|
53 |
private ButtonGroup buttonGroup; |
|
54 |
private JPanel northPanel; |
|
55 |
private FileTextField selectFileText; |
|
56 |
private JRadioButton standardRadionButton; |
|
57 |
|
|
58 |
public SelectInstallersPanel() { |
|
59 |
super(); |
|
60 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
61 |
initComponents(); |
|
62 |
initListeners(); |
|
63 |
standardRadionButton.setSelected(true); |
|
64 |
} |
|
65 |
|
|
66 |
private void initListeners() { |
|
67 |
standardRadionButton.addItemListener(this); |
|
68 |
fileRadioButton.addItemListener(this); |
|
69 |
} |
|
70 |
|
|
71 |
private void initComponents() { |
|
72 |
java.awt.GridBagConstraints gridBagConstraints; |
|
73 |
|
|
74 |
northPanel = new JPanel(); |
|
75 |
standardRadionButton = new JRadioButton(); |
|
76 |
fileRadioButton = new JRadioButton(); |
|
77 |
selectFileText = new FileTextField(); |
|
78 |
buttonGroup = new ButtonGroup(); |
|
79 |
|
|
80 |
buttonGroup.add(standardRadionButton); |
|
81 |
buttonGroup.add(fileRadioButton); |
|
82 |
|
|
83 |
setLayout(new BorderLayout()); |
|
84 |
|
|
85 |
northPanel.setLayout(new GridBagLayout()); |
|
86 |
|
|
87 |
standardRadionButton.setText("Standard installation"); |
|
88 |
gridBagConstraints = new GridBagConstraints(); |
|
89 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
90 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
91 |
northPanel.add(standardRadionButton, gridBagConstraints); |
|
92 |
|
|
93 |
fileRadioButton.setText("Installation from file"); |
|
94 |
gridBagConstraints = new GridBagConstraints(); |
|
95 |
gridBagConstraints.gridx = 0; |
|
96 |
gridBagConstraints.gridy = 1; |
|
97 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
98 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
99 |
northPanel.add(fileRadioButton, gridBagConstraints); |
|
100 |
gridBagConstraints = new GridBagConstraints(); |
|
101 |
gridBagConstraints.gridx = 0; |
|
102 |
gridBagConstraints.gridy = 2; |
|
103 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
104 |
gridBagConstraints.weightx = 1.0; |
|
105 |
gridBagConstraints.insets = new Insets(2, 20, 2, 2); |
|
106 |
northPanel.add(selectFileText, gridBagConstraints); |
|
107 |
|
|
108 |
add(northPanel, java.awt.BorderLayout.NORTH); |
|
109 |
} |
|
110 |
|
|
111 |
public void itemStateChanged(ItemEvent e) { |
|
112 |
selectFileText.setEnabled(fileRadioButton.isSelected()); |
|
113 |
} |
|
114 |
|
|
115 |
public File getSelectedFile(){ |
|
116 |
return selectFileText.getSelectedFile(); |
|
117 |
} |
|
118 |
|
|
119 |
public boolean isStandardSelected(){ |
|
120 |
return standardRadionButton.isSelected(); |
|
121 |
} |
|
122 |
|
|
123 |
|
|
124 |
} |
|
125 |
|
|
0 | 126 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/panel/SelectPluginsPanel.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.panel; |
|
29 |
|
|
30 |
import java.awt.GridBagConstraints; |
|
31 |
import java.awt.GridBagLayout; |
|
32 |
import java.util.List; |
|
33 |
|
|
34 |
import javax.swing.JPanel; |
|
35 |
import javax.swing.JTabbedPane; |
|
36 |
|
|
37 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
38 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
39 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
40 |
import org.gvsig.installer.swing.impl.execution.model.PluginsTableModel; |
|
41 |
|
|
42 |
/** |
|
43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
44 |
*/ |
|
45 |
public class SelectPluginsPanel extends JPanel{ |
|
46 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
47 |
private JTabbedPane officialTabbedPane; |
|
48 |
private PluginsTablePanel officialPluginsTablePanel; |
|
49 |
private PluginsTablePanel notOfficialPluginsTablePanel; |
|
50 |
|
|
51 |
public SelectPluginsPanel() { |
|
52 |
super(); |
|
53 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
54 |
initComponents(); |
|
55 |
} |
|
56 |
|
|
57 |
public void updateTableModel(PluginsTableModel officialPluginsTableModel, PluginsTableModel notOfficialTableModel){ |
|
58 |
officialPluginsTablePanel.setTableModel(officialPluginsTableModel); |
|
59 |
notOfficialPluginsTablePanel.setTableModel(notOfficialTableModel); |
|
60 |
} |
|
61 |
|
|
62 |
private void initComponents() { |
|
63 |
GridBagConstraints gridBagConstraints; |
|
64 |
|
|
65 |
officialTabbedPane = new JTabbedPane(); |
|
66 |
notOfficialPluginsTablePanel = new PluginsTablePanel(); |
|
67 |
officialPluginsTablePanel = new PluginsTablePanel(); |
|
68 |
|
|
69 |
setLayout(new GridBagLayout()); |
|
70 |
|
|
71 |
officialTabbedPane.addTab("Official", officialPluginsTablePanel); |
|
72 |
officialTabbedPane.addTab("Not Official", notOfficialPluginsTablePanel); |
|
73 |
|
|
74 |
gridBagConstraints = new GridBagConstraints(); |
|
75 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
76 |
gridBagConstraints.weightx = 1.0; |
|
77 |
gridBagConstraints.weighty = 1.0; |
|
78 |
add(officialTabbedPane, gridBagConstraints); |
|
79 |
} |
|
80 |
|
|
81 |
public void addInstallersToExecute(List<InstallerInfo> installerInfosToInstall){ |
|
82 |
officialPluginsTablePanel.addInstallersToExecute(installerInfosToInstall); |
|
83 |
notOfficialPluginsTablePanel.addInstallersToExecute(installerInfosToInstall); |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
0 | 87 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/panel/PluginsTablePanel.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.panel; |
|
29 |
|
|
30 |
import java.awt.GridBagConstraints; |
|
31 |
import java.awt.GridBagLayout; |
|
32 |
import java.awt.Insets; |
|
33 |
import java.util.List; |
|
34 |
|
|
35 |
import javax.swing.JCheckBox; |
|
36 |
import javax.swing.JPanel; |
|
37 |
import javax.swing.JScrollPane; |
|
38 |
import javax.swing.JTable; |
|
39 |
import javax.swing.JTextArea; |
|
40 |
import javax.swing.event.ListSelectionEvent; |
|
41 |
import javax.swing.event.ListSelectionListener; |
|
42 |
|
|
43 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
44 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
45 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
46 |
import org.gvsig.installer.swing.impl.execution.model.PluginsTableCellRenderer; |
|
47 |
import org.gvsig.installer.swing.impl.execution.model.PluginsTableModel; |
|
48 |
|
|
49 |
/** |
|
50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
51 |
*/ |
|
52 |
public class PluginsTablePanel extends JPanel implements ListSelectionListener{ |
|
53 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
54 |
private JScrollPane descriptionScrollPane; |
|
55 |
private JTextArea descriptionTextArea; |
|
56 |
private JScrollPane pluginsScrollPane; |
|
57 |
private JTable pluginsTable; |
|
58 |
|
|
59 |
public PluginsTablePanel() { |
|
60 |
super(); |
|
61 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
62 |
initComponents(); |
|
63 |
pluginsTable.getSelectionModel().addListSelectionListener(this); |
|
64 |
pluginsTable.setDefaultRenderer(Boolean.class, new PluginsTableCellRenderer()); |
|
65 |
} |
|
66 |
|
|
67 |
public void setTableModel(PluginsTableModel pluginsTableModel){ |
|
68 |
pluginsTable.setModel(pluginsTableModel); |
|
69 |
} |
|
70 |
|
|
71 |
public void addInstallersToExecute(List<InstallerInfo> installerInfosToInstall){ |
|
72 |
((PluginsTableModel)pluginsTable.getModel()).addInstallersToExecute(installerInfosToInstall); |
|
73 |
} |
|
74 |
|
|
75 |
private void initComponents() { |
|
76 |
java.awt.GridBagConstraints gridBagConstraints; |
|
77 |
|
|
78 |
pluginsScrollPane = new JScrollPane(); |
|
79 |
pluginsTable = new JTable(); |
|
80 |
descriptionScrollPane = new JScrollPane(); |
|
81 |
descriptionTextArea = new JTextArea(); |
|
82 |
|
|
83 |
setLayout(new GridBagLayout()); |
|
84 |
|
|
85 |
pluginsScrollPane.setViewportView(pluginsTable); |
|
86 |
|
|
87 |
gridBagConstraints = new GridBagConstraints(); |
|
88 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
89 |
gridBagConstraints.weightx = 1.0; |
|
90 |
gridBagConstraints.weighty = 0.75; |
|
91 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
92 |
add(pluginsScrollPane, gridBagConstraints); |
|
93 |
|
|
94 |
descriptionTextArea.setEditable(false); |
|
95 |
descriptionTextArea.setColumns(20); |
|
96 |
descriptionTextArea.setRows(5); |
|
97 |
descriptionScrollPane.setViewportView(descriptionTextArea); |
|
98 |
|
|
99 |
gridBagConstraints = new GridBagConstraints(); |
|
100 |
gridBagConstraints.gridx = 0; |
|
101 |
gridBagConstraints.gridy = 1; |
|
102 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
103 |
gridBagConstraints.weightx = 1.0; |
|
104 |
gridBagConstraints.weighty = 0.25; |
|
105 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
106 |
add(descriptionScrollPane, gridBagConstraints); |
|
107 |
} |
|
108 |
|
|
109 |
public void valueChanged(ListSelectionEvent e) { |
|
110 |
int row = pluginsTable.getSelectedRow(); |
|
111 |
if (row != -1){ |
|
112 |
descriptionTextArea.setText(((PluginsTableModel)pluginsTable.getModel()).getDescriptionAt(row)); |
|
113 |
} |
|
114 |
|
|
115 |
} |
|
116 |
} |
|
117 |
|
|
0 | 118 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/model/PluginsTableModel.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.model; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import javax.swing.JCheckBox; |
|
34 |
import javax.swing.event.TableModelListener; |
|
35 |
import javax.swing.table.TableModel; |
|
36 |
|
|
37 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
38 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionService; |
|
39 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
43 |
*/ |
|
44 |
public class PluginsTableModel implements TableModel{ |
|
45 |
private DefaultSwingInstallerManager swingInstallerManager = null; |
|
46 |
private List<InstallerInfo> installerInfos = null; |
|
47 |
private List<Boolean> selected = null; |
|
48 |
|
|
49 |
public PluginsTableModel(DefaultSwingInstallerManager swingInstallerManager, InstallerExecutionService installerExecutionService, boolean isOfficial) { |
|
50 |
super(); |
|
51 |
this.swingInstallerManager = swingInstallerManager; |
|
52 |
|
|
53 |
installerInfos = new ArrayList<InstallerInfo>(); |
|
54 |
selected = new ArrayList<Boolean>(); |
|
55 |
for (int i=0 ; i<installerExecutionService.getPluginsSize() ; i++){ |
|
56 |
InstallerInfo installerInfo = installerExecutionService.getPluginInfoAt(i); |
|
57 |
if (installerInfo.isOfficial() == isOfficial){ |
|
58 |
installerInfos.add(installerInfo); |
|
59 |
selected.add(false); |
|
60 |
} |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
public void addTableModelListener(TableModelListener l) { |
|
65 |
// TODO Auto-generated method stub |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
public Class<?> getColumnClass(int columnIndex) { |
|
70 |
switch(columnIndex){ |
|
71 |
case 0: |
|
72 |
return Boolean.class; |
|
73 |
default: |
|
74 |
return String.class; |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
public int getColumnCount() { |
|
79 |
return 6; |
|
80 |
} |
|
81 |
|
|
82 |
public String getColumnName(int columnIndex) { |
|
83 |
switch(columnIndex){ |
|
84 |
case 0: |
|
85 |
return swingInstallerManager.getText("selected"); |
|
86 |
case 1: |
|
87 |
return swingInstallerManager.getText("name"); |
|
88 |
case 2: |
|
89 |
return swingInstallerManager.getText("type"); |
|
90 |
case 3: |
|
91 |
return swingInstallerManager.getText("status"); |
|
92 |
case 4: |
|
93 |
return swingInstallerManager.getText("version"); |
|
94 |
case 5: |
|
95 |
return swingInstallerManager.getText("build"); |
|
96 |
default: |
|
97 |
return ""; |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
101 |
public int getRowCount() { |
|
102 |
return installerInfos.size(); |
|
103 |
} |
|
104 |
|
|
105 |
public Object getValueAt(int rowIndex, int columnIndex) { |
|
106 |
InstallerInfo installerInfo = installerInfos.get(rowIndex); |
|
107 |
switch (columnIndex){ |
|
108 |
case 0: |
|
109 |
return selected.get(rowIndex); |
|
110 |
case 1: |
|
111 |
return installerInfo.getName(); |
|
112 |
case 2: |
|
113 |
return installerInfo.getType(); |
|
114 |
case 3: |
|
115 |
return installerInfo.getState(); |
|
116 |
case 4: |
|
117 |
return installerInfo.getVersion(); |
|
118 |
case 5: |
|
119 |
return installerInfo.getBuild(); |
|
120 |
default: |
|
121 |
return ""; |
|
122 |
|
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
public String getDescriptionAt(int rowIndex){ |
|
127 |
return installerInfos.get(rowIndex).getDescription(); |
|
128 |
} |
|
129 |
|
|
130 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
|
131 |
if (columnIndex == 0){ |
|
132 |
return true; |
|
133 |
} |
|
134 |
return false; |
|
135 |
} |
|
136 |
|
|
137 |
public void removeTableModelListener(TableModelListener l) { |
|
138 |
// TODO Auto-generated method stub |
|
139 |
|
|
140 |
} |
|
141 |
|
|
142 |
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
|
143 |
selected.remove(rowIndex); |
|
144 |
selected.add(rowIndex,(Boolean)aValue); |
|
145 |
} |
|
146 |
|
|
147 |
public void addInstallersToExecute(List<InstallerInfo> installerInfosToInstall){ |
|
148 |
for (int i=0 ; i<installerInfos.size() ; i++){ |
|
149 |
if (selected.get(i)){ |
|
150 |
installerInfosToInstall.add(installerInfos.get(i)); |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
} |
|
155 |
|
|
0 | 156 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/model/PluginsTableCellRenderer.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.model; |
|
29 |
|
|
30 |
import java.awt.Component; |
|
31 |
|
|
32 |
import javax.swing.JCheckBox; |
|
33 |
import javax.swing.JTable; |
|
34 |
import javax.swing.table.TableCellRenderer; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
39 |
*/ |
|
40 |
public class PluginsTableCellRenderer extends JCheckBox implements TableCellRenderer{ |
|
41 |
protected JCheckBox check = new JCheckBox(); |
|
42 |
|
|
43 |
public Component getTableCellRendererComponent(JTable table, Object value, |
|
44 |
boolean isSelected, boolean hasFocus, int row, int column) { |
|
45 |
|
|
46 |
// if (isSelected) { |
|
47 |
// setForeground(table.getSelectionForeground()); |
|
48 |
// super.setBackground(table.getSelectionBackground()); |
|
49 |
// } |
|
50 |
// else { |
|
51 |
// setForeground(table.getForeground()); |
|
52 |
// setBackground(table.getBackground()); |
|
53 |
// } |
|
54 |
setSelected((value != null && ((Boolean)value).booleanValue())); |
|
55 |
|
|
56 |
// if (hasFocus) { |
|
57 |
// setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); |
|
58 |
// } else { |
|
59 |
// setBorder(noFocusBorder); |
|
60 |
// } |
|
61 |
|
|
62 |
return this; |
|
63 |
|
|
64 |
} |
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
} |
|
70 |
|
|
0 | 71 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/wizard/ProgressWizard.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.wizard; |
|
29 |
|
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import javax.swing.JPanel; |
|
33 |
|
|
34 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
35 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionService; |
|
36 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
|
37 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
|
38 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard; |
|
39 |
import org.gvsig.installer.swing.impl.panel.ProgressPanel; |
|
40 |
import org.slf4j.Logger; |
|
41 |
import org.slf4j.LoggerFactory; |
|
42 |
|
|
43 |
/** |
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
45 |
*/ |
|
46 |
public class ProgressWizard extends ProgressPanel implements InstallerWizardPanel{ |
|
47 |
private DefaultInstallerExecutionWizard installerExecutionWizard; |
|
48 |
private static final Logger logger = LoggerFactory.getLogger(ProgressWizard.class); |
|
49 |
|
|
50 |
public ProgressWizard(DefaultInstallerExecutionWizard installerExecutionWizard) { |
|
51 |
super(); |
|
52 |
this.installerExecutionWizard = installerExecutionWizard; |
|
53 |
} |
|
54 |
|
|
55 |
public JPanel getJPanel() { |
|
56 |
return this; |
|
57 |
} |
|
58 |
|
|
59 |
public String getPanelTitle() { |
|
60 |
return swingInstallerManager.getText("installer_progress"); |
|
61 |
} |
|
62 |
|
|
63 |
public void lastPanel() { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
public void nextPanel() { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
public void updatePanel() { |
|
74 |
InstallerExecutionService installerExecutionService = |
|
75 |
installerExecutionWizard.getInstallerExecutionService(); |
|
76 |
|
|
77 |
List<InstallerInfo> installersToInstall = installerExecutionWizard.getInstallersToInstall(); |
|
78 |
int progressWidth = 100/installersToInstall.size(); |
|
79 |
int progress = 0; |
|
80 |
try{ |
|
81 |
for (int i=0 ; i<installersToInstall.size() ; i++){ |
|
82 |
setProgress(progress); |
|
83 |
InstallerInfo installerInfo = installersToInstall.get(i); |
|
84 |
setPluginText(installerInfo.getName()); |
|
85 |
installerExecutionService.setPluginToInstall(installerInfo.getCode()); |
|
86 |
installerExecutionService.executeInstaller(); |
|
87 |
progress = progress + progressWidth; |
|
88 |
} |
|
89 |
//Set the finished text |
|
90 |
setFinishedText(); |
|
91 |
}catch(InstallerExecutionServiceException e){ |
|
92 |
setExceptionText(e); |
|
93 |
} |
|
94 |
setProgress(100); |
|
95 |
} |
|
96 |
} |
|
97 |
|
|
98 |
|
|
0 | 99 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/wizard/SelectInstallersWizard.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.wizard; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
import java.io.FileInputStream; |
|
32 |
import java.io.FileNotFoundException; |
|
33 |
|
|
34 |
import javax.swing.JOptionPane; |
|
35 |
import javax.swing.JPanel; |
|
36 |
|
|
37 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionService; |
|
38 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionServiceException; |
|
39 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
|
40 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard; |
|
41 |
import org.gvsig.installer.swing.impl.execution.panel.SelectInstallersPanel; |
|
42 |
import org.slf4j.Logger; |
|
43 |
import org.slf4j.LoggerFactory; |
|
44 |
|
|
45 |
/** |
|
46 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
47 |
*/ |
|
48 |
public class SelectInstallersWizard extends SelectInstallersPanel implements InstallerWizardPanel { |
|
49 |
private DefaultInstallerExecutionWizard installerExecutionWizard; |
|
50 |
private static final Logger logger = LoggerFactory.getLogger(SelectInstallersWizard.class); |
|
51 |
|
|
52 |
public SelectInstallersWizard(DefaultInstallerExecutionWizard installerExecutionWizard) { |
|
53 |
super(); |
|
54 |
this.installerExecutionWizard = installerExecutionWizard; |
|
55 |
} |
|
56 |
|
|
57 |
public JPanel getJPanel() { |
|
58 |
return this; |
|
59 |
} |
|
60 |
|
|
61 |
public String getPanelTitle() { |
|
62 |
return swingInstallerManager.getText("installer_select_installer"); |
|
63 |
} |
|
64 |
|
|
65 |
public void lastPanel() { |
|
66 |
// TODO Auto-generated method stub |
|
67 |
|
|
68 |
} |
|
69 |
|
|
70 |
public void nextPanel() { |
|
71 |
InstallerExecutionService installerExecutionService = |
|
72 |
installerExecutionWizard.getInstallerExecutionService(); |
|
73 |
installerExecutionService.deleteInstallers(); |
|
74 |
try{ |
|
75 |
if (isStandardSelected()){ |
|
76 |
installerExecutionService.addInstallersFromInstallDirectory(); |
|
77 |
}else{ |
|
78 |
File file = getSelectedFile(); |
|
79 |
if ((file != null) && (file.exists())){ |
|
80 |
installerExecutionService.addInstaller(new FileInputStream(getSelectedFile())); |
|
81 |
}else{ |
|
82 |
logger.error("The selected file doesn't exist"); |
|
83 |
} |
|
84 |
} |
|
85 |
}catch(InstallerExecutionServiceException e){ |
|
86 |
logger.error("Error adding installer info", e); |
|
87 |
JOptionPane.showMessageDialog(installerExecutionWizard, |
|
88 |
swingInstallerManager.getText("installer_execute_adding_error")); |
|
89 |
}catch (FileNotFoundException e) { |
|
90 |
logger.error("The selected file doesn't exist", e); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
public void updatePanel() { |
|
95 |
|
|
96 |
} |
|
97 |
} |
|
98 |
|
|
0 | 99 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/execution/wizard/SelectPluginsWizard.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.execution.wizard; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
|
|
32 |
import javax.swing.JPanel; |
|
33 |
|
|
34 |
import org.gvsig.installer.lib.api.InstallerInfo; |
|
35 |
import org.gvsig.installer.lib.api.execution.InstallerExecutionService; |
|
36 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
|
37 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallerExecutionWizard; |
|
38 |
import org.gvsig.installer.swing.impl.execution.model.PluginsTableModel; |
|
39 |
import org.gvsig.installer.swing.impl.execution.panel.SelectPluginsPanel; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
43 |
*/ |
|
44 |
public class SelectPluginsWizard extends SelectPluginsPanel implements InstallerWizardPanel { |
|
45 |
private DefaultInstallerExecutionWizard installerExecutionWizard; |
|
46 |
|
|
47 |
public SelectPluginsWizard(DefaultInstallerExecutionWizard installerExecutionWizard) { |
|
48 |
super(); |
|
49 |
this.installerExecutionWizard = installerExecutionWizard; |
|
50 |
} |
|
51 |
|
|
52 |
public JPanel getJPanel() { |
|
53 |
return this; |
|
54 |
} |
|
55 |
|
|
56 |
public String getPanelTitle() { |
|
57 |
return swingInstallerManager.getText("installer_select_plugins"); |
|
58 |
} |
|
59 |
|
|
60 |
public void lastPanel() { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
public void nextPanel() { |
|
66 |
//Adding the selected installers |
|
67 |
addInstallersToExecute(installerExecutionWizard.getInstallersToInstall()); |
|
68 |
} |
|
69 |
|
|
70 |
public void updatePanel() { |
|
71 |
InstallerExecutionService installerExecutionService = |
|
72 |
installerExecutionWizard.getInstallerExecutionService(); |
|
73 |
PluginsTableModel officialPluginsTableModel = new PluginsTableModel(swingInstallerManager, |
|
74 |
installerExecutionService, true); |
|
75 |
PluginsTableModel notOfficialPluginsTableModel = new PluginsTableModel(swingInstallerManager, |
|
76 |
installerExecutionService, false); |
|
77 |
updateTableModel(officialPluginsTableModel, notOfficialPluginsTableModel); |
|
78 |
|
|
79 |
} |
|
80 |
|
|
81 |
} |
|
82 |
|
|
0 | 83 |
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/creation/DefaultInstallerCreationWizard.java | ||
---|---|---|
124 | 124 |
} |
125 | 125 |
|
126 | 126 |
@Override |
127 |
public void setPluginsDirectory(File pluginsDirectory) { |
|
128 |
selectPlugintoInstallWizard.setPluginsDirectory(pluginsDirectory); |
|
129 |
selectFilesWizard.setPluginsDirectory(pluginsDirectory); |
|
127 |
public void setApplicationDirectory(File applicationDirectory) { |
|
128 |
//TODO remove this |
|
129 |
applicationDirectory = new File(applicationDirectory.getAbsolutePath() + File.separator + "gvSIG"); |
|
130 |
applicationDirectory = new File(applicationDirectory.getAbsolutePath() + File.separator + "extensiones"); |
|
131 |
|
|
132 |
selectPlugintoInstallWizard.setPluginsDirectory(applicationDirectory); |
|
133 |
selectFilesWizard.setPluginsDirectory(applicationDirectory); |
|
130 | 134 |
} |
131 | 135 |
|
132 | 136 |
|
branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.swing/org.gvsig.installer.swing.impl/src/main/java/org/gvsig/installer/swing/impl/creation/panel/ProgressPanel.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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Prodevelop} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.installer.swing.impl.creation.panel; |
|
29 |
|
|
30 |
import java.awt.Font; |
|
31 |
import java.awt.GridBagConstraints; |
|
32 |
import java.awt.GridBagLayout; |
|
33 |
import java.awt.Insets; |
|
34 |
|
|
35 |
import javax.swing.JLabel; |
|
36 |
import javax.swing.JPanel; |
|
37 |
import javax.swing.JProgressBar; |
Also available in: Unified diff