Revision 47823 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.downloader/org.gvsig.downloader.swing/org.gvsig.downloader.swing.impl/src/main/java/org/gvsig/downloader/swing/impl/config/DownloaderConfigPanelImpl.java
DownloaderConfigPanelImpl.java | ||
---|---|---|
5 | 5 |
import java.util.Collections; |
6 | 6 |
import java.util.List; |
7 | 7 |
import javax.swing.AbstractListModel; |
8 |
import javax.swing.DefaultListModel; |
|
8 | 9 |
import javax.swing.ImageIcon; |
9 | 10 |
import javax.swing.JComponent; |
10 | 11 |
import javax.swing.event.ChangeEvent; |
... | ... | |
160 | 161 |
} |
161 | 162 |
|
162 | 163 |
|
163 |
private static class AutenticationTypesListModel extends AbstractListModel<DownloaderAuthenticationFactory> { |
|
164 |
|
|
165 |
private final List<DownloaderAuthenticationFactory> authenticationTypes; |
|
166 |
|
|
167 |
public AutenticationTypesListModel(DownloaderManager downloader) { |
|
168 |
if( downloader == null ) { |
|
169 |
this.authenticationTypes = Collections.EMPTY_LIST; |
|
170 |
} else { |
|
171 |
this.authenticationTypes = new ArrayList<>(downloader.getAuthenticationTypes()); |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 |
@Override |
|
176 |
public int getSize() { |
|
177 |
return this.authenticationTypes.size(); |
|
178 |
} |
|
179 |
|
|
180 |
@Override |
|
181 |
public DownloaderAuthenticationFactory getElementAt(int index) { |
|
182 |
return this.authenticationTypes.get(index); |
|
183 |
} |
|
184 |
} |
|
164 |
// private static class AutenticationTypesListModel extends AbstractListModel<DownloaderAuthenticationFactory> {
|
|
165 |
// |
|
166 |
// private final List<DownloaderAuthenticationFactory> authenticationTypes;
|
|
167 |
// |
|
168 |
// public AutenticationTypesListModel(DownloaderManager downloader) {
|
|
169 |
// if( downloader == null ) {
|
|
170 |
// this.authenticationTypes = Collections.EMPTY_LIST;
|
|
171 |
// } else {
|
|
172 |
// this.authenticationTypes = new ArrayList<>(downloader.getAuthenticationTypes());
|
|
173 |
// }
|
|
174 |
// }
|
|
175 |
// |
|
176 |
// @Override
|
|
177 |
// public int getSize() {
|
|
178 |
// return this.authenticationTypes.size();
|
|
179 |
// }
|
|
180 |
// |
|
181 |
// @Override
|
|
182 |
// public DownloaderAuthenticationFactory getElementAt(int index) {
|
|
183 |
// return this.authenticationTypes.get(index);
|
|
184 |
// }
|
|
185 |
// }
|
|
185 | 186 |
|
186 | 187 |
public DownloaderConfigPanelImpl() { |
187 | 188 |
|
... | ... | |
200 | 201 |
|
201 | 202 |
this.tblAuthenticatedServices.setModel(new AuthenticatedServicesTableModel(downloader)); |
202 | 203 |
this.tblCredentials.setModel(new CredentialsTableModel(downloader)); |
203 |
this.lstAuthenticationTypes.setModel(new AutenticationTypesListModel(downloader)); |
|
204 |
DefaultListModel<DownloaderAuthenticationFactory> authenticationTypesModel = new DefaultListModel<>(); |
|
205 |
for (DownloaderAuthenticationFactory authType : downloader.getAuthenticationTypes()) { |
|
206 |
authenticationTypesModel.addElement(authType); |
|
207 |
} |
|
208 |
this.lstAuthenticationTypes.setModel(authenticationTypesModel); |
|
204 | 209 |
|
205 | 210 |
this.btnAuthenticatedServicesAdd.addActionListener((ActionEvent e) -> { |
206 | 211 |
doAuthenticateServciceAdd(); |
Also available in: Unified diff