root / 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 @ 38423
History | View | Annotate | Download (4.07 KB)
1 | 37538 | nfrancisco | /* 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 | 37539 | nfrancisco | package org.gvsig.installer.swing.impl.execution.panel; |
29 | 37538 | nfrancisco | |
30 | import java.awt.BorderLayout; |
||
31 | import java.util.ArrayList; |
||
32 | import java.util.List; |
||
33 | |||
34 | import javax.swing.JPanel; |
||
35 | |||
36 | import org.gvsig.installer.lib.api.PackageInfo; |
||
37 | import org.gvsig.installer.lib.api.execution.InstallPackageService; |
||
38 | import org.gvsig.installer.swing.api.SwingInstallerLocator; |
||
39 | import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
||
40 | import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
||
41 | 37541 | nfrancisco | import org.gvsig.installer.swing.impl.execution.panel.model.PackagesTableModel; |
42 | 37539 | nfrancisco | import org.gvsig.installer.swing.impl.execution.wizard.SelectPackagesWizard; |
43 | 37538 | nfrancisco | |
44 | /**
|
||
45 | * @author gvSIG Team
|
||
46 | * @version $Id$
|
||
47 | */
|
||
48 | public class SelectPackagesPanel extends JPanel { |
||
49 | |||
50 | 37584 | nfrancisco | private SelectPackagesWizard wizard;
|
51 | private static final long serialVersionUID = -7554097983061858479L; |
||
52 | protected DefaultSwingInstallerManager swingInstallerManager = null; |
||
53 | private PackagesTablePanel packagesTablePanel;
|
||
54 | 37538 | nfrancisco | |
55 | 37584 | nfrancisco | private PackagesTableModel pluginsTableModel = null; |
56 | 37538 | nfrancisco | |
57 | 37584 | nfrancisco | public SelectPackagesPanel(SelectPackagesWizard selectPackagesWizard) {
|
58 | super();
|
||
59 | this.wizard = selectPackagesWizard;
|
||
60 | swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator |
||
61 | .getSwingInstallerManager(); |
||
62 | initComponents(); |
||
63 | } |
||
64 | 37538 | nfrancisco | |
65 | 37584 | nfrancisco | public JPanel getJPanel() { |
66 | return this; |
||
67 | } |
||
68 | 37538 | nfrancisco | |
69 | 37584 | nfrancisco | public void updateTableModel(PackagesTableModel pluginsTableModel) { |
70 | packagesTablePanel.setTableModel(pluginsTableModel); |
||
71 | add(packagesTablePanel, BorderLayout.CENTER);
|
||
72 | } |
||
73 | 37538 | nfrancisco | |
74 | 37584 | nfrancisco | public void selectPackages() { |
75 | packagesTablePanel.selectPackages(); |
||
76 | } |
||
77 | 37538 | nfrancisco | |
78 | 37584 | nfrancisco | private void initComponents() { |
79 | setLayout(new BorderLayout(0, 0)); |
||
80 | 37538 | nfrancisco | |
81 | 37584 | nfrancisco | packagesTablePanel = new PackagesTablePanel(this); |
82 | add(packagesTablePanel, BorderLayout.CENTER);
|
||
83 | } |
||
84 | 37538 | nfrancisco | |
85 | 37584 | nfrancisco | public List<PackageInfo> getPackagesToInstall() { |
86 | 37538 | nfrancisco | |
87 | 37584 | nfrancisco | List<PackageInfo> packages = packagesTablePanel.getPackagesToInstall();
|
88 | 37538 | nfrancisco | |
89 | 37584 | nfrancisco | List<PackageInfo> packagesToInstall = new ArrayList<PackageInfo>(); |
90 | packagesToInstall.addAll(packages); |
||
91 | return packagesToInstall;
|
||
92 | } |
||
93 | 37538 | nfrancisco | |
94 | 37584 | nfrancisco | public boolean isPackageSelected() { |
95 | return packagesTablePanel.isPackageSelected();
|
||
96 | } |
||
97 | 37538 | nfrancisco | |
98 | 37584 | nfrancisco | public void checkIfPluginSelected() { |
99 | wizard.checkIfPluginSelected(); |
||
100 | } |
||
101 | 37538 | nfrancisco | |
102 | 37584 | nfrancisco | public void packageSelectionChanged(Object value, int row, int column) { |
103 | } |
||
104 | 37538 | nfrancisco | |
105 | 37584 | nfrancisco | public void updatePanel() { |
106 | 37538 | nfrancisco | |
107 | 37584 | nfrancisco | InstallPackageService installerExecutionService = wizard |
108 | .getDefaultInstallPackageWizard() |
||
109 | .getInstallerExecutionService(); |
||
110 | 37538 | nfrancisco | |
111 | 37584 | nfrancisco | if (pluginsTableModel == null) { |
112 | pluginsTableModel = new PackagesTableModel(swingInstallerManager,
|
||
113 | 37822 | nfrancisco | installerExecutionService, true);
|
114 | 37584 | nfrancisco | } |
115 | pluginsTableModel.updatePackages(); |
||
116 | 37538 | nfrancisco | |
117 | 37584 | nfrancisco | updateTableModel(pluginsTableModel); |
118 | 37550 | nfrancisco | |
119 | 37584 | nfrancisco | if (wizard.isDefaultPackagesSelectionSet()) {
|
120 | pluginsTableModel.selectDefaultPackages(); |
||
121 | } |
||
122 | 38423 | jldominguez | |
123 | |||
124 | |||
125 | |||
126 | 37538 | nfrancisco | |
127 | 37584 | nfrancisco | } |
128 | 37550 | nfrancisco | |
129 | 37584 | nfrancisco | public DefaultInstallPackageWizard getDefaultInstallPackageWizard() {
|
130 | return wizard.getDefaultInstallPackageWizard();
|
||
131 | } |
||
132 | 37538 | nfrancisco | |
133 | 37584 | nfrancisco | public PackagesTableModel getModel() {
|
134 | return this.pluginsTableModel; |
||
135 | } |
||
136 | 37550 | nfrancisco | |
137 | 37584 | nfrancisco | public void clearPanel() { |
138 | packagesTablePanel.clearAllPanels(); |
||
139 | } |
||
140 | |||
141 | 38423 | jldominguez | /**
|
142 | *
|
||
143 | */
|
||
144 | public void setInitialFilter() { |
||
145 | packagesTablePanel.setInitialFilter(); |
||
146 | |||
147 | } |
||
148 | |||
149 | 37538 | nfrancisco | } |