Revision 32633
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 | ||
---|---|---|
43 | 43 |
import org.gvsig.installer.lib.api.PackageInfo; |
44 | 44 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
45 | 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;
|
|
46 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableCellRenderer;
|
|
47 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel;
|
|
48 | 48 |
|
49 | 49 |
/** |
50 | 50 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
... | ... | |
56 | 56 |
private JScrollPane pluginsScrollPane; |
57 | 57 |
private JTable pluginsTable; |
58 | 58 |
|
59 |
public PluginsTablePanel() { |
|
59 |
public PluginsTablePanel(SelectPluginsPanel selectPluginsPanel) {
|
|
60 | 60 |
super(); |
61 | 61 |
swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager(); |
62 | 62 |
initComponents(); |
63 | 63 |
pluginsTable.getSelectionModel().addListSelectionListener(this); |
64 |
pluginsTable.setDefaultRenderer(Boolean.class, new PluginsTableCellRenderer());
|
|
64 |
pluginsTable.setDefaultRenderer(Boolean.class, new PackagesTableCellRenderer(selectPluginsPanel));
|
|
65 | 65 |
pluginsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
66 | 66 |
} |
67 | 67 |
|
68 |
public void setTableModel(PluginsTableModel pluginsTableModel){
|
|
68 |
public void setTableModel(PackagesTableModel pluginsTableModel){
|
|
69 | 69 |
pluginsTable.setModel(pluginsTableModel); |
70 | 70 |
TableColumnModel tableColumnModel = pluginsTable.getColumnModel(); |
71 | 71 |
tableColumnModel.getColumn(0).setPreferredWidth(25); |
... | ... | |
77 | 77 |
} |
78 | 78 |
|
79 | 79 |
|
80 |
public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){ |
|
81 |
((PluginsTableModel)pluginsTable.getModel()).addInstallersToExecute(installerInfosToInstall); |
|
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(); |
|
82 | 86 |
} |
83 | 87 |
|
84 | 88 |
private void initComponents() { |
... | ... | |
118 | 122 |
public void valueChanged(ListSelectionEvent e) { |
119 | 123 |
int row = pluginsTable.getSelectedRow(); |
120 | 124 |
if (row != -1){ |
121 |
descriptionTextArea.setText(((PluginsTableModel)pluginsTable.getModel()).getDescriptionAt(row)); |
|
122 |
} |
|
123 |
|
|
124 |
} |
|
125 |
descriptionTextArea.setText(((PackagesTableModel)pluginsTable.getModel()).getDescriptionAt(row)); |
|
126 |
} |
|
127 |
} |
|
125 | 128 |
} |
126 | 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/SelectPluginsPanel.java | ||
---|---|---|
37 | 37 |
import org.gvsig.installer.lib.api.PackageInfo; |
38 | 38 |
import org.gvsig.installer.swing.api.SwingInstallerLocator; |
39 | 39 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
40 |
import org.gvsig.installer.swing.impl.execution.model.PluginsTableModel; |
|
40 |
import org.gvsig.installer.swing.impl.execution.model.IPackageSelectionListener; |
|
41 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel; |
|
41 | 42 |
|
42 | 43 |
/** |
43 | 44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
44 | 45 |
*/ |
45 |
public class SelectPluginsPanel extends JPanel{ |
|
46 |
public class SelectPluginsPanel extends JPanel implements IPackageSelectionListener{
|
|
46 | 47 |
protected DefaultSwingInstallerManager swingInstallerManager = null; |
47 | 48 |
private JTabbedPane officialTabbedPane; |
48 | 49 |
private PluginsTablePanel officialPluginsTablePanel; |
... | ... | |
54 | 55 |
initComponents(); |
55 | 56 |
} |
56 | 57 |
|
57 |
public void updateTableModel(PluginsTableModel officialPluginsTableModel, PluginsTableModel notOfficialTableModel){
|
|
58 |
public void updateTableModel(PackagesTableModel officialPluginsTableModel, PackagesTableModel notOfficialTableModel){
|
|
58 | 59 |
officialPluginsTablePanel.setTableModel(officialPluginsTableModel); |
59 | 60 |
notOfficialPluginsTablePanel.setTableModel(notOfficialTableModel); |
60 | 61 |
} |
... | ... | |
63 | 64 |
GridBagConstraints gridBagConstraints; |
64 | 65 |
|
65 | 66 |
officialTabbedPane = new JTabbedPane(); |
66 |
notOfficialPluginsTablePanel = new PluginsTablePanel(); |
|
67 |
officialPluginsTablePanel = new PluginsTablePanel(); |
|
67 |
notOfficialPluginsTablePanel = new PluginsTablePanel(this);
|
|
68 |
officialPluginsTablePanel = new PluginsTablePanel(this);
|
|
68 | 69 |
|
69 | 70 |
setLayout(new GridBagLayout()); |
70 | 71 |
|
... | ... | |
79 | 80 |
} |
80 | 81 |
|
81 | 82 |
public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){ |
82 |
officialPluginsTablePanel.addInstallersToExecute(installerInfosToInstall);
|
|
83 |
notOfficialPluginsTablePanel.addInstallersToExecute(installerInfosToInstall);
|
|
83 |
officialPluginsTablePanel.addPackageInfosToInstall(installerInfosToInstall);
|
|
84 |
notOfficialPluginsTablePanel.addPackageInfosToInstall(installerInfosToInstall);
|
|
84 | 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 |
} |
|
85 | 101 |
} |
86 | 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/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 |
setSelected((value != null && ((Boolean)value).booleanValue())); |
|
47 |
|
|
48 |
return this; |
|
49 |
|
|
50 |
} |
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
} |
|
56 |
|
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.event.TableModelListener; |
|
34 |
import javax.swing.table.TableModel; |
|
35 |
|
|
36 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
37 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
38 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
42 |
*/ |
|
43 |
public class PluginsTableModel implements TableModel{ |
|
44 |
private DefaultSwingInstallerManager swingInstallerManager = null; |
|
45 |
private List<PackageInfo> installerInfos = null; |
|
46 |
private List<Boolean> selected = null; |
|
47 |
|
|
48 |
public PluginsTableModel(DefaultSwingInstallerManager swingInstallerManager, InstallPackageService installerExecutionService, boolean isOfficial) { |
|
49 |
super(); |
|
50 |
this.swingInstallerManager = swingInstallerManager; |
|
51 |
|
|
52 |
installerInfos = new ArrayList<PackageInfo>(); |
|
53 |
selected = new ArrayList<Boolean>(); |
|
54 |
for (int i=0 ; i<installerExecutionService.getPackageCount() ; i++){ |
|
55 |
PackageInfo installerInfo = installerExecutionService.getPackageInfo(i); |
|
56 |
if (installerInfo.isOfficial() == isOfficial){ |
|
57 |
installerInfos.add(installerInfo); |
|
58 |
selected.add(false); |
|
59 |
} |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
63 |
public void addTableModelListener(TableModelListener l) { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
public Class<?> getColumnClass(int columnIndex) { |
|
69 |
switch(columnIndex){ |
|
70 |
case 0: |
|
71 |
return Boolean.class; |
|
72 |
default: |
|
73 |
return String.class; |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
public int getColumnCount() { |
|
78 |
return 6; |
|
79 |
} |
|
80 |
|
|
81 |
public String getColumnName(int columnIndex) { |
|
82 |
switch(columnIndex){ |
|
83 |
case 0: |
|
84 |
return swingInstallerManager.getText(""); |
|
85 |
case 1: |
|
86 |
return swingInstallerManager.getText("name"); |
|
87 |
case 2: |
|
88 |
return swingInstallerManager.getText("type"); |
|
89 |
case 3: |
|
90 |
return swingInstallerManager.getText("status"); |
|
91 |
case 4: |
|
92 |
return swingInstallerManager.getText("version"); |
|
93 |
case 5: |
|
94 |
return swingInstallerManager.getText("build"); |
|
95 |
default: |
|
96 |
return ""; |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
public int getRowCount() { |
|
101 |
return installerInfos.size(); |
|
102 |
} |
|
103 |
|
|
104 |
public Object getValueAt(int rowIndex, int columnIndex) { |
|
105 |
PackageInfo installerInfo = installerInfos.get(rowIndex); |
|
106 |
switch (columnIndex){ |
|
107 |
case 0: |
|
108 |
return selected.get(rowIndex); |
|
109 |
case 1: |
|
110 |
return installerInfo.getName(); |
|
111 |
case 2: |
|
112 |
return installerInfo.getType(); |
|
113 |
case 3: |
|
114 |
return installerInfo.getState(); |
|
115 |
case 4: |
|
116 |
return installerInfo.getVersion(); |
|
117 |
case 5: |
|
118 |
return installerInfo.getBuild(); |
|
119 |
default: |
|
120 |
return ""; |
|
121 |
|
|
122 |
} |
|
123 |
} |
|
124 |
|
|
125 |
public String getDescriptionAt(int rowIndex){ |
|
126 |
return installerInfos.get(rowIndex).getDescription(); |
|
127 |
} |
|
128 |
|
|
129 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
|
130 |
if (columnIndex == 0){ |
|
131 |
return true; |
|
132 |
} |
|
133 |
return false; |
|
134 |
} |
|
135 |
|
|
136 |
public void removeTableModelListener(TableModelListener l) { |
|
137 |
// TODO Auto-generated method stub |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
|
142 |
selected.remove(rowIndex); |
|
143 |
selected.add(rowIndex,(Boolean)aValue); |
|
144 |
} |
|
145 |
|
|
146 |
public void addInstallersToExecute(List<PackageInfo> installerInfosToInstall){ |
|
147 |
for (int i=0 ; i<installerInfos.size() ; i++){ |
|
148 |
if (selected.get(i)){ |
|
149 |
installerInfosToInstall.add(installerInfos.get(i)); |
|
150 |
} |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
|
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/IPackageSelectionListener.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 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
31 |
*/ |
|
32 |
public interface IPackageSelectionListener { |
|
33 |
|
|
34 |
public void packageSelectionchanged(Object value); |
|
35 |
} |
|
36 |
|
|
0 | 37 |
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/PackagesTableModel.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.event.TableModelListener; |
|
34 |
import javax.swing.table.TableModel; |
|
35 |
|
|
36 |
import org.gvsig.installer.lib.api.PackageInfo; |
|
37 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
|
38 |
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodrá</a> |
|
42 |
*/ |
|
43 |
public class PackagesTableModel implements TableModel{ |
|
44 |
private DefaultSwingInstallerManager swingInstallerManager = null; |
|
45 |
private List<PackageInfo> installerInfos = null; |
|
46 |
private List<Boolean> selected = null; |
|
47 |
|
|
48 |
public PackagesTableModel(DefaultSwingInstallerManager swingInstallerManager, InstallPackageService installerExecutionService, boolean isOfficial) { |
|
49 |
super(); |
|
50 |
this.swingInstallerManager = swingInstallerManager; |
|
51 |
|
|
52 |
installerInfos = new ArrayList<PackageInfo>(); |
|
53 |
selected = new ArrayList<Boolean>(); |
|
54 |
for (int i=0 ; i<installerExecutionService.getPackageCount() ; i++){ |
|
55 |
PackageInfo installerInfo = installerExecutionService.getPackageInfo(i); |
|
56 |
if (installerInfo.isOfficial() == isOfficial){ |
|
57 |
installerInfos.add(installerInfo); |
|
58 |
selected.add(false); |
|
59 |
} |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
63 |
public void addTableModelListener(TableModelListener l) { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
public Class<?> getColumnClass(int columnIndex) { |
|
69 |
switch(columnIndex){ |
|
70 |
case 0: |
|
71 |
return Boolean.class; |
|
72 |
default: |
|
73 |
return String.class; |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
public int getColumnCount() { |
|
78 |
return 6; |
|
79 |
} |
|
80 |
|
|
81 |
public String getColumnName(int columnIndex) { |
|
82 |
switch(columnIndex){ |
|
83 |
case 0: |
|
84 |
return swingInstallerManager.getText(""); |
|
85 |
case 1: |
|
86 |
return swingInstallerManager.getText("name"); |
|
87 |
case 2: |
|
88 |
return swingInstallerManager.getText("type"); |
|
89 |
case 3: |
|
90 |
return swingInstallerManager.getText("status"); |
|
91 |
case 4: |
|
92 |
return swingInstallerManager.getText("version"); |
|
93 |
case 5: |
|
94 |
return swingInstallerManager.getText("build"); |
|
95 |
default: |
|
96 |
return ""; |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
public int getRowCount() { |
|
101 |
return installerInfos.size(); |
|
102 |
} |
|
103 |
|
|
104 |
public Object getValueAt(int rowIndex, int columnIndex) { |
|
105 |
PackageInfo installerInfo = installerInfos.get(rowIndex); |
|
106 |
switch (columnIndex){ |
|
107 |
case 0: |
|
108 |
return selected.get(rowIndex); |
|
109 |
case 1: |
|
110 |
return installerInfo.getName(); |
|
111 |
case 2: |
|
112 |
return installerInfo.getType(); |
|
113 |
case 3: |
|
114 |
return installerInfo.getState(); |
|
115 |
case 4: |
|
116 |
return installerInfo.getVersion(); |
|
117 |
case 5: |
|
118 |
return installerInfo.getBuild(); |
|
119 |
default: |
|
120 |
return ""; |
|
121 |
|
|
122 |
} |
|
123 |
} |
|
124 |
|
|
125 |
public String getDescriptionAt(int rowIndex){ |
|
126 |
return installerInfos.get(rowIndex).getDescription(); |
|
127 |
} |
|
128 |
|
|
129 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
|
130 |
if (columnIndex == 0){ |
|
131 |
return true; |
|
132 |
} |
|
133 |
return false; |
|
134 |
} |
|
135 |
|
|
136 |
public void removeTableModelListener(TableModelListener l) { |
|
137 |
// TODO Auto-generated method stub |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
|
142 |
selected.remove(rowIndex); |
|
143 |
selected.add(rowIndex,(Boolean)aValue); |
|
144 |
} |
|
145 |
|
|
146 |
public void addPackageInfosToInstall(List<PackageInfo> packageInfosToInstall){ |
|
147 |
for (int i=0 ; i<installerInfos.size() ; i++){ |
|
148 |
if (selected.get(i)){ |
|
149 |
packageInfosToInstall.add(installerInfos.get(i)); |
|
150 |
} |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
public boolean isPackageSelected(){ |
|
155 |
for (int i=0 ; i<installerInfos.size() ; i++){ |
|
156 |
if (selected.get(i)){ |
|
157 |
return true; |
|
158 |
} |
|
159 |
} |
|
160 |
return false; |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
0 | 164 |
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/PackagesTableCellRenderer.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 PackagesTableCellRenderer extends JCheckBox implements TableCellRenderer{ |
|
41 |
protected JCheckBox check = new JCheckBox(); |
|
42 |
private IPackageSelectionListener packagesSelectionListener = null; |
|
43 |
|
|
44 |
|
|
45 |
public PackagesTableCellRenderer( |
|
46 |
IPackageSelectionListener packagesSelectionListener) { |
|
47 |
super(); |
|
48 |
this.packagesSelectionListener = packagesSelectionListener; |
|
49 |
} |
|
50 |
|
|
51 |
public Component getTableCellRendererComponent(JTable table, Object value, |
|
52 |
boolean isSelected, boolean hasFocus, int row, int column) { |
|
53 |
|
|
54 |
setSelected((value != null && ((Boolean)value).booleanValue())); |
|
55 |
|
|
56 |
packagesSelectionListener.packageSelectionchanged(value); |
|
57 |
return this; |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
0 | 61 |
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 | ||
---|---|---|
95 | 95 |
if (installerExecutionWizard != null){ |
96 | 96 |
installerExecutionWizard.setNextButtonEnabled(isNextButtonEnabled()); |
97 | 97 |
} |
98 |
} |
|
98 |
} |
|
99 |
|
|
100 |
|
|
99 | 101 |
} |
100 | 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 | ||
---|---|---|
32 | 32 |
import org.gvsig.installer.lib.api.execution.InstallPackageService; |
33 | 33 |
import org.gvsig.installer.swing.impl.InstallerWizardPanel; |
34 | 34 |
import org.gvsig.installer.swing.impl.execution.DefaultInstallPackageWizard; |
35 |
import org.gvsig.installer.swing.impl.execution.model.PluginsTableModel;
|
|
35 |
import org.gvsig.installer.swing.impl.execution.model.PackagesTableModel;
|
|
36 | 36 |
import org.gvsig.installer.swing.impl.execution.panel.SelectPluginsPanel; |
37 | 37 |
|
38 | 38 |
/** |
... | ... | |
67 | 67 |
public void updatePanel() { |
68 | 68 |
InstallPackageService installerExecutionService = |
69 | 69 |
installerExecutionWizard.getInstallerExecutionService(); |
70 |
PluginsTableModel officialPluginsTableModel = new PluginsTableModel(swingInstallerManager,
|
|
70 |
PackagesTableModel officialPluginsTableModel = new PackagesTableModel(swingInstallerManager,
|
|
71 | 71 |
installerExecutionService, true); |
72 |
PluginsTableModel notOfficialPluginsTableModel = new PluginsTableModel(swingInstallerManager,
|
|
72 |
PackagesTableModel notOfficialPluginsTableModel = new PackagesTableModel(swingInstallerManager,
|
|
73 | 73 |
installerExecutionService, false); |
74 |
updateTableModel(officialPluginsTableModel, notOfficialPluginsTableModel); |
|
75 |
|
|
74 |
updateTableModel(officialPluginsTableModel, notOfficialPluginsTableModel);
|
|
75 |
checkIfPluginSelected(); |
|
76 | 76 |
} |
77 |
|
|
78 |
@Override |
|
79 |
public void checkIfPluginSelected() { |
|
80 |
installerExecutionWizard.setNextButtonEnabled(isPackageSelected()); |
|
81 |
} |
|
82 |
|
|
83 |
|
|
77 | 84 |
} |
78 | 85 |
|
Also available in: Unified diff