1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package com.mindtree.techworks.insight.gui.preferences;
25
26 import java.awt.Component;
27 import java.awt.GridBagConstraints;
28 import java.awt.GridBagLayout;
29 import java.awt.Insets;
30 import java.awt.event.ActionEvent;
31 import java.awt.event.ActionListener;
32 import java.io.File;
33 import java.net.PasswordAuthentication;
34 import java.net.URL;
35 import java.util.ArrayList;
36 import java.util.Iterator;
37
38 import javax.swing.AbstractListModel;
39 import javax.swing.BorderFactory;
40 import javax.swing.JButton;
41 import javax.swing.JCheckBox;
42 import javax.swing.JFileChooser;
43 import javax.swing.JLabel;
44 import javax.swing.JList;
45 import javax.swing.JPanel;
46 import javax.swing.JPasswordField;
47 import javax.swing.JScrollPane;
48 import javax.swing.JTextField;
49 import javax.swing.ListSelectionModel;
50
51 import com.mindtree.techworks.insight.InsightConstants;
52 import com.mindtree.techworks.insight.download.ftpbrowse.FTPFileFile;
53 import com.mindtree.techworks.insight.download.ftpbrowse.FTPRemoteFileSystemView;
54 import com.mindtree.techworks.insight.gui.widgets.InsightRemoteFileChooser;
55 import com.mindtree.techworks.insight.gui.widgets.StatusBar;
56 import com.mindtree.techworks.insight.preferences.PreferenceManager;
57 import com.mindtree.techworks.insight.preferences.model.Preference;
58 import com.mindtree.techworks.insight.preferences.model.PreferenceAttribute;
59 import com.mindtree.techworks.insight.preferences.model.PreferenceAttributeType;
60 import com.mindtree.techworks.insight.preferences.model.PreferenceInfo;
61
62
63
64
65
66
67
68
69
70
71
72
73
74 public class FTPFilesUIPanel extends AbstractPreferencesUIPanel implements
75 ActionListener {
76
77
78
79
80 private static final long serialVersionUID = 917645181047346050L;
81
82
83
84
85
86 private static final String REQUIRES_AUTHENTICATION = "authentication";
87 private static final String REQUIRES_AUTHENTICATION_NAME = "Requires Authentication";
88 private static final String HOST = "hostname";
89 private static final String HOST_NAME = "Host Name";
90 private static final String PORT = "portno";
91 private static final String PORT_NAME = "Port Number";
92 private static final String HOME_DIR = "homedir";
93 private static final String HOME_DIR_NAME = "Home Dir";
94 private static final String USER = "username";
95 private static final String USER_NAME = "User Name";
96 private static final String PASSWORD = "password";
97 private static final String PASSWORD_NAME = "Password";
98 private static final String URL_PREFIX = "urlId";
99
100
101
102
103
104 private static final String DEFAULT_PORT = "21";
105
106
107
108
109 private static final int NONE = 0;
110 private static final int ADD = 1;
111 private static final int EDIT = 2;
112 private static final int REMOVE = 3;
113
114
115
116
117 private int action = NONE;
118
119
120
121
122 private JList configuredFilesetsList;
123 private JButton addButton;
124 private JButton editButton;
125 private JButton removeButton;
126 private JTextField nameField;
127 private JTextField hostField;
128 private JTextField portField;
129 private JTextField homeDirField;
130 private JList urlList;
131 private JTextField newURLField;
132 private JButton addURLButton;
133 private JButton browseButton;
134 private JButton removeURLButton;
135 private JCheckBox requiresAuthentication;
136 private JTextField userField;
137 private JPasswordField passwordField;
138 private JButton applyChangesButton;
139
140
141
142
143 private GridBagLayout gl;
144 private GridBagConstraints gc;
145
146
147
148
149
150
151 public FTPFilesUIPanel() {
152 }
153
154
155
156
157 private boolean isFileAlreadyExistsInFileSet(URLListModel urlListModel, String filePath){
158 for(int j = 0; j < urlListModel.getSize(); j++){
159 if(((String)(urlListModel.getElementAt(j))).equals(filePath)){
160 StatusBar.getInstance().setDisplayText(0,InsightConstants.getLiteral("FILE_ALREADY_LOADED"), false);
161 return true;
162 }
163 }
164 return false;
165 }
166
167
168
169
170
171 public void actionPerformed(ActionEvent event) {
172 Object source = event.getSource();
173 if (source == this.addButton) {
174 this.action = ADD;
175 this.configuredFilesetsList.removeSelectionInterval(0,this.configuredFilesetsList.getModel().getSize() - 1);
176 setDetailsWidgetsEnable(true);
177 } else if (source == this.editButton) {
178 if (this.configuredFilesetsList.getSelectedIndex() > -1) {
179 this.action = EDIT;
180 PreferenceInfo prefInfo = (PreferenceInfo)this.configuredFilesetsList
181 .getModel().getElementAt(this.configuredFilesetsList
182 .getSelectedIndex());
183 displayFilesetInfoForEdit(PreferenceManager.getInstance().getPreference(prefInfo.getCompleteId()));
184 }
185 } else if (source == this.removeButton) {
186 if (this.configuredFilesetsList.getSelectedIndex() > -1) {
187 this.action = REMOVE;
188 ((FilesetModel)this.configuredFilesetsList.getModel())
189 .removeFileset(this.configuredFilesetsList.getSelectedIndex());
190 setDetailsWidgetsEnable(false);
191 }
192 } else if (source == this.removeURLButton) {
193 if (this.urlList.getSelectedIndex() > -1) {
194 ((URLListModel)this.urlList.getModel())
195 .removeURL(this.urlList.getSelectedIndex());
196 }
197 } else if (source == this.addURLButton) {
198 if (newURLField.getText().trim().length() > 0) {
199 URLListModel urlListModel = (URLListModel)this.urlList.getModel();
200 if(!isFileAlreadyExistsInFileSet(urlListModel,newURLField.getText()))
201 urlListModel.addURL(newURLField.getText());
202 else
203 StatusBar.getInstance().setDisplayText(0, InsightConstants.getLiteral("FILE_ALREADY_LOADED"), false);
204 newURLField.setText("");
205 }
206 } else if (source == browseButton) {
207 if (this.hostField.getText().trim().length() <= 0) {
208 StatusBar.getInstance().setDisplayText(0,InsightConstants.getLiteral("ERROR_HOST_NAME"), false);
209 return;
210 }
211 JFileChooser fileChooser = getRemoteFileChooser();
212 if (fileChooser.showOpenDialog(this.parent) == JFileChooser.APPROVE_OPTION) {
213 File[] chosenFiles = fileChooser.getSelectedFiles();
214 for (int i = 0; i < chosenFiles.length; i++) {
215 FTPFileFile ftpFile = (FTPFileFile) chosenFiles[i];
216 ((URLListModel)this.urlList.getModel()).addURL(ftpFile.getAbsolutePath());
217 URLListModel urlListModel = ((URLListModel)this.urlList.getModel());
218 String filePath = ftpFile.getAbsolutePath();
219 if(!isFileAlreadyExistsInFileSet(urlListModel, filePath))
220 urlListModel.addURL(filePath);
221 else
222 StatusBar.getInstance().setDisplayText(0, InsightConstants.getLiteral("FILE_ALREADY_LOADED"), false);
223 }
224 }
225 } else if (source == this.requiresAuthentication) {
226 if (this.configuredFilesetsList.getSelectedIndex() > -1) {
227 PreferenceInfo prefInfo = (PreferenceInfo)this.configuredFilesetsList.getModel().
228 getElementAt(this.configuredFilesetsList.getSelectedIndex());
229 checkAuthenticationEnable(PreferenceManager.getInstance().getPreference(prefInfo.getCompleteId()));
230 } else {
231 checkAuthenticationEnable(null);
232 }
233 } else if (source == applyChangesButton) {
234 if (this.nameField.getText().trim().length() < InsightConstants.PREFERENCE_NAME_MIN_SIZE) {
235 StatusBar.getInstance().setDisplayText(0,InsightConstants.getLiteral("ERROR_FILESET_NAME") +
236 InsightConstants.PREFERENCE_NAME_MIN_SIZE, false);
237 return;
238 }
239 Preference childPreference = null;
240 switch(this.action) {
241 case ADD:
242 childPreference = new Preference(String.valueOf(new Object().hashCode()), true, true, this.nameField.getText());
243 createAndAddBooleanAttribute(childPreference, REQUIRES_AUTHENTICATION,
244 REQUIRES_AUTHENTICATION_NAME, this.requiresAuthentication);
245 createAndAddTextAttribute(childPreference, HOST, HOST_NAME, this.hostField);
246 createAndAddTextAttribute(childPreference, PORT, PORT_NAME, this.portField);
247 createAndAddTextAttribute(childPreference, HOME_DIR, HOME_DIR_NAME, this.homeDirField);
248 createAndAddTextAttribute(childPreference, USER, USER_NAME, this.userField);
249 createAndAddPasswordAttribute(childPreference, PASSWORD, PASSWORD_NAME, this.passwordField);
250
251 this.preference.addChildPreference(childPreference);
252
253
254 ((FilesetModel)this.configuredFilesetsList.getModel()).addFileset(childPreference);
255
256 break;
257 case EDIT:
258 childPreference = ((FilesetModel)this.configuredFilesetsList.
259 getModel()).getPreference(this.configuredFilesetsList.getSelectedIndex());
260 childPreference.setName(this.nameField.getText());
261 childPreference.getPreferenceAttributeById(REQUIRES_AUTHENTICATION).setValue(this.requiresAuthentication.isSelected() ? TRUE : FALSE);
262 childPreference.getPreferenceAttributeById(USER).setValue(this.userField.getText());
263 childPreference.getPreferenceAttributeById(HOST).setValue(this.hostField.getText());
264 childPreference.getPreferenceAttributeById(PORT).setValue(this.portField.getText());
265 childPreference.getPreferenceAttributeById(HOME_DIR).setValue(this.homeDirField.getText());
266 childPreference.getPreferenceAttributeById(PASSWORD).setValue(new String(this.passwordField.getPassword()));
267 ((FilesetModel)this.configuredFilesetsList.getModel()).listDataUpdated(this.configuredFilesetsList.getSelectedIndex());
268 break;
269 }
270
271 updateURLListToPreference(childPreference);
272 setDetailsWidgetsEnable(false);
273 this.action = NONE;
274 }
275 }
276
277
278
279
280
281
282 protected void initializeDisplay() {
283 this.configuredFilesetsList = new JList(new FilesetModel());
284 this.configuredFilesetsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
285 addComponent(new JLabel(InsightConstants.getLiteral("CONFIGURED_FILESETS")),0,0,0,0,1,1);
286 addComponent(new JScrollPane(configuredFilesetsList),1,0,1,1,1,4);
287 this.addButton = new JButton(InsightConstants.getLiteral("ADD"));
288 this.editButton = new JButton(InsightConstants.getLiteral("EDIT"));
289 this.removeButton = new JButton(InsightConstants.getLiteral("REMOVE"));
290 this.addButton.addActionListener(this);
291 this.editButton.addActionListener(this);
292 this.removeButton.addActionListener(this);
293 addComponent(addButton,2,0,0,0,1,1);
294 addComponent(editButton,2,1,0,0,1,1);
295 addComponent(removeButton,2,2,0,0,1,1);
296
297
298 JPanel filesetDetailsPanel = new JPanel();
299 this.gl = new GridBagLayout();
300 this.gc = new GridBagConstraints();
301 filesetDetailsPanel.setLayout(gl);
302 filesetDetailsPanel.setBorder(BorderFactory.createTitledBorder(InsightConstants.getLiteral("FILESET_DETAILS")));
303 addComponent(filesetDetailsPanel,0,4,1,1,3,1);
304
305 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("NAME")),0,0,0,0,1,1);
306 this.nameField = new JTextField();
307 addComponent(filesetDetailsPanel,nameField,1,0,1,0,4,1);
308 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("HOST")),0,1,0,0,1,1);
309 this.hostField = new JTextField();
310 addComponent(filesetDetailsPanel,hostField,1,1,1,0,2,1);
311 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("PORT")),3,1,0,0,1,1);
312 this.portField = new JTextField();
313 addComponent(filesetDetailsPanel,portField,4,1,1,0,1,1);
314 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("HOME_DIR")),5,1,0,0,1,1);
315 this.homeDirField = new JTextField();
316 addComponent(filesetDetailsPanel,homeDirField,6,1,1,0,1,1);
317 this.requiresAuthentication = new JCheckBox(InsightConstants.getLiteral("REQUIRES_AUTHENTICATION"));
318 this.requiresAuthentication.addActionListener(this);
319 addComponent(filesetDetailsPanel,requiresAuthentication,0,2,1,0,6,1);
320 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("USER")),0,3,0,0,1,1);
321 this.userField = new JTextField();
322 addComponent(filesetDetailsPanel,userField,1,3,1,0,4,1);
323 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("PASSWORD")),5,3,0,0,1,1);
324 this.passwordField = new JPasswordField();
325 addComponent(filesetDetailsPanel,passwordField,6,3,1,0,1,1);
326 this.urlList = new JList(new URLListModel());
327 this.urlList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
328 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("URLS")),0,4,0,0,1,1);
329 addComponent(filesetDetailsPanel,new JScrollPane(urlList),1,4,1,1,4,2);
330 this.removeURLButton = new JButton(InsightConstants.getLiteral("REMOVE"));
331 this.removeURLButton.addActionListener(this);
332 addComponent(filesetDetailsPanel,removeURLButton,5,4,0,0,1,1);
333 addComponent(filesetDetailsPanel,new JLabel(InsightConstants.getLiteral("NEW_URL")),0,6,0,0,1,1);
334 this.newURLField = new JTextField();
335 addComponent(filesetDetailsPanel,newURLField,1,6,1,0,4,1);
336 this.addURLButton = new JButton(InsightConstants.getLiteral("ADD"));
337 this.addURLButton.addActionListener(this);
338 addComponent(filesetDetailsPanel,addURLButton,5,6,0,0,1,1);
339 this.browseButton = new JButton(InsightConstants.getLiteral("BROWSE"));
340 this.browseButton.addActionListener(this);
341 addComponent(filesetDetailsPanel,browseButton,6,6,0,0,1,1);
342 this.applyChangesButton = new JButton(InsightConstants.getLiteral("APPLY_FILESET_CHANGES"));
343 this.applyChangesButton.addActionListener(this);
344 addComponent(filesetDetailsPanel,applyChangesButton,5,7,0,0,2,1);
345
346 setDetailsWidgetsEnable(false);
347 }
348
349
350
351
352
353 protected void setPreferenceValues() {
354
355 updateFilesetListToPreference();
356 }
357
358
359
360
361 private final void updateFilesetListToPreference() {
362 ArrayList oldValues = new ArrayList();
363 Iterator iterator = this.preference.iterateChildPreferenceIds();
364 while(iterator.hasNext()) {
365 oldValues.add(iterator.next());
366 }
367 iterator = oldValues.iterator();
368 while(iterator.hasNext()) {
369 this.preference.removePreference(
370 this.preference.getPreferenceById(
371 (String)iterator.next()));
372 }
373 for (int i = 0; i < this.configuredFilesetsList.getModel().getSize(); i++) {
374 this.preference.addChildPreference(((FilesetModel)this.configuredFilesetsList.getModel()).getPreference(i));
375 }
376 }
377
378
379
380
381
382 private JFileChooser getRemoteFileChooser() {
383 PasswordAuthentication passwordAuthentication = null;
384 JFileChooser fileChooser = null;
385 if (this.requiresAuthentication.isSelected()) {
386 passwordAuthentication = new PasswordAuthentication(this.userField.getText(), this.passwordField.getPassword());
387 }
388 FTPRemoteFileSystemView remoteFileSystemView = null;
389 String port = this.portField.getText().trim();
390 try {
391 if (port.length() > 0) {
392 int portNo = Integer.parseInt(port);
393 remoteFileSystemView = new FTPRemoteFileSystemView(
394 new URL("ftp", this.hostField.getText(), portNo, this.homeDirField.getText()), passwordAuthentication);
395 } else {
396 remoteFileSystemView = new FTPRemoteFileSystemView(
397 new URL("ftp", this.hostField.getText(),""), passwordAuthentication);
398 }
399 fileChooser = new InsightRemoteFileChooser(remoteFileSystemView);
400 } catch (NumberFormatException nfe) {
401 nfe.printStackTrace();
402 StatusBar.getInstance().setDisplayText(0,InsightConstants.getLiteral("ERROR_PORT_NO"), false);
403 return fileChooser;
404 } catch (Exception e) {
405 e.printStackTrace();
406 StatusBar.getInstance().setDisplayText(0,InsightConstants.getLiteral("ERROR_BROWSE_REMOTE") + e.getMessage(), false);
407 return fileChooser;
408 }
409 fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
410 fileChooser.setMultiSelectionEnabled(true);
411 fileChooser.setDialogTitle(InsightConstants.getLiteral("SELECT_FILES"));
412 fileChooser.setApproveButtonText(InsightConstants.getLiteral("SELECT_FILES"));
413 return fileChooser;
414 }
415
416
417
418
419
420 private final void updateURLListToPreference(Preference childPreference) {
421 ArrayList oldValues = new ArrayList();
422 Iterator iterator = childPreference.iteratePreferenceAttributeIds();
423 while(iterator.hasNext()) {
424 String id = (String)iterator.next();
425 if (id.startsWith(URL_PREFIX)) {
426 oldValues.add(id);
427 }
428 }
429 iterator = oldValues.iterator();
430 while(iterator.hasNext()) {
431 childPreference.removePreferenceAttribute(
432 childPreference.getPreferenceAttributeById(
433 (String)iterator.next()));
434 }
435 for (int i = 0; i < this.urlList.getModel().getSize(); i++) {
436 String identifier = (String)this.urlList.getModel().getElementAt(i);
437 PreferenceAttribute newAttribute = new PreferenceAttribute(PreferenceAttributeType.TEXT,
438 URL_PREFIX + i, identifier, false,
439 true, true, childPreference);
440 newAttribute.setName(URL_PREFIX + i);
441 childPreference.addPreferenceAttribute(newAttribute);
442 }
443 }
444
445
446
447
448
449
450 private final void displayFilesetInfoForEdit(Preference filesetInfo) {
451 setDetailsWidgetsEnable(true);
452 this.nameField.setText(filesetInfo.getName());
453 Iterator iterator = filesetInfo.iteratePreferenceAttributeIds();
454 while(iterator.hasNext()) {
455 String id = (String)iterator.next();
456 PreferenceAttribute prefAttribute = filesetInfo.getPreferenceAttributeById(id);
457 if (id.startsWith(URL_PREFIX)) {
458 ((URLListModel)this.urlList.getModel()).addURL(prefAttribute.getValue());
459 } else if (id.equals(REQUIRES_AUTHENTICATION)) {
460 this.requiresAuthentication.setSelected(prefAttribute.getValue().equals(TRUE));
461 } else if (id.equals(HOST)) {
462 this.hostField.setText(prefAttribute.getValue());
463 } else if (id.equals(PORT)) {
464 this.portField.setText(prefAttribute.getValue());
465 } else if (id.equals(HOME_DIR)) {
466 this.homeDirField.setText(prefAttribute.getValue());
467 }
468 }
469 checkAuthenticationEnable(filesetInfo);
470 }
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493 private final void addComponent (JPanel panel, Component c, int gridx,
494 int gridy, int weightx, int weighty, int width, int height) {
495 gc.fill = GridBagConstraints.BOTH;
496 gc.anchor = GridBagConstraints.NORTHWEST;
497 gc.insets = new Insets(5,5,5,5);
498 gc.gridx = gridx;
499 gc.gridy = gridy;
500 gc.weightx = weightx;
501 gc.weighty = weighty;
502 gc.gridwidth = width;
503 gc.gridheight = height;
504 gl.setConstraints( c, gc);
505 panel.add(c);
506 }
507
508
509
510
511
512 private void setDetailsWidgetsEnable(boolean enable) {
513 this.nameField.setText("");
514 this.nameField.setEditable(enable);
515 this.nameField.setEnabled(enable);
516 this.hostField.setText("");
517 this.hostField.setEditable(enable);
518 this.hostField.setEnabled(enable);
519 this.portField.setText(DEFAULT_PORT);
520 this.portField.setEditable(enable);
521 this.portField.setEnabled(enable);
522 this.homeDirField.setText("");
523 this.homeDirField.setEditable(enable);
524 this.homeDirField.setEnabled(enable);
525 ((URLListModel)this.urlList.getModel()).clearAll();
526 this.urlList.setEnabled(enable);
527 this.newURLField.setText("");
528 this.newURLField.setEditable(enable);
529 this.newURLField.setEnabled(enable);
530 this.requiresAuthentication.setEnabled(enable);
531 this.requiresAuthentication.setSelected(false);
532
533 checkAuthenticationEnable(null);
534 this.removeURLButton.setEnabled(enable);
535 this.addURLButton.setEnabled(enable);
536 this.browseButton.setEnabled(enable);
537 this.applyChangesButton.setEnabled(enable);
538 if (enable) {
539 this.nameField.requestFocus();
540 }
541 }
542
543
544
545
546
547
548
549
550 private void checkAuthenticationEnable(Preference filesetInfo) {
551 boolean authenticationEnabled = this.requiresAuthentication.isSelected();
552 this.userField.setEditable(authenticationEnabled);
553 this.passwordField.setEditable(authenticationEnabled);
554 this.userField.setEnabled(authenticationEnabled);
555 this.passwordField.setEnabled(authenticationEnabled);
556 this.userField.setText((authenticationEnabled && filesetInfo != null) ?
557 filesetInfo.getPreferenceAttributeById(USER).getValue() : "");
558 this.passwordField.setText((authenticationEnabled && filesetInfo != null) ?
559 filesetInfo.getPreferenceAttributeById(PASSWORD).getValue() : "");
560 }
561
562
563
564
565 private class FilesetModel extends AbstractListModel {
566
567
568
569
570 private static final long serialVersionUID = 3895409787401891091L;
571
572
573
574
575 private ArrayList configuredFilesets = new ArrayList();
576
577
578
579
580 public FilesetModel() {
581 Iterator iterator = preference.iterateChildPreferences();
582 while(iterator.hasNext()) {
583 Preference filesetPreference = (Preference)iterator.next();
584 configuredFilesets.add(filesetPreference);
585 }
586 }
587
588
589
590
591
592 public void addFileset(Preference filesetInfo) {
593 configuredFilesets.add(filesetInfo);
594 super.fireIntervalAdded(this, configuredFilesets.size() - 1, configuredFilesets.size() - 1);
595 }
596
597
598
599
600
601 public void listDataUpdated(int index) {
602 super.fireContentsChanged(this, index, index);
603 }
604
605
606
607
608
609 public void removeFileset(int index) {
610 if (index < 0 || index >= configuredFilesets.size()) {
611 return;
612 }
613 configuredFilesets.remove(index);
614 super.fireIntervalRemoved(this, index, index);
615 }
616
617
618
619
620
621
622 public int getSize() {
623 return configuredFilesets.size();
624 }
625
626
627
628
629
630
631 public Preference getPreference(int index) {
632 return (Preference)configuredFilesets.get(index);
633 }
634
635
636
637
638
639 public Object getElementAt(int index) {
640 return ((Preference)configuredFilesets.get(index)).getPreferenceInfo();
641 }
642 }
643
644
645
646
647 private class URLListModel extends AbstractListModel {
648
649
650
651
652 private static final long serialVersionUID = 3079808278133329149L;
653
654
655
656
657 private ArrayList configuredURLs = new ArrayList();
658
659
660
661
662 public URLListModel() {
663
664 }
665
666
667
668
669
670 public void addURL(String url) {
671 configuredURLs.add(url);
672 super.fireIntervalAdded(this, configuredURLs.size() - 1, configuredURLs.size() - 1);
673 }
674
675
676
677
678
679 public void removeURL(int index) {
680 if (index < 0 || index >= configuredURLs.size()) {
681 return;
682 }
683 configuredURLs.remove(index);
684 super.fireIntervalRemoved(this, index, index);
685 }
686
687
688
689
690 public void clearAll() {
691 if (configuredURLs.size() > 0) {
692 int lastIndex = configuredURLs.size() - 1;
693 configuredURLs.clear();
694 super.fireIntervalRemoved(this, 0, lastIndex);
695 }
696 }
697
698
699
700
701
702 public int getSize() {
703 return configuredURLs.size();
704 }
705
706
707
708
709
710 public Object getElementAt(int index) {
711 return configuredURLs.get(index);
712 }
713 }
714
715 }