Changeset 36157 for main/trunk
- Timestamp:
- 2022-05-09T12:19:26+12:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/cdm/BaseIndexManager.java
r36150 r36157 105 105 } 106 106 107 pr ivateIndex createIndex(Element elem) {107 protected Index createIndex(Element elem) { 108 108 return (Index)getClassType().create(elem); 109 109 } … … 118 118 * @see org.greenstone.gatherer.collection.CollectionManager 119 119 */ 120 pr ivatevoid addIndex(Index index, CollectionMeta metadatum) {120 protected void addIndex(Index index, CollectionMeta metadatum) { 121 121 ///ystem.err.println("Adding an index: " + index.toString()); 122 122 if(!contains(index)) { … … 190 190 } 191 191 192 pr ivatevoid moveIndex(Index index, boolean move_up)192 protected void moveIndex(Index index, boolean move_up) 193 193 { 194 194 // Determine the current position of the index … … 229 229 * @see org.greenstone.gatherer.collection.CollectionManager 230 230 */ 231 pr ivatevoid removeIndex(Index index) {231 protected void removeIndex(Index index) { 232 232 if(index != null) { 233 233 // Remove any current metadata from this index … … 253 253 /* replace an index in the list. new index may have the same sources but a 254 254 different name, or may be a new index altogether */ 255 pr ivatevoid replaceIndex(Index old_index, Index new_index,255 protected void replaceIndex(Index old_index, Index new_index, 256 256 CollectionMeta coll_meta) { 257 257 if (old_index == null || new_index == null || coll_meta == null) { … … 310 310 } 311 311 312 313 private class IndexControl 312 313 314 protected class IndexControl 314 315 extends JPanel 315 316 implements Control { 316 317 317 pr ivateJList index_list;318 pr ivateJButton move_down_button;319 pr ivateJButton move_up_button;320 pr ivateJButton set_default_button;321 322 pr ivateJButton new_button;323 pr ivateJButton edit_button;324 pr ivateJButton remove_button;325 326 pr ivateboolean has_default = false;318 protected JList index_list; 319 protected JButton move_down_button; 320 protected JButton move_up_button; 321 protected JButton set_default_button; 322 323 protected JButton new_button; 324 protected JButton edit_button; 325 protected JButton remove_button; 326 327 protected boolean has_default = false; 327 328 public IndexControl() { 328 329 super(); … … 412 413 public void gainFocus() {} 413 414 public void destroy() {} 414 415 416 protected NewIndexPrompt createNewIndexPrompt(String build_type, Index index) { 417 return new NewIndexPrompt(build_type, index); 418 419 } 415 420 /** Listens for double clicks apon the list and react as if the configure button was pushed. */ 416 pr ivateclass ClickListener421 protected class ClickListener 417 422 extends MouseAdapter { 418 423 /** Called whenever the mouse is clicked over a registered component, we use this to chain through to the configure prompt. … … 423 428 if(!index_list.isSelectionEmpty()) { 424 429 Index index = (Index) index_list.getSelectedValue(); 425 NewIndexPrompt nip = newNewIndexPrompt(build_type, index);430 NewIndexPrompt nip = createNewIndexPrompt(build_type, index); 426 431 nip.destroy(); 427 432 } … … 431 436 432 437 433 pr ivateclass IndexListListener438 protected class IndexListListener 434 439 implements ListSelectionListener { 435 440 … … 465 470 } 466 471 467 pr ivateclass IndexListRenderer472 protected class IndexListRenderer 468 473 extends DefaultListCellRenderer { 469 474 … … 479 484 } 480 485 481 pr ivateclass NewIndexListener486 protected class NewIndexListener 482 487 implements ActionListener { 483 488 484 489 public void actionPerformed(ActionEvent event) { 485 NewIndexPrompt nip = newNewIndexPrompt(build_type, null);490 NewIndexPrompt nip = createNewIndexPrompt(build_type, null); 486 491 nip.destroy(); 487 492 } 488 493 } 489 494 490 pr ivateclass EditIndexListener495 protected class EditIndexListener 491 496 implements ActionListener { 492 497 493 498 public void actionPerformed(ActionEvent event) { 494 499 Index index = (Index) index_list.getSelectedValue(); 495 NewIndexPrompt nip = newNewIndexPrompt(build_type, index);500 NewIndexPrompt nip = createNewIndexPrompt(build_type, index); 496 501 nip.destroy(); 497 502 } 498 503 } 499 504 500 pr ivateclass RemoveIndexListener505 protected class RemoveIndexListener 501 506 implements ActionListener { 502 507 … … 516 521 } 517 522 518 pr ivateclass MoveListener523 protected class MoveListener 519 524 implements ActionListener { 520 525 521 pr ivateboolean move_up;526 protected boolean move_up; 522 527 523 528 public MoveListener(boolean move_up) { … … 537 542 } 538 543 539 pr ivateclass SetDefaultListener544 protected class SetDefaultListener 540 545 implements ActionListener { 541 546 … … 553 558 554 559 555 pr ivateclass NewIndexPrompt560 protected class NewIndexPrompt 556 561 extends ModalDialog { 557 562 558 563 NewIndexPrompt new_index_prompt = null; 559 564 560 private CheckList source_list; 561 private JButton add_or_replace_button; 562 563 //private JButton select_none_button; 564 //private JButton add_all_button; 565 //private JButton select_all_button; 566 //private JButton replace_button; 567 private JButton cancel_button; 568 569 private boolean editing = false; 565 protected CheckList source_list; 566 protected JButton add_or_replace_button; 567 568 //protected JButton select_none_button; 569 //protected JButton add_all_button; 570 //protected JButton select_all_button; 571 //protected JButton replace_button; 572 protected JButton cancel_button; 573 574 protected JPanel content_pane; 575 protected JPanel details_pane; 576 protected JPanel button_pane; 577 protected boolean editing = false; 570 578 571 579 … … 587 595 setJMenuBar(new SimpleMenuBar("searchindexes")); 588 596 589 JPanelcontent_pane = (JPanel)this.getContentPane();597 content_pane = (JPanel)this.getContentPane(); 590 598 content_pane.setComponentOrientation(Dictionary.getOrientation()); 599 generateContents(build_type, existing_index); 600 601 // Display on screen. 602 Dimension screen_size = Configuration.screen_size; 603 setLocation((screen_size.width - PROMPT_SIZE.width) / 2, (screen_size.height - PROMPT_SIZE.height) / 2); 604 screen_size = null; 605 setVisible(true); 606 607 } 608 609 610 /** Method which actually forces the dialog to be shown on screen. 611 * @return <i>true</i> if the user completed configuration and pressed ok, <i>false</i> otherwise. 612 */ 613 public boolean display() { 614 setVisible(true); 615 return true; 616 // return success; 617 } 618 619 public void destroy() { 620 } 621 622 protected void generateContents(String build_type, Index existing_index) { 591 623 ArrayList new_data = new ArrayList(); 592 624 new_data.addAll(MetadataSetManager.getEveryMetadataSetElement()); 593 625 594 JPaneldetails_pane = new JPanel();626 details_pane = new JPanel(); 595 627 details_pane.setComponentOrientation(Dictionary.getOrientation()); 596 628 … … 602 634 source_list.addListSelectionListener(new SourceListListener()); 603 635 604 JPanelbutton_pane = new JPanel();636 button_pane = new JPanel(); 605 637 button_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 606 638 button_pane.setComponentOrientation(Dictionary.getOrientation()); … … 646 678 content_pane.add(details_pane, BorderLayout.CENTER); 647 679 content_pane.add(button_pane, BorderLayout.SOUTH); 648 649 // Display on screen. 650 Dimension screen_size = Configuration.screen_size; 651 setLocation((screen_size.width - PROMPT_SIZE.width) / 2, (screen_size.height - PROMPT_SIZE.height) / 2); 652 screen_size = null; 653 setVisible(true); 654 655 } 656 657 /** Method which actually forces the dialog to be shown on screen. 658 * @return <i>true</i> if the user completed configuration and pressed ok, <i>false</i> otherwise. 659 */ 660 public boolean display() { 661 setVisible(true); 662 return true; 663 // return success; 664 } 665 666 public void destroy() { 667 } 668 680 681 682 } 669 683 // Checks that specified index not already in the collection 670 pr ivatevoid validateAddOrReplaceButton() {684 protected void validateAddOrReplaceButton() { 671 685 Index index; 672 686 ArrayList sources; … … 690 704 } 691 705 692 pr ivateIndex generateNewIndex() {706 protected Index generateNewIndex() { 693 707 Index index = null; 694 708 ArrayList sources; … … 701 715 } 702 716 703 pr ivateCollectionMeta generateCollectionMeta(Index index) {717 protected CollectionMeta generateCollectionMeta(Index index) { 704 718 CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + index.getID()); 705 719 if (use_macro_as_display_name(index.getID())) { … … 711 725 } 712 726 713 pr ivateclass AddIndexListener727 protected class AddIndexListener 714 728 implements ActionListener 715 729 { … … 729 743 730 744 731 pr ivateclass SourceListListener745 protected class SourceListListener 732 746 implements ListSelectionListener { 733 747 … … 741 755 742 756 743 pr ivateclass ReplaceIndexListener757 protected class ReplaceIndexListener 744 758 implements ActionListener { 745 759 … … 765 779 * @return Whether macro variable should be used. 766 780 */ 767 pr ivateboolean use_macro_as_display_name(String index_id) {781 protected boolean use_macro_as_display_name(String index_id) { 768 782 //String metaname = index_id; 769 783 if (index_id.indexOf(":") != -1) { … … 803 817 * @return Name of the macro variable. 804 818 */ 805 pr ivateString get_macro_name(String index_id) {819 protected String get_macro_name(String index_id) { 806 820 if (index_id.indexOf(":") != -1) { 807 821 index_id = index_id.substring(index_id.indexOf(":") + 1);
Note:
See TracChangeset
for help on using the changeset viewer.