Revision 32635
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 |
|
|
32 |
import javax.swing.JOptionPane; |
|
33 |
import javax.swing.JPanel; |
|
34 |
|
|
35 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
36 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
|
37 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
|
38 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
|
39 |
import org.gvsig.installer.swing.impl.execution.panel.SelectInstallersPanel; |
|
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 SelectInstallersWizard extends SelectInstallersPanel implements InstallerWizardPanel { |
|
47 |
private DefaultInstallPackageWizard installerExecutionWizard; |
|
48 |
private static final Logger logger = LoggerFactory.getLogger(SelectInstallersWizard.class); |
|
49 |
|
|
50 |
public SelectInstallersWizard(DefaultInstallPackageWizard 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("select_installer"); |
|
61 |
} |
|
62 |
|
|
63 |
public void lastPanel() { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
public void nextPanel() { |
|
69 |
InstallPackageService installerExecutionService = |
|
70 |
installerExecutionWizard.getInstallerExecutionService(); |
|
71 |
try{ |
|
72 |
if (isStandardSelected()){ |
|
73 |
installerExecutionService.addBundlesFromDirectory(installerExecutionWizard.getDefaultInstallersDirectory()); |
|
74 |
}else{ |
|
75 |
File file = getSelectedFile(); |
|
76 |
if ((file != null) && (file.exists())){ |
|
77 |
installerExecutionService.addBundle(getSelectedFile().toURI()); |
|
78 |
}else{ |
|
79 |
logger.error("The selected file doesn't exist"); |
|
80 |
} |
|
81 |
} |
|
82 |
}catch(InstallPackageServiceException e){ |
|
83 |
logger.error("Error adding installer info", e); |
|
84 |
JOptionPane.showMessageDialog(installerExecutionWizard, |
|
85 |
swingInstallerManager.getText("execute_adding_error")); |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
public void updatePanel() { |
|
90 |
|
|
91 |
} |
|
92 |
|
|
93 |
@Override |
|
94 |
protected void checkNextButtonEnabled() { |
|
95 |
if (installerExecutionWizard != null){ |
|
96 |
installerExecutionWizard.setNextButtonEnabled(isNextButtonEnabled()); |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
|
|
101 |
} |
|
102 |
|
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 javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
33 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
|
34 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
|
35 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel; |
|
36 |
import org.gvsig.installer.swing.impl.execution.panel.SelectPluginsPanel; |
|
37 |
|
|
38 |
/** |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
40 |
*/ |
|
41 |
public class SelectPluginsWizard extends SelectPluginsPanel implements InstallerWizardPanel { |
|
42 |
private DefaultInstallPackageWizard installerExecutionWizard; |
|
43 |
|
|
44 |
public SelectPluginsWizard(DefaultInstallPackageWizard installerExecutionWizard) { |
|
45 |
super(); |
|
46 |
this.installerExecutionWizard = installerExecutionWizard; |
|
47 |
} |
|
48 |
|
|
49 |
public JPanel getJPanel() { |
|
50 |
return this; |
|
51 |
} |
|
52 |
|
|
53 |
public String getPanelTitle() { |
|
54 |
return swingInstallerManager.getText("select_plugins"); |
|
55 |
} |
|
56 |
|
|
57 |
public void lastPanel() { |
|
58 |
// TODO Auto-generated method stub |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
public void nextPanel() { |
|
63 |
//Adding the selected installers |
|
64 |
addInstallersToExecute(installerExecutionWizard.getInstallersToInstall()); |
|
65 |
} |
|
66 |
|
|
67 |
public void updatePanel() { |
|
68 |
InstallPackageService installerExecutionService = |
|
69 |
installerExecutionWizard.getInstallerExecutionService(); |
|
70 |
PackagesTableModel officialPluginsTableModel = new PackagesTableModel(swingInstallerManager, |
|
71 |
installerExecutionService, true); |
|
72 |
PackagesTableModel notOfficialPluginsTableModel = new PackagesTableModel(swingInstallerManager, |
|
73 |
installerExecutionService, false); |
|
74 |
updateTableModel(officialPluginsTableModel, notOfficialPluginsTableModel); |
|
75 |
checkIfPluginSelected(); |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public void checkIfPluginSelected() { |
|
80 |
installerExecutionWizard.setNextButtonEnabled(isPackageSelected()); |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
} |
|
85 |
|
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/SelectBundlesWizard.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 |
|
|
32 |
import javax.swing.JOptionPane; |
|
33 |
import javax.swing.JPanel; |
|
34 |
|
|
35 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
36 |
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException; |
|
37 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
|
38 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
|
39 |
import org.gvsig.installer.swing.impl.execution.panel.SelectBundlesPanel; |
|
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 SelectBundlesWizard extends SelectBundlesPanel implements InstallerWizardPanel { |
|
47 |
private DefaultInstallPackageWizard installerExecutionWizard; |
|
48 |
private static final Logger logger = LoggerFactory.getLogger(SelectBundlesWizard.class); |
|
49 |
|
|
50 |
public SelectBundlesWizard(DefaultInstallPackageWizard 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("select_installer"); |
|
61 |
} |
|
62 |
|
|
63 |
public void lastPanel() { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
public void nextPanel() { |
|
69 |
InstallPackageService installerExecutionService = |
|
70 |
installerExecutionWizard.getInstallerExecutionService(); |
|
71 |
try{ |
|
72 |
if (isStandardSelected()){ |
|
73 |
installerExecutionService.addBundlesFromDirectory(installerExecutionWizard.getDefaultInstallersDirectory()); |
|
74 |
}else{ |
|
75 |
File file = getSelectedFile(); |
|
76 |
if ((file != null) && (file.exists())){ |
|
77 |
installerExecutionService.addBundle(getSelectedFile().toURI()); |
|
78 |
}else{ |
|
79 |
logger.error("The selected file doesn't exist"); |
|
80 |
} |
|
81 |
} |
|
82 |
}catch(InstallPackageServiceException e){ |
|
83 |
logger.error("Error adding installer info", e); |
|
84 |
JOptionPane.showMessageDialog(installerExecutionWizard, |
|
85 |
swingInstallerManager.getText("execute_adding_error")); |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
public void updatePanel() { |
|
90 |
|
|
91 |
} |
|
92 |
|
|
93 |
@Override |
|
94 |
protected void checkNextButtonEnabled() { |
|
95 |
if (installerExecutionWizard != null){ |
|
96 |
installerExecutionWizard.setNextButtonEnabled(isNextButtonEnabled()); |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
|
|
101 |
} |
|
102 |
|
|
0 | 103 |
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/SelectPackagesWizard.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 javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
33 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
|
34 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
|
35 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel; |
|
36 |
import org.gvsig.installer.swing.impl.execution.panel.SelectPackagesPanel; |
|
37 |
|
|
38 |
/** |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
40 |
*/ |
|
41 |
public class SelectPackagesWizard extends SelectPackagesPanel implements InstallerWizardPanel { |
|
42 |
private DefaultInstallPackageWizard installerExecutionWizard; |
|
43 |
|
|
44 |
public SelectPackagesWizard(DefaultInstallPackageWizard installerExecutionWizard) { |
|
45 |
super(); |
|
46 |
this.installerExecutionWizard = installerExecutionWizard; |
|
47 |
} |
|
48 |
|
|
49 |
public JPanel getJPanel() { |
|
50 |
return this; |
|
51 |
} |
|
52 |
|
|
53 |
public String getPanelTitle() { |
|
54 |
return swingInstallerManager.getText("select_plugins"); |
|
55 |
} |
|
56 |
|
|
57 |
public void lastPanel() { |
|
58 |
// TODO Auto-generated method stub |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
public void nextPanel() { |
|
63 |
//Adding the selected installers |
|
64 |
addInstallersToExecute(installerExecutionWizard.getInstallersToInstall()); |
|
65 |
} |
|
66 |
|
|
67 |
public void updatePanel() { |
|
68 |
InstallPackageService installerExecutionService = |
|
69 |
installerExecutionWizard.getInstallerExecutionService(); |
|
70 |
PackagesTableModel officialPluginsTableModel = new PackagesTableModel(swingInstallerManager, |
|
71 |
installerExecutionService, true); |
|
72 |
PackagesTableModel notOfficialPluginsTableModel = new PackagesTableModel(swingInstallerManager, |
|
73 |
installerExecutionService, false); |
|
74 |
updateTableModel(officialPluginsTableModel, notOfficialPluginsTableModel); |
|
75 |
checkIfPluginSelected(); |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public void checkIfPluginSelected() { |
|
80 |
installerExecutionWizard.setNextButtonEnabled(isPackageSelected()); |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
} |
|
85 |
|
|
0 | 86 |
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/DefaultInstallPackageWizard.java | ||
---|---|---|
43 | 43 |
import org.gvsig.installer.swing.api.execution.InstallPackageWizard; |
44 | 44 |
import org.gvsig.installer.swing.impl.InstallerWizardContainer; |
45 | 45 |
import org.gvsig.installer.swing.impl.execution.wizard.ProgressWizard; |
46 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectInstallersWizard;
|
|
47 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectPluginsWizard;
|
|
46 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectBundlesWizard;
|
|
47 |
import org.gvsig.installer.swing.impl.execution.wizard.SelectPackagesWizard;
|
|
48 | 48 |
import org.gvsig.installer.swing.impl.wizard.WizardPanelCancelAction; |
49 | 49 |
import org.gvsig.installer.swing.impl.wizard.WizardPanelFinishAction; |
50 | 50 |
import org.gvsig.installer.swing.impl.wizard.WizardPanelWithLogo; |
... | ... | |
61 | 61 |
private List<PackageInfo> installersToInstall = null; |
62 | 62 |
|
63 | 63 |
//Wizards |
64 |
private SelectInstallersWizard selectInstallersWizard = null;
|
|
65 |
private SelectPluginsWizard selectPluginsWizard = null;
|
|
64 |
private SelectBundlesWizard selectInstallersWizard = null;
|
|
65 |
private SelectPackagesWizard selectPluginsWizard = null;
|
|
66 | 66 |
private ProgressWizard progressWizard = null; |
67 | 67 |
|
68 | 68 |
public DefaultInstallPackageWizard(File applicationDirectory) throws InstallPackageServiceException |
... | ... | |
70 | 70 |
super(applicationDirectory); |
71 | 71 |
wizardPanelWithLogo = new WizardPanelWithLogo(new ImageIcon(getClass().getClassLoader().getResource("images/makepluginpackageicon.png").getFile())); |
72 | 72 |
|
73 |
selectInstallersWizard = new SelectInstallersWizard(this);
|
|
74 |
selectPluginsWizard = new SelectPluginsWizard(this);
|
|
73 |
selectInstallersWizard = new SelectBundlesWizard(this);
|
|
74 |
selectPluginsWizard = new SelectPackagesWizard(this);
|
|
75 | 75 |
progressWizard = new ProgressWizard(this); |
76 | 76 |
|
77 | 77 |
installersToInstall = new ArrayList<PackageInfo>(); |
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 |
import javax.swing.event.DocumentEvent; |
|
43 |
import javax.swing.event.DocumentListener; |
|
44 |
|
|
45 |
import org.gvsig.gui.beans.openfile.FileTextField; |
|
46 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
47 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
48 |
|
|
49 |
/** |
|
50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
51 |
*/ |
|
52 |
public class SelectInstallersPanel extends JPanel implements ItemListener, DocumentListener{ |
|
53 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
54 |
private JRadioButton fileRadioButton; |
|
55 |
private ButtonGroup buttonGroup; |
|
56 |
private JPanel northPanel; |
|
57 |
private FileTextField selectFileText; |
|
58 |
private JRadioButton standardRadionButton; |
|
59 |
|
|
60 |
public SelectInstallersPanel() { |
|
61 |
super(); |
|
62 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
63 |
initComponents(); |
|
64 |
initListeners(); |
|
65 |
standardRadionButton.setSelected(true); |
|
66 |
} |
|
67 |
|
|
68 |
private void initListeners() { |
|
69 |
standardRadionButton.addItemListener(this); |
|
70 |
fileRadioButton.addItemListener(this); |
|
71 |
Object obj = selectFileText.getComponent(0); |
|
72 |
if ((obj != null) && (obj instanceof JTextField)) { |
|
73 |
((JTextField)obj).getDocument().addDocumentListener(this); |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
private void initComponents() { |
|
78 |
java.awt.GridBagConstraints gridBagConstraints; |
|
79 |
|
|
80 |
northPanel = new JPanel(); |
|
81 |
standardRadionButton = new JRadioButton(); |
|
82 |
fileRadioButton = new JRadioButton(); |
|
83 |
selectFileText = new FileTextField(); |
|
84 |
buttonGroup = new ButtonGroup(); |
|
85 |
|
|
86 |
buttonGroup.add(standardRadionButton); |
|
87 |
buttonGroup.add(fileRadioButton); |
|
88 |
|
|
89 |
setLayout(new BorderLayout()); |
|
90 |
|
|
91 |
northPanel.setLayout(new GridBagLayout()); |
|
92 |
|
|
93 |
standardRadionButton.setText("standard_installation"); |
|
94 |
gridBagConstraints = new GridBagConstraints(); |
|
95 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
96 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
97 |
northPanel.add(standardRadionButton, gridBagConstraints); |
|
98 |
|
|
99 |
fileRadioButton.setText("installation_from_file"); |
|
100 |
gridBagConstraints = new GridBagConstraints(); |
|
101 |
gridBagConstraints.gridx = 0; |
|
102 |
gridBagConstraints.gridy = 1; |
|
103 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
104 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
105 |
northPanel.add(fileRadioButton, gridBagConstraints); |
|
106 |
gridBagConstraints = new GridBagConstraints(); |
|
107 |
gridBagConstraints.gridx = 0; |
|
108 |
gridBagConstraints.gridy = 2; |
|
109 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
110 |
gridBagConstraints.weightx = 1.0; |
|
111 |
gridBagConstraints.insets = new Insets(2, 20, 2, 2); |
|
112 |
northPanel.add(selectFileText, gridBagConstraints); |
|
113 |
|
|
114 |
add(northPanel, java.awt.BorderLayout.NORTH); |
|
115 |
} |
|
116 |
|
|
117 |
public void itemStateChanged(ItemEvent e) { |
|
118 |
selectFileText.setEnabled(fileRadioButton.isSelected()); |
|
119 |
checkNextButtonEnabled(); |
|
120 |
} |
|
121 |
|
|
122 |
protected File getSelectedFile(){ |
|
123 |
return selectFileText.getSelectedFile(); |
|
124 |
} |
|
125 |
|
|
126 |
protected boolean isStandardSelected(){ |
|
127 |
return standardRadionButton.isSelected(); |
|
128 |
} |
|
129 |
|
|
130 |
protected boolean isNextButtonEnabled(){ |
|
131 |
if (isStandardSelected()){ |
|
132 |
return true; |
|
133 |
} |
|
134 |
File file = selectFileText.getSelectedFile(); |
|
135 |
if (file == null){ |
|
136 |
return false; |
|
137 |
} |
|
138 |
return file.exists(); |
|
139 |
} |
|
140 |
|
|
141 |
protected void checkNextButtonEnabled(){ |
|
142 |
|
|
143 |
} |
|
144 |
|
|
145 |
public void changedUpdate(DocumentEvent e) { |
|
146 |
checkNextButtonEnabled(); |
|
147 |
} |
|
148 |
|
|
149 |
public void insertUpdate(DocumentEvent e) { |
|
150 |
checkNextButtonEnabled(); |
|
151 |
} |
|
152 |
|
|
153 |
public void removeUpdate(DocumentEvent e) { |
|
154 |
checkNextButtonEnabled(); |
|
155 |
} |
|
156 |
|
|
157 |
} |
|
158 |
|
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.PackageInfo; |
|
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.IPackageSelectionListener; |
|
41 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel; |
|
42 |
|
|
43 |
/** |
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
45 |
*/ |
|
46 |
public class SelectPluginsPanel extends JPanel implements IPackageSelectionListener{ |
|
47 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
48 |
private JTabbedPane officialTabbedPane; |
|
49 |
private PluginsTablePanel officialPluginsTablePanel; |
|
50 |
private PluginsTablePanel notOfficialPluginsTablePanel; |
|
51 |
|
|
52 |
public SelectPluginsPanel() { |
|
53 |
super(); |
|
54 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
55 |
initComponents(); |
|
56 |
} |
|
57 |
|
|
58 |
public void updateTableModel(PackagesTableModel officialPluginsTableModel, PackagesTableModel notOfficialTableModel){ |
|
59 |
officialPluginsTablePanel.setTableModel(officialPluginsTableModel); |
|
60 |
notOfficialPluginsTablePanel.setTableModel(notOfficialTableModel); |
|
61 |
} |
|
62 |
|
|
63 |
private void initComponents() { |
|
64 |
GridBagConstraints gridBagConstraints; |
|
65 |
|
|
66 |
officialTabbedPane = new JTabbedPane(); |
|
67 |
notOfficialPluginsTablePanel = new PluginsTablePanel(this); |
|
68 |
officialPluginsTablePanel = new PluginsTablePanel(this); |
|
69 |
|
|
70 |
setLayout(new GridBagLayout()); |
|
71 |
|
|
72 |
officialTabbedPane.addTab("offcial", officialPluginsTablePanel); |
|
73 |
officialTabbedPane.addTab("not_official", notOfficialPluginsTablePanel); |
|
74 |
|
|
75 |
gridBagConstraints = new GridBagConstraints(); |
|
76 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
77 |
gridBagConstraints.weightx = 1.0; |
|
78 |
gridBagConstraints.weighty = 1.0; |
|
79 |
add(officialTabbedPane, gridBagConstraints); |
|
80 |
} |
|
81 |
|
|
82 |
public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){ |
|
83 |
officialPluginsTablePanel.addPackageInfosToInstall(installerInfosToInstall); |
|
84 |
notOfficialPluginsTablePanel.addPackageInfosToInstall(installerInfosToInstall); |
|
85 |
} |
|
86 |
|
|
87 |
public boolean isPackageSelected(){ |
|
88 |
if (notOfficialPluginsTablePanel.isPackageSelected()){ |
|
89 |
return true; |
|
90 |
} |
|
91 |
return officialPluginsTablePanel.isPackageSelected(); |
|
92 |
} |
|
93 |
|
|
94 |
public void checkIfPluginSelected(){ |
|
95 |
|
|
96 |
} |
|
97 |
|
|
98 |
public void packageSelectionchanged(Object value) { |
|
99 |
checkIfPluginSelected(); |
|
100 |
} |
|
101 |
} |
|
102 |
|
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.JPanel; |
|
36 |
import javax.swing.JScrollPane; |
|
37 |
import javax.swing.JTable; |
|
38 |
import javax.swing.JTextArea; |
|
39 |
import javax.swing.event.ListSelectionEvent; |
|
40 |
import javax.swing.event.ListSelectionListener; |
|
41 |
import javax.swing.table.TableColumnModel; |
|
42 |
|
|
43 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
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.PackagesTableCellRenderer; |
|
47 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel; |
|
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(SelectPluginsPanel selectPluginsPanel) { |
|
60 |
super(); |
|
61 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
62 |
initComponents(); |
|
63 |
pluginsTable.getSelectionModel().addListSelectionListener(this); |
|
64 |
pluginsTable.setDefaultRenderer(Boolean.class, new PackagesTableCellRenderer(selectPluginsPanel)); |
|
65 |
pluginsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
|
66 |
} |
|
67 |
|
|
68 |
public void setTableModel(PackagesTableModel pluginsTableModel){ |
|
69 |
pluginsTable.setModel(pluginsTableModel); |
|
70 |
TableColumnModel tableColumnModel = pluginsTable.getColumnModel(); |
|
71 |
tableColumnModel.getColumn(0).setPreferredWidth(25); |
|
72 |
tableColumnModel.getColumn(1).setPreferredWidth(150); |
|
73 |
tableColumnModel.getColumn(2).setPreferredWidth(70); |
|
74 |
tableColumnModel.getColumn(3).setPreferredWidth(75); |
|
75 |
tableColumnModel.getColumn(4).setPreferredWidth(75); |
|
76 |
tableColumnModel.getColumn(5).setPreferredWidth(50); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
public void addPackageInfosToInstall(List<PackageInfo> packageInfosToInstall){ |
|
81 |
((PackagesTableModel)pluginsTable.getModel()).addPackageInfosToInstall(packageInfosToInstall); |
|
82 |
} |
|
83 |
|
|
84 |
public boolean isPackageSelected(){ |
|
85 |
return ((PackagesTableModel)pluginsTable.getModel()).isPackageSelected(); |
|
86 |
} |
|
87 |
|
|
88 |
private void initComponents() { |
|
89 |
java.awt.GridBagConstraints gridBagConstraints; |
|
90 |
|
|
91 |
pluginsScrollPane = new JScrollPane(); |
|
92 |
pluginsTable = new JTable(); |
|
93 |
descriptionScrollPane = new JScrollPane(); |
|
94 |
descriptionTextArea = new JTextArea(); |
|
95 |
|
|
96 |
setLayout(new GridBagLayout()); |
|
97 |
|
|
98 |
pluginsScrollPane.setViewportView(pluginsTable); |
|
99 |
|
|
100 |
gridBagConstraints = new GridBagConstraints(); |
|
101 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
102 |
gridBagConstraints.weightx = 1.0; |
|
103 |
gridBagConstraints.weighty = 0.75; |
|
104 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
105 |
add(pluginsScrollPane, gridBagConstraints); |
|
106 |
|
|
107 |
descriptionTextArea.setEditable(false); |
|
108 |
descriptionTextArea.setColumns(20); |
|
109 |
descriptionTextArea.setRows(5); |
|
110 |
descriptionScrollPane.setViewportView(descriptionTextArea); |
|
111 |
|
|
112 |
gridBagConstraints = new GridBagConstraints(); |
|
113 |
gridBagConstraints.gridx = 0; |
|
114 |
gridBagConstraints.gridy = 1; |
|
115 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
116 |
gridBagConstraints.weightx = 1.0; |
|
117 |
gridBagConstraints.weighty = 0.25; |
|
118 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
119 |
add(descriptionScrollPane, gridBagConstraints); |
|
120 |
} |
|
121 |
|
|
122 |
public void valueChanged(ListSelectionEvent e) { |
|
123 |
int row = pluginsTable.getSelectedRow(); |
|
124 |
if (row != -1){ |
|
125 |
descriptionTextArea.setText(((PackagesTableModel)pluginsTable.getModel()).getDescriptionAt(row)); |
|
126 |
} |
|
127 |
} |
|
128 |
} |
|
129 |
|
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/PackagesTablePanel.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.JPanel; |
|
36 |
import javax.swing.JScrollPane; |
|
37 |
import javax.swing.JTable; |
|
38 |
import javax.swing.JTextArea; |
|
39 |
import javax.swing.event.ListSelectionEvent; |
|
40 |
import javax.swing.event.ListSelectionListener; |
|
41 |
import javax.swing.table.TableColumnModel; |
|
42 |
|
|
43 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
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.PackagesTableCellRenderer; |
|
47 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel; |
|
48 |
|
|
49 |
/** |
|
50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
51 |
*/ |
|
52 |
public class PackagesTablePanel 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 PackagesTablePanel(SelectPackagesPanel selectPluginsPanel) { |
|
60 |
super(); |
|
61 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
62 |
initComponents(); |
|
63 |
pluginsTable.getSelectionModel().addListSelectionListener(this); |
|
64 |
pluginsTable.setDefaultRenderer(Boolean.class, new PackagesTableCellRenderer(selectPluginsPanel)); |
|
65 |
pluginsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
|
66 |
} |
|
67 |
|
|
68 |
public void setTableModel(PackagesTableModel pluginsTableModel){ |
|
69 |
pluginsTable.setModel(pluginsTableModel); |
|
70 |
TableColumnModel tableColumnModel = pluginsTable.getColumnModel(); |
|
71 |
tableColumnModel.getColumn(0).setPreferredWidth(25); |
|
72 |
tableColumnModel.getColumn(1).setPreferredWidth(150); |
|
73 |
tableColumnModel.getColumn(2).setPreferredWidth(70); |
|
74 |
tableColumnModel.getColumn(3).setPreferredWidth(75); |
|
75 |
tableColumnModel.getColumn(4).setPreferredWidth(75); |
|
76 |
tableColumnModel.getColumn(5).setPreferredWidth(50); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
public void addPackageInfosToInstall(List<PackageInfo> packageInfosToInstall){ |
|
81 |
((PackagesTableModel)pluginsTable.getModel()).addPackageInfosToInstall(packageInfosToInstall); |
|
82 |
} |
|
83 |
|
|
84 |
public boolean isPackageSelected(){ |
|
85 |
return ((PackagesTableModel)pluginsTable.getModel()).isPackageSelected(); |
|
86 |
} |
|
87 |
|
|
88 |
private void initComponents() { |
|
89 |
java.awt.GridBagConstraints gridBagConstraints; |
|
90 |
|
|
91 |
pluginsScrollPane = new JScrollPane(); |
|
92 |
pluginsTable = new JTable(); |
|
93 |
descriptionScrollPane = new JScrollPane(); |
|
94 |
descriptionTextArea = new JTextArea(); |
|
95 |
|
|
96 |
setLayout(new GridBagLayout()); |
|
97 |
|
|
98 |
pluginsScrollPane.setViewportView(pluginsTable); |
|
99 |
|
|
100 |
gridBagConstraints = new GridBagConstraints(); |
|
101 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
102 |
gridBagConstraints.weightx = 1.0; |
|
103 |
gridBagConstraints.weighty = 0.75; |
|
104 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
105 |
add(pluginsScrollPane, gridBagConstraints); |
|
106 |
|
|
107 |
descriptionTextArea.setEditable(false); |
|
108 |
descriptionTextArea.setColumns(20); |
|
109 |
descriptionTextArea.setRows(5); |
|
110 |
descriptionScrollPane.setViewportView(descriptionTextArea); |
|
111 |
|
|
112 |
gridBagConstraints = new GridBagConstraints(); |
|
113 |
gridBagConstraints.gridx = 0; |
|
114 |
gridBagConstraints.gridy = 1; |
|
115 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
116 |
gridBagConstraints.weightx = 1.0; |
|
117 |
gridBagConstraints.weighty = 0.25; |
|
118 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
119 |
add(descriptionScrollPane, gridBagConstraints); |
|
120 |
} |
|
121 |
|
|
122 |
public void valueChanged(ListSelectionEvent e) { |
|
123 |
int row = pluginsTable.getSelectedRow(); |
|
124 |
if (row != -1){ |
|
125 |
descriptionTextArea.setText(((PackagesTableModel)pluginsTable.getModel()).getDescriptionAt(row)); |
|
126 |
} |
|
127 |
} |
|
128 |
} |
|
129 |
|
|
0 | 130 |
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/SelectBundlesPanel.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 |
import javax.swing.event.DocumentEvent; |
|
43 |
import javax.swing.event.DocumentListener; |
|
44 |
|
|
45 |
import org.gvsig.gui.beans.openfile.FileTextField; |
|
46 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
|
47 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
48 |
|
|
49 |
/** |
|
50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
51 |
*/ |
|
52 |
public class SelectBundlesPanel extends JPanel implements ItemListener, DocumentListener{ |
|
53 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
54 |
private JRadioButton fileRadioButton; |
|
55 |
private ButtonGroup buttonGroup; |
|
56 |
private JPanel northPanel; |
|
57 |
private FileTextField selectFileText; |
|
58 |
private JRadioButton standardRadionButton; |
|
59 |
|
|
60 |
public SelectBundlesPanel() { |
|
61 |
super(); |
|
62 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
63 |
initComponents(); |
|
64 |
initListeners(); |
|
65 |
standardRadionButton.setSelected(true); |
|
66 |
} |
|
67 |
|
|
68 |
private void initListeners() { |
|
69 |
standardRadionButton.addItemListener(this); |
|
70 |
fileRadioButton.addItemListener(this); |
|
71 |
Object obj = selectFileText.getComponent(0); |
|
72 |
if ((obj != null) && (obj instanceof JTextField)) { |
|
73 |
((JTextField)obj).getDocument().addDocumentListener(this); |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
private void initComponents() { |
|
78 |
java.awt.GridBagConstraints gridBagConstraints; |
|
79 |
|
|
80 |
northPanel = new JPanel(); |
|
81 |
standardRadionButton = new JRadioButton(); |
|
82 |
fileRadioButton = new JRadioButton(); |
|
83 |
selectFileText = new FileTextField(); |
|
84 |
buttonGroup = new ButtonGroup(); |
|
85 |
|
|
86 |
buttonGroup.add(standardRadionButton); |
|
87 |
buttonGroup.add(fileRadioButton); |
|
88 |
|
|
89 |
setLayout(new BorderLayout()); |
|
90 |
|
|
91 |
northPanel.setLayout(new GridBagLayout()); |
|
92 |
|
|
93 |
standardRadionButton.setText("standard_installation"); |
|
94 |
gridBagConstraints = new GridBagConstraints(); |
|
95 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
96 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
97 |
northPanel.add(standardRadionButton, gridBagConstraints); |
|
98 |
|
|
99 |
fileRadioButton.setText("installation_from_file"); |
|
100 |
gridBagConstraints = new GridBagConstraints(); |
|
101 |
gridBagConstraints.gridx = 0; |
|
102 |
gridBagConstraints.gridy = 1; |
|
103 |
gridBagConstraints.anchor = GridBagConstraints.WEST; |
|
104 |
gridBagConstraints.insets = new Insets(2, 2, 2, 2); |
|
105 |
northPanel.add(fileRadioButton, gridBagConstraints); |
|
106 |
gridBagConstraints = new GridBagConstraints(); |
|
107 |
gridBagConstraints.gridx = 0; |
|
108 |
gridBagConstraints.gridy = 2; |
|
109 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
110 |
gridBagConstraints.weightx = 1.0; |
|
111 |
gridBagConstraints.insets = new Insets(2, 20, 2, 2); |
|
112 |
northPanel.add(selectFileText, gridBagConstraints); |
|
113 |
|
|
114 |
add(northPanel, java.awt.BorderLayout.NORTH); |
|
115 |
} |
|
116 |
|
|
117 |
public void itemStateChanged(ItemEvent e) { |
|
118 |
selectFileText.setEnabled(fileRadioButton.isSelected()); |
|
119 |
checkNextButtonEnabled(); |
|
120 |
} |
|
121 |
|
|
122 |
protected File getSelectedFile(){ |
|
123 |
return selectFileText.getSelectedFile(); |
|
124 |
} |
|
125 |
|
|
126 |
protected boolean isStandardSelected(){ |
|
127 |
return standardRadionButton.isSelected(); |
|
128 |
} |
|
129 |
|
|
130 |
protected boolean isNextButtonEnabled(){ |
|
131 |
if (isStandardSelected()){ |
|
132 |
return true; |
|
133 |
} |
|
134 |
File file = selectFileText.getSelectedFile(); |
|
135 |
if (file == null){ |
|
136 |
return false; |
|
137 |
} |
|
138 |
return file.exists(); |
|
139 |
} |
|
140 |
|
|
141 |
protected void checkNextButtonEnabled(){ |
|
142 |
|
|
143 |
} |
|
144 |
|
|
145 |
public void changedUpdate(DocumentEvent e) { |
|
146 |
checkNextButtonEnabled(); |
|
147 |
} |
|
148 |
|
|
149 |
public void insertUpdate(DocumentEvent e) { |
|
150 |
checkNextButtonEnabled(); |
|
151 |
} |
|
152 |
|
|
153 |
public void removeUpdate(DocumentEvent e) { |
|
154 |
checkNextButtonEnabled(); |
|
155 |
} |
|
156 |
|
|
157 |
} |
|
158 |
|
|
0 | 159 |
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/SelectPackagesPanel.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.PackageInfo; |
|
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.IPackageSelectionListener; |
|
41 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel; |
|
42 |
|
|
43 |
/** |
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
45 |
*/ |
|
46 |
public class SelectPackagesPanel extends JPanel implements IPackageSelectionListener{ |
|
47 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
|
48 |
private JTabbedPane officialTabbedPane; |
|
49 |
private PackagesTablePanel officialPluginsTablePanel; |
|
50 |
private PackagesTablePanel notOfficialPluginsTablePanel; |
|
51 |
|
|
52 |
public SelectPackagesPanel() { |
|
53 |
super(); |
|
54 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
|
55 |
initComponents(); |
|
56 |
} |
|
57 |
|
|
58 |
public void updateTableModel(PackagesTableModel officialPluginsTableModel, PackagesTableModel notOfficialTableModel){ |
|
59 |
officialPluginsTablePanel.setTableModel(officialPluginsTableModel); |
|
60 |
notOfficialPluginsTablePanel.setTableModel(notOfficialTableModel); |
|
61 |
} |
|
62 |
|
|
63 |
private void initComponents() { |
|
64 |
GridBagConstraints gridBagConstraints; |
|
65 |
|
|
66 |
officialTabbedPane = new JTabbedPane(); |
|
67 |
notOfficialPluginsTablePanel = new PackagesTablePanel(this); |
|
68 |
officialPluginsTablePanel = new PackagesTablePanel(this); |
|
69 |
|
|
70 |
setLayout(new GridBagLayout()); |
|
71 |
|
|
72 |
officialTabbedPane.addTab("offcial", officialPluginsTablePanel); |
|
73 |
officialTabbedPane.addTab("not_official", notOfficialPluginsTablePanel); |
|
74 |
|
|
75 |
gridBagConstraints = new GridBagConstraints(); |
|
76 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
77 |
gridBagConstraints.weightx = 1.0; |
|
78 |
gridBagConstraints.weighty = 1.0; |
|
79 |
add(officialTabbedPane, gridBagConstraints); |
|
80 |
} |
|
81 |
|
|
82 |
public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){ |
|
83 |
officialPluginsTablePanel.addPackageInfosToInstall(installerInfosToInstall); |
|
84 |
notOfficialPluginsTablePanel.addPackageInfosToInstall(installerInfosToInstall); |
|
85 |
} |
|
86 |
|
|
87 |
public boolean isPackageSelected(){ |
|
88 |
if (notOfficialPluginsTablePanel.isPackageSelected()){ |
|
89 |
return true; |
|
90 |
} |
|
91 |
return officialPluginsTablePanel.isPackageSelected(); |
|
92 |
} |
|
93 |
|
|
94 |
public void checkIfPluginSelected(){ |
|
95 |
|
|
96 |
} |
|
97 |
|
|
98 |
public void packageSelectionchanged(Object value) { |
|
99 |
checkIfPluginSelected(); |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
0 | 103 |
Also available in: Unified diff