Changeset 10237
- Timestamp:
- 2005-07-13T11:12:11+12:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ArgumentConfiguration.java
r9642 r10237 129 129 cancel.addActionListener(this); 130 130 ok.addActionListener(this); 131 ok.addActionListener(CollectionDesignManager.all_change_listener); 131 132 132 133 // Layout -
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r10011 r10237 582 582 Dictionary.registerText(instructions, "CDM.ClassifierManager.Instructions"); 583 583 584 584 ClassifierComboboxListener ccl = new ClassifierComboboxListener(); 585 585 classifier = new GComboBox(getAvailable()); 586 586 classifier.setBackgroundNonSelectionColor(Configuration.getColor("coloring.editable_background", false)); … … 630 630 // Listeners 631 631 add.addActionListener(new AddListener()); 632 classifier.addItemListener(ccl); 632 add.addActionListener(CollectionDesignManager.buildcol_change_listener); 633 classifier.addItemListener(ccl); 633 634 configure.addActionListener(new ConfigureListener()); 635 configure.addActionListener(CollectionDesignManager.buildcol_change_listener); 634 636 remove.addActionListener(new RemoveListener()); 637 remove.addActionListener(CollectionDesignManager.buildcol_change_listener); 635 638 classifier_list.addMouseListener(new ClickListener()); 636 639 classifier_list.addListSelectionListener(new ListListener()); 637 640 ccl = null; 638 641 639 642 MoveListener ml = new MoveListener(); 640 643 //move_bottom_button.addActionListener(ml); 641 644 move_down_button.addActionListener(ml); 645 move_down_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 642 646 //move_top_button.addActionListener(ml); 643 647 move_up_button.addActionListener(ml); 648 move_up_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 644 649 645 650 // Layout -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r9640 r10237 50 50 /** This listener listens for any event on any of the components in any of the sub-views, and marks the collection as needing saving if any change occurs. */ 51 51 static public CDMChangeListener change_listener; 52 /** These listeners listen to changes in the Design mode so as to allow incremental building */ 53 static public DesignChangeListener all_change_listener; 54 static public DesignChangeListener buildcol_change_listener; 55 static public DesignChangeListener collect_cfg_change_listener; 52 56 /** A list of classifiers to use at build time. */ 53 57 static public ClassifierManager classifier_manager; … … 78 82 /** The text translation manager. */ 79 83 static public TranslationView translation_view; 84 /** These mark what needs to happen when building a collection where ONLY design options have been changed. 85 The build requirements of the higher numbers must include doing everything from the lower numbers. */ 86 static final public int ALL = 3; 87 static final public int BUILDCOL = 2; 88 static final public int UPDATE_COLLECT_CFG = 1; 89 static final public int NOTHING = 0; 90 static private int rebuildTypeRequired = NOTHING; //Rebuild type required if only design options have changed 91 static protected boolean update_collect_cfg_required = false; 92 80 93 /** Constructor. Loads a certain collection configuration file, which is parsed into a DOM. This model is then registered with the command information managers, each of whom knows how to, and provides controls to, alter certain commands. 81 94 * @param collect_config_file the File representing a collection configuration file either in its text (G2) or xml (G3) form … … 84 97 DebugStream.println("Initializaing CollectionDesignModule."); 85 98 change_listener = new CDMChangeListener(); 99 all_change_listener = new DesignChangeListener(ALL); 100 buildcol_change_listener = new DesignChangeListener(BUILDCOL); 101 collect_cfg_change_listener = new DesignChangeListener(UPDATE_COLLECT_CFG); 86 102 // Parse the collection configuration 87 103 collect_config = new CollectionConfiguration(collect_config_file); … … 199 215 */ 200 216 public void save() { 217 System.err.println("Config file saved. The level of processing needed is: " + CollectionDesignManager.getRebuildTypeRequired()); //debug 201 218 // Release collection as necessary 202 219 String collection_name = Gatherer.c_man.getCollection().getName(); 203 220 boolean collection_released = false; 204 boolean formats_changed = format_manager.formatsChanged(); 205 206 if (formats_changed && Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) { 221 222 if (update_collect_cfg_required && Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) { 207 223 // Release the collection 208 224 LocalLibraryServer.releaseCollection(collection_name); … … 213 229 collect_config.save(); 214 230 215 if (Gatherer.isGsdlRemote) { 216 if (formats_changed && Gatherer.c_man.built()) { 217 // upload etc/collect.cfg to server to reflect changes 218 Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", ""); 219 GathererApplet.upload_url_zip(collection_name, "etc", "", null); 220 } 221 } 222 223 // Readd collection 231 if (update_collect_cfg_required && Gatherer.c_man.built() && Gatherer.isGsdlRemote) { 232 //If the GLI is running as an applet, and Format Features or Cross-Collection Searching have changed, 233 //upload etc/collect.cfg to the server to immediately reflect these changes. 234 Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", ""); 235 GathererApplet.upload_url_zip(collection_name, "etc", "", null); 236 } 237 238 // Read collection 224 239 if (collection_released) { 225 240 // Now re-add collection to server to force format commands to be processed … … 227 242 } 228 243 229 if ( formats_changed) {244 if (update_collect_cfg_required) { 230 245 // Unset formats changed 231 format_manager.setFormatsChanged(false);246 update_collect_cfg_required = false; 232 247 } 233 248 } … … 263 278 } 264 279 265 280 public static int getRebuildTypeRequired() { 281 return rebuildTypeRequired; 282 } 283 public static void resetRebuildTypeRequired() { 284 setRebuildTypeRequired(NOTHING); 285 } 286 public static void setRebuildTypeRequired(int number) { 287 rebuildTypeRequired = number; 288 } 289 290 /** 291 * What exactly does this do? 292 */ 266 293 private class CDMChangeListener 267 294 implements ActionListener, DocumentListener { 268 295 296 /** Gives notification that an event has happened */ 269 297 public void actionPerformed(ActionEvent event) { 270 298 Gatherer.c_man.getCollection().setSaved(false); -
trunk/gli/src/org/greenstone/gatherer/cdm/FormatManager.java
r9440 r10237 64 64 static final private String INVISIBLE_DEFAULT_FORMAT = ""; 65 65 66 /** This flag is set if some change has occured to the format commands. When a collection has been built for previewing, and the greenstone local library server is used, then we have to send commands to remove then add the new collection. */67 private boolean formats_changed = false;68 66 /** The controls used to edit the format commands. */ 69 67 private Control controls = null; … … 106 104 add(root, format, target_node); 107 105 Gatherer.c_man.configurationChanged(); 108 formats_changed = true;109 106 } 110 107 } … … 115 112 controls = null; 116 113 } 117 }118 119 /** Have the formats changed since the last save. */120 public boolean formatsChanged() {121 return formats_changed;122 114 } 123 115 … … 160 152 remove(format); 161 153 Gatherer.c_man.configurationChanged(); 162 formats_changed = true;163 }164 165 /** Set the state of the formats changed flag.166 * @param state the new state as a boolean167 */168 public void setFormatsChanged(boolean state) {169 formats_changed = state;170 154 } 171 155 … … 344 328 // Connect 345 329 add_button.addActionListener(new AddListener()); 330 add_button.addActionListener(CollectionDesignManager.collect_cfg_change_listener); 346 331 insert_button.addActionListener(new InsertListener()); 332 insert_button.addActionListener(CollectionDesignManager.collect_cfg_change_listener); 347 333 remove_button.addActionListener(new RemoveListener()); 334 remove_button.addActionListener(CollectionDesignManager.collect_cfg_change_listener); 348 335 replace_button.addActionListener(new ReplaceListener()); 336 replace_button.addActionListener(CollectionDesignManager.collect_cfg_change_listener); 349 337 enabled_checkbox.addActionListener(new EnabledListener()); 338 enabled_checkbox.addActionListener(CollectionDesignManager.collect_cfg_change_listener); 350 339 feature_combobox.addActionListener(new FeatureListener()); 351 340 part_combobox.addActionListener(new PartListener()); … … 425 414 // This is only necessary if the components have been realized 426 415 if(ready) { 427 formats_changed = false;428 416 model.refresh(); 429 417 feature_model = buildFeatureModel(); -
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r9864 r10237 266 266 browse_listener = null; 267 267 public_checkbox.addActionListener(CollectionDesignManager.change_listener); 268 public_checkbox.addActionListener(CollectionDesignManager.buildcol_change_listener); 268 269 creator_emailfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 270 creator_emailfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); 269 271 description_textarea.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 272 description_textarea.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); 270 273 icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 274 icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); 271 275 maintainer_emailfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 276 maintainer_emailfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); 272 277 name_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 273 278 name_textfield.getDocument().addDocumentListener(new CollectionTitleUpdater()); 279 name_textfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); 274 280 small_icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 281 small_icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); 282 //Note: unfortunately just loading the General Design panel fires the buildcol_change_listener (even if nothing is changed). 275 283 276 284 // Layout -
trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
r10011 r10237 626 626 // Listeners 627 627 add_button.addActionListener(new AddListener()); 628 add_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 628 629 move_down_button.addActionListener(new MoveListener(false)); 630 move_down_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 629 631 move_up_button.addActionListener(new MoveListener(true)); 632 move_up_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 630 633 remove_button.addActionListener(new RemoveListener()); 634 remove_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 631 635 replace_button.addActionListener(new ReplaceListener()); 636 replace_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 632 637 set_default_button.addActionListener(new SetDefaultListener()); 638 set_default_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 633 639 name_textfield.getDocument().addDocumentListener(new NameListener()); 634 640 level_combobox.addItemListener(new LevelListener()); -
trunk/gli/src/org/greenstone/gatherer/cdm/LanguageManager.java
r10011 r10237 351 351 // Set up and connect listeners. 352 352 add_button.addActionListener(new AddListener()); 353 add_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 353 354 move_down_button.addActionListener(new MoveListener(false)); 355 move_down_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 354 356 move_up_button.addActionListener(new MoveListener(true)); 357 move_up_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 355 358 remove_button.addActionListener(new RemoveListener()); 359 remove_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 356 360 language_combobox.addActionListener(new SelectorListener()); 357 361 set_default_button.addActionListener(new SetDefaultListener()); 362 set_default_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 358 363 selected_languages_list.addListSelectionListener(new ListListener()); 359 364 -
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r10079 r10237 794 794 795 795 // Listeners 796 add.addActionListener(new AddListener()); 796 add.addActionListener(new AddListener()); //all_change_listener is listening to the ArgumentConfiguration 797 797 configure.addActionListener(new ConfigureListener()); 798 798 MoveListener ml = new MoveListener(); 799 799 //move_bottom_button.addActionListener(ml); 800 800 move_down_button.addActionListener(ml); 801 move_down_button.addActionListener(CollectionDesignManager.all_change_listener); 801 802 //move_top_button.addActionListener(ml); 802 803 move_up_button.addActionListener(ml); 804 move_up_button.addActionListener(CollectionDesignManager.all_change_listener); 803 805 plugin.addItemListener(picl); 804 806 remove.addActionListener(new RemoveListener()); 807 remove.addActionListener(CollectionDesignManager.all_change_listener); 805 808 plugin_list.addMouseListener(new ClickListener()); 806 809 plugin_list.addListSelectionListener(new ListListener()); -
trunk/gli/src/org/greenstone/gatherer/cdm/SearchTypeManager.java
r10011 r10237 268 268 // Connection 269 269 add_button.addActionListener(new AddActionListener()); 270 add_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 270 271 build_type_combobox.addActionListener(new BuildTypeActionListener()); 272 build_type_combobox.addActionListener(CollectionDesignManager.buildcol_change_listener); 271 273 current_search_types_list.addListSelectionListener(new CurrentSearchTypesListSelectionListener()); 272 274 enable_advanced_searches_checkbox.addActionListener(new EnableAdvancedSearchesActionListener()); 275 enable_advanced_searches_checkbox.addActionListener(CollectionDesignManager.buildcol_change_listener); 273 276 move_up_button.addActionListener(new MoveListener(true)); 277 move_up_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 274 278 move_down_button.addActionListener(new MoveListener(false)); 279 move_down_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 275 280 remove_button.addActionListener(new RemoveActionListener()); 281 remove_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 276 282 SearchTypesActionDocumentListener stadl = new SearchTypesActionDocumentListener(); 277 283 search_type_combobox.addActionListener(stadl); 284 search_type_combobox.addActionListener(CollectionDesignManager.buildcol_change_listener); 278 285 ((JTextField)search_type_combobox.getEditor().getEditorComponent()).getDocument().addDocumentListener(stadl); 279 286 -
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndexManager.java
r10011 r10237 314 314 // Listeners 315 315 add_button.addActionListener(new AddListener()); 316 add_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 316 317 move_down_button.addActionListener(new MoveListener(false)); 318 move_down_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 317 319 move_up_button.addActionListener(new MoveListener(true)); 320 move_up_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 318 321 remove_button.addActionListener(new RemoveListener()); 322 remove_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 319 323 replace_button.addActionListener(new ReplaceListener()); 324 replace_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 320 325 set_default_button.addActionListener(new SetDefaultListener()); 326 set_default_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 321 327 subcollection_index_name_textfield.getDocument().addDocumentListener(new NameListener()); 322 328 subcollection_index_list.addListSelectionListener(new SubcollectionIndexListListener()); -
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionManager.java
r9161 r10237 277 277 SubCollectionChangeListener cl = new SubCollectionChangeListener(); 278 278 add_button.addActionListener(new AddSubCollectionListener()); 279 add_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 279 280 remove_button.addActionListener(new RemoveSubCollectionListener()); 281 remove_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 280 282 update_button.addActionListener(new UpdateSubCollectionListener()); 283 update_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 281 284 exclude_button.addActionListener(cl); 282 285 include_button.addActionListener(cl); -
trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollectionManager.java
r9045 r10237 53 53 private DOMProxyListModel model = null; 54 54 private String current_coll_name = null; 55 55 private boolean superCollectionChanged = false; 56 56 57 57 public SuperCollectionManager(Element supercollections_element) { … … 157 157 158 158 public void loseFocus() { 159 CollectionDesignManager.collect_cfg_change_listener.maybeSetRebuildRequired(); // !! TO DO: This is crap 159 160 int super_collections_count = 0; 160 161 // Retrieve the current supercollections -
trunk/gli/src/org/greenstone/gatherer/cdm/TranslationView.java
r8243 r10237 270 270 // Connection 271 271 add_button.addActionListener(new AddListener()); 272 add_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 272 273 remove_button.addActionListener(new RemoveListener()); 274 remove_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 273 275 replace_button.addActionListener(new ReplaceListener()); 276 replace_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 274 277 language_combobox.addActionListener(new LanguageActionListener()); 275 278 translation_area.getDocument().addDocumentListener(new TranslationDocumentListener()); -
trunk/gli/src/org/greenstone/gatherer/collection/Collection.java
r10006 r10237 68 68 private boolean saved = false; 69 69 /*<i>true</i> if the currently loaded collection has had files added since its last build */ 70 private boolean filesChanged = true;70 private boolean filesChanged = false; 71 71 /*<i>true</i> if the currently loaded collection has had metadata added since its last build */ 72 private boolean metadataChanged = true;72 private boolean metadataChanged = false; 73 73 /** The document around which this collection class is based. */ 74 74 private Document document; -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r10232 r10237 133 133 * @see org.greenstone.gatherer.util.Utility 134 134 */ 135 p rivatevoid buildCollection() {135 public void buildCollection() { 136 136 DebugStream.println("CollectionManager.buildCollection()"); 137 137 building = true; … … 669 669 command_parts_list.add(collection.getName()); 670 670 671 // Run the buildcol.pl command671 // Run the import.pl command 672 672 String[] command_parts = (String[]) command_parts_list.toArray(new String[0]); 673 673 GShell shell = new GShell(command_parts, GShell.IMPORT, BUILDING, this, import_monitor, GShell.GSHELL_IMPORT); … … 992 992 collection_built_warning_dialog.dispose(); 993 993 collection_built_warning_dialog = null; 994 995 //Set nothing as needing rebuilding, as a build has just finished :-) 996 CollectionDesignManager.resetRebuildTypeRequired(); 994 997 } 995 998 else { -
trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
r9166 r10237 44 44 import javax.swing.text.*; 45 45 import javax.swing.tree.*; 46 import org.greenstone.gatherer.DebugStream; 46 47 import org.greenstone.gatherer.Configuration; 47 48 import org.greenstone.gatherer.Dictionary; 48 49 import org.greenstone.gatherer.Gatherer; 50 import org.greenstone.gatherer.GathererApplet; 49 51 import org.greenstone.gatherer.cdm.SearchTypeManager; 52 import org.greenstone.gatherer.cdm.CollectionDesignManager; 50 53 import org.greenstone.gatherer.collection.Collection; 54 import org.greenstone.gatherer.util.Utility; 51 55 import org.greenstone.gatherer.shell.GBasicProgressMonitor; 52 56 import org.greenstone.gatherer.shell.GBuildProgressMonitor; … … 99 103 private JButton simple_cancel_button; 100 104 private JButton simple_preview_button; 105 /** The radio buttons for chnaging the build type (incremental/full) */ 106 private JRadioButton full_build_radio_button; 107 private JRadioButton incremental_build_radio_button; 108 private JRadioButton sfull_build_radio_button; 109 private JRadioButton sincremental_build_radio_button; 101 110 /** The label displaying the number of documents in this collection. */ 102 111 private JLabel document_count = null; … … 187 196 sinner_panel = new JPanel(); 188 197 198 //Radio buttons 199 incremental_build_radio_button = new JRadioButton(); 200 Dictionary.registerBoth(incremental_build_radio_button, "CreatePane.Incremental_Build", "CreatePane.Incremental_Build_Tooltip"); 201 full_build_radio_button = new JRadioButton(); 202 Dictionary.registerBoth(full_build_radio_button, "CreatePane.Full_Build", "CreatePane.Full_Build_Tooltip"); 203 sincremental_build_radio_button = new JRadioButton(); 204 Dictionary.registerBoth(sincremental_build_radio_button, "CreatePane.Incremental_Build", "CreatePane.Incremental_Build_Tooltip"); 205 sfull_build_radio_button = new JRadioButton(); 206 Dictionary.registerBoth(sfull_build_radio_button, "CreatePane.Full_Build", "CreatePane.Full_Build_Tooltip"); 207 189 208 // Buttons 190 209 BuildButtonListener bbl = new BuildButtonListener(); … … 256 275 int current_mode = Configuration.getMode(); 257 276 277 //Complete/incremental build options panel 278 //For some reason I need to create seperate objects for each mode. Is there a better way?? 279 ButtonGroup build_type_group = new ButtonGroup(); 280 build_type_group.add(incremental_build_radio_button); 281 incremental_build_radio_button.setSelected(true); //Have incremental rebuild on by default 282 build_type_group.add(full_build_radio_button); 283 ButtonGroup sbuild_type_group = new ButtonGroup(); 284 sbuild_type_group.add(sincremental_build_radio_button); 285 sincremental_build_radio_button.setSelected(true); 286 sbuild_type_group.add(sfull_build_radio_button); 287 JPanel build_type_pane = new JPanel(new GridLayout(2,1)); 288 build_type_pane.add(full_build_radio_button); 289 build_type_pane.add(incremental_build_radio_button); 290 JPanel sbuild_type_pane = new JPanel(new GridLayout(2,1)); 291 sbuild_type_pane.add(sfull_build_radio_button); 292 sbuild_type_pane.add(sincremental_build_radio_button); 293 294 295 258 296 // Build control_pane 259 297 JPanel left = new JPanel(); … … 261 299 left.setLayout(new BorderLayout()); 262 300 left.add(tree, BorderLayout.CENTER); 301 left.add(build_type_pane, BorderLayout.SOUTH); 302 //left.add(full_build_radio_button, BorderLayout.SOUTH); 263 303 264 304 right = new JPanel(); … … 274 314 button_pane = new JPanel(); 275 315 button_pane.setBorder(BorderFactory.createEmptyBorder(5,10,10,10)); 276 button_pane.setLayout(new GridLayout(1, 3));316 button_pane.setLayout(new GridLayout(1,4)); 277 317 button_pane.add(build_button); 278 318 button_pane.add(cancel_button); … … 284 324 285 325 // Build progress_pane 286 287 326 JPanel labels_pane = new JPanel(); 288 327 labels_pane.setLayout(new GridLayout(2,1,0,5)); … … 308 347 309 348 // Simple panel 310 sbutton_panel.setBorder(BorderFactory.createEmptyBorder( 0,5,0,0));311 sbutton_panel.setLayout(new GridLayout( 3,1));349 sbutton_panel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0)); 350 sbutton_panel.setLayout(new GridLayout(1,3)); 312 351 sbutton_panel.add(simple_build_button); 313 352 sbutton_panel.add(simple_cancel_button); 314 353 sbutton_panel.add(simple_preview_button); 315 354 316 JPanel simple_bar_area = new JPanel(new GridLayout( 3,1));355 JPanel simple_bar_area = new JPanel(new GridLayout(2,1)); 317 356 simple_bar_area.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); 318 357 simple_bar_area.add(import_monitor.getSharedProgress()); 358 simple_bar_area.add(sbutton_panel); 319 359 320 360 sinner_panel.setBorder(BorderFactory.createEmptyBorder(5,0,5,0)); 321 361 sinner_panel.setLayout(new BorderLayout()); 322 sinner_panel.add(sbutton_panel, BorderLayout.WEST); 362 sinner_panel.add(sbuild_type_pane, BorderLayout.WEST); 363 //sinner_panel.add(full_build_radio_button, BorderLayout.WEST); 323 364 sinner_panel.add(simple_bar_area, BorderLayout.CENTER); 324 365 … … 383 424 tree.clearSelection(); 384 425 tree.setSelectionPath(path); 426 427 //Disable the full/incremental buttons if the collection has not been built. 428 if(Gatherer.c_man.built()) { 429 full_build_radio_button.setEnabled(true); 430 incremental_build_radio_button.setEnabled(true); 431 sfull_build_radio_button.setEnabled(true); 432 sincremental_build_radio_button.setEnabled(true); 433 } 434 else { 435 full_build_radio_button.setEnabled(false); 436 incremental_build_radio_button.setEnabled(false); 437 sfull_build_radio_button.setEnabled(false); 438 sincremental_build_radio_button.setEnabled(false); 439 } 385 440 } 386 441 … … 388 443 public void loseFocus() { 389 444 tree.valueChanged(null); 445 } 446 447 /** 448 * Check to see if doing an incremental build is chosen. 449 * If not, the full rebuild option must be chosen. 450 * @return boolean - true if the collection should be rebuilt incrementally. 451 */ 452 public boolean isIncremental() { 453 boolean incremental = false; 454 455 //This is horrible. What if the mode is changed, and different options are chosen on different modes?? 456 if(Gatherer.c_man.built()) { 457 if(Configuration.getMode() >= THRESHOLD) { 458 incremental = incremental_build_radio_button.isSelected(); 459 } 460 else { 461 incremental = sincremental_build_radio_button.isSelected(); 462 } 463 } 464 else { 465 incremental = false; //The collection has not yet been built 466 } 467 return incremental; 390 468 } 391 469 … … 587 665 private class BuildButtonListener 588 666 implements ActionListener { 589 /** This method causes a call to be made to CollectionManager.importCollection(), which then imports and builds the collection as necessary. 667 /** 668 * This method checks to see what needs to be done for a build, and starts the process off. 669 * A complete build proccess is started by {@link CollectionManager.importCollection()}, which then imports and builds the collection. 670 * However, this doesn't always happen, as sometimes an incremental build will do :-) 590 671 * @param event An <strong>ActionEvent</strong> who, thanks to the power of object oriented programming, we don't give two hoots about. 591 672 * @see org.greenstone.gatherer.Gatherer … … 595 676 */ 596 677 public void actionPerformed(ActionEvent event) { 678 Collection collection = Gatherer.c_man.getCollection(); 679 String collection_name = collection.getName(); 680 if(!collection.getMetadataChanged() && !collection.getFilesChanged() && isIncremental()) { 681 //Only design options have changes, and we want to be smart in the way we handle them. 682 int rebuildTypeRequired = CollectionDesignManager.getRebuildTypeRequired(); 683 684 if(rebuildTypeRequired == CollectionDesignManager.UPDATE_COLLECT_CFG && Gatherer.isGsdlRemote) { 685 //Special case when the GLI is an applet: Upload the collect.cfg to server 686 //This is already handled by CollectionDesignManager.save() 687 DebugStream.println("Just want to upload collect.cfg, but this has already been done"); 688 } 689 else if(rebuildTypeRequired == CollectionDesignManager.BUILDCOL) { 690 //First upload the collect.cfg file 691 Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", ""); 692 GathererApplet.upload_url_zip(collection_name, "etc", "", null); 693 694 //Just run the buildcol command. 695 DebugStream.println("Just want to run buildcol.pl"); 696 prepareForBuild(); 697 Gatherer.c_man.buildCollection(); 698 } 699 else if(rebuildTypeRequired == CollectionDesignManager.ALL) { 700 //Do a usual build. 701 DebugStream.println("Want to do a complete build"); 702 prepareForBuild(); 703 Gatherer.c_man.importCollection(); //This starts the building process. 704 } 705 else { 706 //Nothing at all needs doing. 707 //This is bad HCI. Maybe should disable the build button in this situation? 708 System.err.println("Want to build the collection but nothing needs doing."); 709 } 710 } 711 else { 712 //Do a complete build. 713 prepareForBuild(); 714 Gatherer.c_man.importCollection(); //This starts the building process. 715 } 716 //Re-setting the rebuildTypeRequired is handled by CollectionManager.processComplete(GShellEvent) 717 } 718 719 /** 720 * This does some stuff that is needed before a collection can be built. 721 * For example, buttons are enabled/disabled, and certain flags are set. 722 * This is called from {@link actionPerformed(ActionEvent)} 723 */ 724 private void prepareForBuild() { 597 725 // First we force the build options to be updated if we haven't already. 598 726 tree.valueChanged(null); … … 602 730 options_pane.update(sargument_configuration_panel); 603 731 } 604 732 605 733 // Now go about building. 606 734 build_button.setEnabled(false); 607 735 cancel_button.setEnabled(true); 608 736 preview_button.setEnabled(false); 609 737 610 738 simple_build_button.setEnabled(false); 611 739 simple_cancel_button.setEnabled(true); 612 740 simple_preview_button.setEnabled(false); 613 741 614 742 document = options_pane.createNewLogDocument(); 615 743 log_textarea.setDocument(document); … … 628 756 Gatherer.c_man.getCollection().import_options.setValue("removeold", true, null); 629 757 } 630 // Call CollectionManagers method to build collection.631 Gatherer.c_man.importCollection(); 632 } 633 }758 } 759 } 760 761 634 762 /** This class serves as the listener for actions on the cancel button. */ 635 763 private class CancelButtonListener -
trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
r10208 r10237 41 41 import java.util.ArrayList; 42 42 import java.util.Enumeration; 43 import java.util.regex.*; 43 44 import javax.swing.*; 44 45 import javax.swing.event.*; … … 222 223 protected void runRemote(String[] args, BufferedOutputStream bos) 223 224 { 225 System.err.println("The level of design processing needed is: " + CollectionDesignManager.getRebuildTypeRequired()); //Will add smart design processing 224 226 if(hasSignalledStop()) { return; } 225 227 int error_count = 0; … … 235 237 236 238 //Only upload the parts of the import folder (files/metadata) that has been changed. 237 if(Gatherer.c_man.getCollection().getFilesChanged()) { 239 //Or upload the lot if we are doing a complete rebuild. 240 if(Gatherer.c_man.getCollection().getFilesChanged() || !Gatherer.g_man.create_pane.isIncremental()) { 238 241 // zip up import folder, but exclude metadata 239 242 Utility.zipup(collect_directory_path, col_name, "import", this, "", ".*metadata\\.xml"); … … 246 249 System.err.println("Finished uploading files"); 247 250 } 248 if(Gatherer.c_man.getCollection().getMetadataChanged() ) {251 if(Gatherer.c_man.getCollection().getMetadataChanged() || !Gatherer.g_man.create_pane.isIncremental()) { 249 252 // zip up metadata from import folder 250 253 Utility.zipup(collect_directory_path, col_name, "import", this, ".*metadata\\.xml", ""); … … 311 314 312 315 String cols_concat = null; 313 314 316 String launch = Gatherer.cgiBase + "launch"; 315 317 launch = launch + "?cmd=" + perl_cmd; … … 325 327 continue; 326 328 } 327 328 329 329 330 if(arg.startsWith(StaticStrings.MINUS_CHARACTER)) { 330 331 String name = arg.substring(1); … … 376 377 fireMessage(type, typeAsString(type) + "> " + line, status, bos); 377 378 } 378 //System.err.println("Wants to stop (1)."); //debug --Matthew379 379 } 380 380 stdbr.close(); … … 395 395 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Success"), status, null); 396 396 } 397 398 399 397 } 400 398 // Exception … … 520 518 /** Any threaded class must include this method to allow the thread body to be run. */ 521 519 public void run() { 522 523 520 String col_name = args[args.length-1]; 524 521 … … 623 620 } 624 621 else if(type == CDIMAGE) { 625 626 622 // download exported files from tmp folder (if gsdl server is remote) 627 623 if (Gatherer.isGsdlRemote) { … … 629 625 progress.messageOnProgressBar("Downloading CD-ROM data from server"); 630 626 } 627 628 //Export directory derrived from -cdname argument 629 //This needs to be exactly the same as derrived by exportcol.pl - perhaps it should be passed in as an argument? 630 String cd_dir = "exported_collections"; 631 for(int i=0; i<args.length-1; i++) { 632 if(args[i] == "-cdname") { 633 //Remove all spaces 634 String cdName = args[i+1]; 635 Pattern pattern = Pattern.compile("\\s"); 636 Matcher matcher = pattern.matcher(cdName); 637 cd_dir = "exported_" + matcher.replaceAll(""); 638 } 639 } 640 //DebugStream.println("cd_dir is: " + cd_dir); 631 641 632 642 String tmp_dir = Utility.TMP_DIR; 633 634 // export directory named stored as -cdname argument635 String cd_dir = "exported_collections";636 for (int i=0; i<args.length-1; i++) {637 if (args[i] == "-cddir") {638 cd_dir = args[i+1];639 break;640 }641 }642 643 // String user_cd_dir = cd_dir;644 643 String user_tmp_dir = "/tmp"; 645 String username = System.getProperty("user.name"); 646 if ((username != null) && (username != "")) { 644 645 //String username = System.getProperty("user.name"); 646 //if ((username != null) && (username != "")) { 647 647 // user_cd_dir = username + File.separator + cd_dir; 648 user_tmp_dir = user_tmp_dir + File.separator + username;649 }650 651 String full_local_cd_dir = tmp_dir + cd_dir; 648 //user_tmp_dir = user_tmp_dir + File.separator + username; 649 //} 650 651 String full_local_cd_dir = tmp_dir + cd_dir; //Need to tell user this! 652 652 653 653 Utility.delete(full_local_cd_dir); // remove current cd-rom dir, if it exists … … 661 661 } 662 662 663 //The string needs to start with exportcol.pl> otherwise it won't be displayed in the final dialog 664 String message = "exportcol.pl>\nThese files have been copied from the server to " + full_local_cd_dir + " and are ready to written to CD-ROM"; 665 fireMessage(type, message, status, bos); //Hopefully this works 663 666 System.err.println("Finished download of /tmp ..."); 664 667 } … … 667 670 } 668 671 669 // We're done. 672 // We're done. 670 673 fireProcessComplete(type, status); 671 674 // Close bos … … 738 741 } 739 742 } 743 744 740 745 /** Method for firing a process complete event which is called, no surprise here, when the process ends. 741 746 * @param type An <strong>int</strong> indicating the process type.
Note:
See TracChangeset
for help on using the changeset viewer.