Changeset 12091
- Timestamp:
- 2006-07-07T13:10:08+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndexManager.java
r11905 r12091 284 284 JPanel content_pane = new JPanel(); 285 285 286 JLabel name_label = new JLabel();287 Dictionary.registerText(name_label, "CDM.SubcollectionIndexManager.PartitionName");288 subcollection_index_name_textfield = new JTextField();289 subcollection_index_name_textfield.setPreferredSize(FIELD_SIZE);290 Dictionary.registerTooltip(subcollection_index_name_textfield, "CDM.SubcollectionIndexManager.PartitionName_Tooltip");291 292 286 JLabel source_label = new JLabel(); 293 287 Dictionary.registerText(source_label, "CDM.SubcollectionIndexManager.Source"); … … 325 319 set_default_button.addActionListener(new SetDefaultListener()); 326 320 set_default_button.addActionListener(CollectionDesignManager.buildcol_change_listener); 327 subcollection_index_name_textfield.getDocument().addDocumentListener(new NameListener());328 321 subcollection_index_list.addListSelectionListener(new SubcollectionIndexListListener()); 329 322 source_list.addListSelectionListener(new SourceListListener()); … … 344 337 labels_pane.setLayout(new BorderLayout()); 345 338 labels_pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5)); 346 labels_pane.add(name_label, BorderLayout.NORTH);347 339 labels_pane.add(source_label, BorderLayout.CENTER); 348 340 349 341 boxes_pane.setLayout(new BorderLayout()); 350 boxes_pane.add(subcollection_index_name_textfield, BorderLayout.NORTH);351 342 boxes_pane.add(new JScrollPane(source_list), BorderLayout.CENTER); 352 343 … … 409 400 } 410 401 411 // Display the selected subcollection index's name412 String id = selected_index.getID();413 String name = CollectionDesignManager.collectionmeta_manager.getMetadatum("." + id).getValue(true);414 subcollection_index_name_textfield.setText(name);415 416 402 // Display the selected subcollection index's sources 417 403 source_list.clearTicked(); … … 425 411 boolean replace_enabled = false; 426 412 427 // Indexes must have a name428 if (subcollection_index_name_textfield.getText().length() == 0) {429 add_enabled = false;430 }431 413 // Can't add a new index if no sources are selected 432 elseif (source_list.isNothingTicked()) {414 if (source_list.isNothingTicked()) { 433 415 add_enabled = false; 434 416 } … … 444 426 // Here we need to check if we have changed the name - if so, we can enable the replace button 445 427 if (subcollection_index_list.getSelectedIndex() != -1) { 446 String name = subcollection_index_name_textfield.getText();447 428 SubcollectionIndex selected_index = (SubcollectionIndex) subcollection_index_list.getSelectedValue(); 448 String selected_name = CollectionDesignManager.collectionmeta_manager.getMetadatum("." + selected_index.getID()).getValue(true);449 if (!name.equals(selected_name)) {450 replace_enabled = true;451 }452 429 } 453 430 } … … 473 450 public void actionPerformed(ActionEvent event) 474 451 { 475 String name = subcollection_index_name_textfield.getText(); 476 if (!source_list.isNothingTicked() && name.length() != 0) { 452 if (!source_list.isNothingTicked()) {// && name.length() != 0) { 477 453 ArrayList sources = source_list.getTicked(); 478 454 SubcollectionIndex subcollection_index = new SubcollectionIndex(sources.toArray()); 479 455 480 // Before we add the index to the model, we have to add thecollection metadata for this456 // Before we add the index to the model, we have to add a default collection metadata for this 481 457 CollectionMeta metadatum = new CollectionMeta("." + subcollection_index.getID()); 482 metadatum.setValue( name);458 metadatum.setValue(subcollection_index.getID()); 483 459 CollectionDesignManager.collectionmeta_manager.addMetadatum(metadatum); 484 460
Note:
See TracChangeset
for help on using the changeset viewer.