Changeset 8360
- Timestamp:
- 2004-10-18T13:43:20+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r8249 r8360 957 957 } 958 958 959 /** This class listens for actions upon the remove button in the controls, and if detected calls the removeClassifier()method.959 /** This class listens for actions upon the remove button in the controls, and if detected calls the <i>removeClassifier()</i> method. 960 960 */ 961 961 private class RemoveListener 962 962 implements ActionListener { 963 /** Any implementation of <i>ActionListener</i> must include this method so that we can be informed when an action has occured on one of our target controls , so we can remove the selected Classifier.963 /** Any implementation of <i>ActionListener</i> must include this method so that we can be informed when an action has occured on one of our target controls. 964 964 * @param event An <strong>ActionEvent</strong> containing information garnered from the control action. 965 * @see org.greenstone.gatherer.cdm.Classifier966 965 */ 967 966 public void actionPerformed(ActionEvent event) { 968 if(!classifier_list.isSelectionEmpty()) { 969 Object [] objects = classifier_list.getSelectedValues(); 970 for(int i = 0; i < objects.length; i++) { 971 if(objects[i] instanceof Classifier) { 972 removeClassifier((Classifier)objects[i]); 973 } 974 } 975 } 976 } 977 } 978 } 967 if(classifier_list.isSelectionEmpty()) { 968 remove.setEnabled(false); 969 return; 970 } 971 int selected_index = classifier_list.getSelectedIndex(); 972 Object selected_classifier = classifier_list.getSelectedValue(); 973 if (!(selected_classifier instanceof Classifier)) { 974 return; // what else could we have here??? 975 } 976 removeClassifier((Classifier)selected_classifier); 977 978 if (selected_index >= classifier_list.getModel().getSize()) { 979 selected_index--; 980 } 981 if (selected_index >=0) { 982 classifier_list.setSelectedIndex(selected_index); 983 } else { 984 // no more classifiers in the list 985 remove.setEnabled(false); 986 } 987 988 } 989 } 990 } 991 992 993 979 994 }
Note:
See TracChangeset
for help on using the changeset viewer.