svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / execution / panel / SelectPackagesPanel.java @ 40560
History | View | Annotate | Download (4.11 KB)
1 | 40560 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40560 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 40435 | jjdelcerro | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40560 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | 40560 | jjdelcerro | *
|
11 | 40435 | jjdelcerro | * 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 | 40560 | jjdelcerro | *
|
16 | 40435 | jjdelcerro | * 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 | 40560 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 40435 | jjdelcerro | * MA 02110-1301, USA.
|
20 | 40560 | jjdelcerro | *
|
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | /*
|
||
25 | * AUTHORS (In addition to CIT):
|
||
26 | * 2010 {Prodevelop} {Task}
|
||
27 | */
|
||
28 | |||
29 | package org.gvsig.installer.swing.impl.execution.panel; |
||
30 | |||
31 | import java.awt.BorderLayout; |
||
32 | import java.util.ArrayList; |
||
33 | import java.util.List; |
||
34 | |||
35 | import javax.swing.JPanel; |
||
36 | |||
37 | import org.gvsig.installer.lib.api.PackageInfo; |
||
38 | import org.gvsig.installer.lib.api.execution.InstallPackageService; |
||
39 | import org.gvsig.installer.swing.api.SwingInstallerLocator; |
||
40 | import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
||
41 | import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
||
42 | import org.gvsig.installer.swing.impl.execution.panel.model.PackagesTableModel; |
||
43 | import org.gvsig.installer.swing.impl.execution.wizard.SelectPackagesWizard; |
||
44 | |||
45 | /**
|
||
46 | * @author gvSIG Team
|
||
47 | * @version $Id$
|
||
48 | */
|
||
49 | public class SelectPackagesPanel extends JPanel { |
||
50 | |||
51 | private SelectPackagesWizard wizard;
|
||
52 | private static final long serialVersionUID = -7554097983061858479L; |
||
53 | protected DefaultSwingInstallerManager swingInstallerManager = null; |
||
54 | private PackagesTablePanel packagesTablePanel;
|
||
55 | |||
56 | private PackagesTableModel pluginsTableModel = null; |
||
57 | |||
58 | public SelectPackagesPanel(SelectPackagesWizard selectPackagesWizard) {
|
||
59 | super();
|
||
60 | this.wizard = selectPackagesWizard;
|
||
61 | swingInstallerManager = (DefaultSwingInstallerManager) SwingInstallerLocator |
||
62 | .getSwingInstallerManager(); |
||
63 | initComponents(); |
||
64 | } |
||
65 | |||
66 | public JPanel getJPanel() { |
||
67 | return this; |
||
68 | } |
||
69 | |||
70 | public void updateTableModel(PackagesTableModel pluginsTableModel) { |
||
71 | packagesTablePanel.setTableModel(pluginsTableModel); |
||
72 | add(packagesTablePanel, BorderLayout.CENTER);
|
||
73 | } |
||
74 | |||
75 | public void selectPackages() { |
||
76 | packagesTablePanel.selectPackages(); |
||
77 | } |
||
78 | |||
79 | private void initComponents() { |
||
80 | setLayout(new BorderLayout(0, 0)); |
||
81 | |||
82 | packagesTablePanel = new PackagesTablePanel(this); |
||
83 | add(packagesTablePanel, BorderLayout.CENTER);
|
||
84 | } |
||
85 | |||
86 | public List<PackageInfo> getPackagesToInstall() { |
||
87 | |||
88 | List<PackageInfo> packages = packagesTablePanel.getPackagesToInstall();
|
||
89 | |||
90 | List<PackageInfo> packagesToInstall = new ArrayList<PackageInfo>(); |
||
91 | packagesToInstall.addAll(packages); |
||
92 | return packagesToInstall;
|
||
93 | } |
||
94 | |||
95 | public boolean isPackageSelected() { |
||
96 | return packagesTablePanel.isPackageSelected();
|
||
97 | } |
||
98 | |||
99 | public void checkIfPluginSelected() { |
||
100 | wizard.checkIfPluginSelected(); |
||
101 | } |
||
102 | |||
103 | public void packageSelectionChanged(Object value, int row, int column) { |
||
104 | } |
||
105 | |||
106 | public void updatePanel() { |
||
107 | |||
108 | InstallPackageService installerExecutionService = wizard |
||
109 | .getDefaultInstallPackageWizard() |
||
110 | .getInstallerExecutionService(); |
||
111 | |||
112 | if (pluginsTableModel == null) { |
||
113 | pluginsTableModel = new PackagesTableModel(swingInstallerManager,
|
||
114 | installerExecutionService, true);
|
||
115 | } |
||
116 | pluginsTableModel.updatePackages(); |
||
117 | |||
118 | updateTableModel(pluginsTableModel); |
||
119 | |||
120 | if (wizard.isDefaultPackagesSelectionSet()) {
|
||
121 | pluginsTableModel.selectDefaultPackages(); |
||
122 | } |
||
123 | |||
124 | |||
125 | |||
126 | |||
127 | |||
128 | } |
||
129 | |||
130 | public DefaultInstallPackageWizard getDefaultInstallPackageWizard() {
|
||
131 | return wizard.getDefaultInstallPackageWizard();
|
||
132 | } |
||
133 | |||
134 | public PackagesTableModel getModel() {
|
||
135 | return this.pluginsTableModel; |
||
136 | } |
||
137 | |||
138 | public void clearPanel() { |
||
139 | packagesTablePanel.clearAllPanels(); |
||
140 | } |
||
141 | |||
142 | /**
|
||
143 | *
|
||
144 | */
|
||
145 | public void setInitialFilter() { |
||
146 | packagesTablePanel.setInitialFilter(); |
||
147 | |||
148 | } |
||
149 | |||
150 | } |