Changeset 12637
- Timestamp:
- 2006-09-01T09:52:58+12:00 (18 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/cdm
- Files:
-
- 3 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. */ -
trunk/gli/src/org/greenstone/gatherer/cdm/Plugin.java
r12635 r12637 85 85 public boolean doesExplodeMetadataDatabases() 86 86 { 87 Plugin base_plugin = CollectionDesignManager.plugin_manager.getPlugin(getName(), false);87 Plugin base_plugin = PluginManager.getPlugin(getName(), false); 88 88 if (base_plugin == null) { 89 89 return false; -
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r12636 r12637 179 179 StringBuffer xml = null; 180 180 if (Gatherer.isGsdlRemote) { 181 // !! TO DO 181 String pluginfo_output = RemoteGreenstoneServer.getScriptOptions("pluginfo.pl", "&plugin=" + plugin); 182 xml = new StringBuffer(pluginfo_output); 182 183 } 183 184 else { … … 735 736 } 736 737 737 /** This class listens for actions upon the add button in the controls, and if detected calls the <i>assignPlugin()</i> method. */ 738 738 739 private class AddListener 739 implements ActionListener { 740 /** 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. 741 * @param event An <strong>ActionEvent</strong> containing information garnered from the control action. 742 */ 743 public void actionPerformed(ActionEvent event) { 744 Object selected_object = plugin_combobox.getSelectedItem(); 745 if(selected_object != null) { 746 // Retrieve the base plugin 747 Plugin base_plugin = getPlugin(selected_object.toString(), true); 748 if (base_plugin == null) { 749 // shouldn't happen 750 return; 751 } 752 753 // Create a new element in the DOM 754 Element element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.PLUGIN_ELEMENT); 755 element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, base_plugin.getName()); 756 Plugin new_plugin = new Plugin(element, base_plugin); 757 element = null; 758 759 // Automatically chain to configuration. This ensures required arguments are filled out. 760 ArgumentConfiguration ac = new ArgumentConfiguration(new_plugin); 761 if(ac.display()) { 762 assignPlugin(new_plugin); 763 plugin_list.setSelectedValue(new_plugin, true); 764 // Since we weren't cancelled, if we are in a low mode, remove the plugin from the available list (except for UnknownPlug 765 if(Configuration.getMode() <= Configuration.SYSTEMS_MODE && !base_plugin.getName().equals(StaticStrings.UNKNOWNPLUG_STR)) { 766 plugin_combobox.removeItem(base_plugin); 767 plugin_combobox.setSelectedIndex(0); 768 } 769 } 770 ac = null; 771 new_plugin = null; 772 base_plugin = null; 773 } 774 } 775 } 740 implements ActionListener 741 { 742 public void actionPerformed(ActionEvent event) 743 { 744 if (plugin_combobox.getSelectedItem() != null) { 745 // This must be done on a new thread for the remote building code 746 new AddPluginTask(plugin_combobox.getSelectedItem().toString()).start(); 747 } 748 } 749 } 750 751 752 private class AddPluginTask 753 extends Thread 754 { 755 private String plugin_name; 756 757 public AddPluginTask(String plugin_name) 758 { 759 this.plugin_name = plugin_name; 760 } 761 762 public void run() 763 { 764 // Retrieve the plugin 765 Plugin plugin = getPlugin(plugin_name, true); 766 if (plugin == null) { 767 System.err.println("Error: getPlugin() returned null."); 768 return; 769 } 770 771 // Create a new element in the DOM 772 Element new_plugin_element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.PLUGIN_ELEMENT); 773 new_plugin_element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, plugin.getName()); 774 Plugin new_plugin = new Plugin(new_plugin_element, plugin); 775 776 ArgumentConfiguration ac = new ArgumentConfiguration(new_plugin); 777 if (ac.display()) { 778 assignPlugin(new_plugin); 779 plugin_list.setSelectedValue(new_plugin, true); 780 781 // Remove the plugin from the available list (unless we're in a high mode, or it's UnknownPlug) 782 if (Configuration.getMode() <= Configuration.SYSTEMS_MODE && !plugin_name.equals(StaticStrings.UNKNOWNPLUG_STR)) { 783 plugin_combobox.removeItem(plugin); 784 plugin_combobox.setSelectedIndex(0); 785 } 786 } 787 } 788 } 789 776 790 777 791 /** Listens for double clicks apon the list and react as if the configure button was pushed. */ … … 1090 1104 } 1091 1105 1092 public void actionPerformed(ActionEvent event) { 1093 1094 if(event.getSource() == add_button) { 1095 // add the selected plugin to the list 1096 Object selected_object = suitable_plugins_combobox.getSelectedItem(); 1097 Plugin base_plugin = getPlugin(selected_object.toString(), true); 1098 if (base_plugin == null) { 1099 // shouldn't happen - we are not allowed custom plugins anymore 1100 setVisible(false); 1101 return; 1102 } 1103 // Create a new element in the DOM 1104 Element element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.PLUGIN_ELEMENT); 1105 element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, base_plugin.getName()); 1106 Plugin new_plugin = new Plugin(element, base_plugin); 1107 assignPlugin(new_plugin); 1108 } // else do nothing 1109 1110 // close the dialog 1106 1107 public void actionPerformed(ActionEvent event) 1108 { 1109 // Close the dialog 1111 1110 setVisible(false); 1112 } 1113 1111 1112 if (event.getSource() == add_button) { 1113 new AddPluginTask(suitable_plugins_combobox.getSelectedItem().toString()).start(); 1114 } 1115 } 1116 } 1117 1118 1119 private class AddPluginTask 1120 extends Thread 1121 { 1122 private String plugin_name; 1123 1124 public AddPluginTask(String plugin_name) 1125 { 1126 this.plugin_name = plugin_name; 1127 } 1128 1129 public void run() 1130 { 1131 // Retrieve the plugin 1132 Plugin plugin = getPlugin(plugin_name, true); 1133 if (plugin == null) { 1134 System.err.println("Error: getPlugin() returned null."); 1135 return; 1136 } 1137 1138 // Create a new element in the DOM 1139 Element new_plugin_element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.PLUGIN_ELEMENT); 1140 new_plugin_element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, plugin.getName()); 1141 Plugin new_plugin = new Plugin(new_plugin_element, plugin); 1142 1143 // Just assign the plugin with no argument configuration 1144 assignPlugin(new_plugin); 1145 } 1114 1146 } 1115 1147
Note:
See TracChangeset
for help on using the changeset viewer.