- Timestamp:
- 2006-09-01T09:52:58+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r12636 r12637 137 137 StringBuffer xml = null; 138 138 if (Gatherer.isGsdlRemote) { 139 // !! TO DO 139 String classinfo_output = RemoteGreenstoneServer.getScriptOptions("classinfo.pl", "&classifier=" + classifier); 140 xml = new StringBuffer(classinfo_output); 140 141 } 141 142 else { … … 563 564 } 564 565 565 /** This class listens for actions upon the add button in the controls, and if detected calls the assignClassifier() method. 566 */ 566 567 567 private class AddListener 568 implements ActionListener { 569 /** Any implementation of ActionListener must include this method so that we can be informed when an action has occured on one of our target controls, so that we can add the selected Classifier. 570 * @param event An <strong>ActionEvent</strong> containing information garnered from the control action. 571 * @see org.greenstone.gatherer.Gatherer 572 * @see org.greenstone.gatherer.cdm.ArgumentConfiguration 573 * @see org.greenstone.gatherer.cdm.Classifier 574 */ 575 public void actionPerformed(ActionEvent event) { 576 Object selected_object = classifier_combobox.getSelectedItem(); 577 // If there is something in the combobox, but we haven't registered a selection, then add the object and select it! 578 if(selected_object != null) { 579 // Retrieve the base classifier 580 Classifier base_classifier = getClassifier(selected_object.toString(), true); 581 582 // Create a new element in the DOM 583 Element element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.CLASSIFY_ELEMENT); 584 element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, base_classifier.getName()); 585 Classifier new_classifier = new Classifier(element, base_classifier); 586 587 element = null; 588 // Automatically chain to configuration. This ensures required arguments are filled out. 589 ArgumentConfiguration ac = new ArgumentConfiguration(new_classifier); 590 if(ac.display()) { 591 if(!model.contains(new_classifier)) { 592 assignClassifier(new_classifier); 593 classifier_list.setSelectedValue(new_classifier, true); 594 } 595 else { 596 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.ClassifierManager.Classifier_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 597 } 598 } 599 ac = null; 600 new_classifier = null; 601 } 602 } 603 } 568 implements ActionListener 569 { 570 public void actionPerformed(ActionEvent event) 571 { 572 if (classifier_combobox.getSelectedItem() != null) { 573 // This must be done on a new thread for the remote building code 574 new AddClassifierTask(classifier_combobox.getSelectedItem().toString()).start(); 575 } 576 } 577 } 578 579 580 private class AddClassifierTask 581 extends Thread 582 { 583 private String classifier_name; 584 585 public AddClassifierTask(String classifier_name) 586 { 587 this.classifier_name = classifier_name; 588 } 589 590 public void run() 591 { 592 // Retrieve the classifier 593 Classifier classifier = getClassifier(classifier_name, true); 594 if (classifier == null) { 595 System.err.println("Error: getClassifier() returned null."); 596 return; 597 } 598 599 // Create a new element in the DOM 600 Element new_classifier_element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.CLASSIFY_ELEMENT); 601 new_classifier_element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, classifier.getName()); 602 Classifier new_classifier = new Classifier(new_classifier_element, classifier); 603 604 ArgumentConfiguration ac = new ArgumentConfiguration(new_classifier); 605 if (ac.display()) { 606 assignClassifier(new_classifier); 607 classifier_list.setSelectedValue(new_classifier, true); 608 } 609 } 610 } 611 604 612 605 613 /** This listener reacts to changes in the current selection of the classifier combobox. */
Note:
See TracChangeset
for help on using the changeset viewer.