Changeset 36157


Ignore:
Timestamp:
2022-05-09T12:19:26+12:00 (5 months ago)
Author:
kjdon
Message:

some changes to help the inheritance along

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/BaseIndexManager.java

    r36150 r36157  
    105105    }
    106106
    107     private Index createIndex(Element elem) {
     107    protected Index createIndex(Element elem) {
    108108    return (Index)getClassType().create(elem);
    109109    }
     
    118118     * @see org.greenstone.gatherer.collection.CollectionManager
    119119     */
    120     private void addIndex(Index index, CollectionMeta metadatum) {
     120    protected void addIndex(Index index, CollectionMeta metadatum) {
    121121    ///ystem.err.println("Adding an index: " + index.toString());
    122122    if(!contains(index)) {
     
    190190    }
    191191
    192     private void moveIndex(Index index, boolean move_up)
     192    protected void moveIndex(Index index, boolean move_up)
    193193    {
    194194    // Determine the current position of the index
     
    229229     * @see org.greenstone.gatherer.collection.CollectionManager
    230230     */
    231     private void removeIndex(Index index) {
     231    protected void removeIndex(Index index) {
    232232    if(index != null) {
    233233        // Remove any current metadata from this index
     
    253253    /* replace an index in the list. new index may have the same sources but a
    254254       different name, or may be a new index altogether */
    255     private void replaceIndex(Index old_index, Index new_index,
     255    protected void replaceIndex(Index old_index, Index new_index,
    256256                  CollectionMeta coll_meta) {
    257257    if (old_index == null || new_index == null || coll_meta == null) {
     
    310310    }
    311311
    312 
    313     private class IndexControl
     312 
     313
     314    protected class IndexControl
    314315    extends JPanel
    315316    implements Control {
    316317
    317     private JList index_list;
    318     private JButton move_down_button;
    319     private JButton move_up_button;
    320     private JButton set_default_button;
    321 
    322     private JButton new_button;
    323     private JButton edit_button;
    324     private JButton remove_button;
    325 
    326     private boolean 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;
    327328    public IndexControl() {
    328329        super();
     
    412413    public void gainFocus() {}
    413414    public void destroy() {}
    414  
     415
     416      protected NewIndexPrompt createNewIndexPrompt(String build_type, Index index) {
     417        return new NewIndexPrompt(build_type, index);
     418       
     419      }
    415420    /** Listens for double clicks apon the list and react as if the configure button was pushed. */
    416     private class ClickListener
     421    protected class ClickListener
    417422        extends MouseAdapter {
    418423        /** Called whenever the mouse is clicked over a registered component, we use this to chain through to the configure prompt.
     
    423428        if(!index_list.isSelectionEmpty()) {
    424429          Index index = (Index) index_list.getSelectedValue();
    425           NewIndexPrompt nip = new NewIndexPrompt(build_type, index);
     430          NewIndexPrompt nip = createNewIndexPrompt(build_type, index);
    426431          nip.destroy();         
    427432        }
     
    431436
    432437 
    433     private class IndexListListener
     438    protected class IndexListListener
    434439        implements ListSelectionListener {
    435440       
     
    465470    }
    466471
    467     private class IndexListRenderer
     472    protected class IndexListRenderer
    468473        extends DefaultListCellRenderer {
    469474
     
    479484    }
    480485
    481     private class NewIndexListener
     486    protected class NewIndexListener
    482487        implements ActionListener {
    483488
    484489        public void actionPerformed(ActionEvent event) {
    485         NewIndexPrompt nip = new NewIndexPrompt(build_type, null);
     490        NewIndexPrompt nip = createNewIndexPrompt(build_type, null);
    486491        nip.destroy();
    487492        }
    488493    }
    489494   
    490     private class EditIndexListener
     495    protected class EditIndexListener
    491496        implements ActionListener {
    492497
    493498        public void actionPerformed(ActionEvent event) {
    494499        Index index = (Index) index_list.getSelectedValue();
    495         NewIndexPrompt nip = new NewIndexPrompt(build_type, index);
     500        NewIndexPrompt nip = createNewIndexPrompt(build_type, index);
    496501        nip.destroy();
    497502        }
    498503    }
    499504
    500     private class RemoveIndexListener
     505    protected class RemoveIndexListener
    501506        implements ActionListener {
    502507       
     
    516521    }
    517522
    518     private class MoveListener
     523    protected class MoveListener
    519524        implements ActionListener {
    520525
    521         private boolean move_up;
     526        protected boolean move_up;
    522527
    523528        public MoveListener(boolean move_up) {
     
    537542    }
    538543
    539     private class SetDefaultListener
     544    protected class SetDefaultListener
    540545        implements ActionListener {
    541546
     
    553558   
    554559
    555     private class NewIndexPrompt
     560    protected class NewIndexPrompt
    556561        extends ModalDialog {
    557562
    558563        NewIndexPrompt new_index_prompt = null;
    559564
    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;
    570578   
    571579       
     
    587595        setJMenuBar(new SimpleMenuBar("searchindexes"));
    588596
    589         JPanel content_pane = (JPanel)this.getContentPane();
     597        content_pane = (JPanel)this.getContentPane();
    590598                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) {
    591623        ArrayList new_data = new ArrayList();
    592624        new_data.addAll(MetadataSetManager.getEveryMetadataSetElement());
    593625
    594         JPanel details_pane = new JPanel();
     626        details_pane = new JPanel();
    595627                details_pane.setComponentOrientation(Dictionary.getOrientation());
    596628       
     
    602634        source_list.addListSelectionListener(new SourceListListener());
    603635
    604         JPanel button_pane = new JPanel();
     636        button_pane = new JPanel();
    605637        button_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    606638        button_pane.setComponentOrientation(Dictionary.getOrientation());
     
    646678        content_pane.add(details_pane, BorderLayout.CENTER);
    647679        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          }
    669683        // Checks that specified index not already in the collection
    670         private void validateAddOrReplaceButton() {
     684        protected void validateAddOrReplaceButton() {
    671685        Index index;
    672686        ArrayList sources;
     
    690704        }
    691705
    692         private Index generateNewIndex() {
     706        protected Index generateNewIndex() {
    693707        Index index = null;
    694708        ArrayList sources;
     
    701715        }
    702716       
    703         private CollectionMeta generateCollectionMeta(Index index) {
     717        protected CollectionMeta generateCollectionMeta(Index index) {
    704718        CollectionMeta metadatum = new CollectionMeta(StaticStrings.STOP_CHARACTER + index.getID());
    705719        if (use_macro_as_display_name(index.getID())) {
     
    711725        }
    712726       
    713         private class AddIndexListener
     727        protected class AddIndexListener
    714728        implements ActionListener
    715729        {
     
    729743
    730744
    731         private class SourceListListener
     745        protected class SourceListListener
    732746        implements ListSelectionListener {
    733747       
     
    741755   
    742756
    743         private class ReplaceIndexListener
     757        protected class ReplaceIndexListener
    744758        implements ActionListener {
    745759       
     
    765779         * @return Whether macro variable should be used.
    766780         */
    767         private boolean use_macro_as_display_name(String index_id) {
     781        protected boolean use_macro_as_display_name(String index_id) {
    768782        //String metaname = index_id;   
    769783        if (index_id.indexOf(":") != -1) {
     
    803817         * @return Name of the macro variable.
    804818         */
    805         private String get_macro_name(String index_id) {
     819        protected String get_macro_name(String index_id) {
    806820        if (index_id.indexOf(":") != -1) {
    807821            index_id = index_id.substring(index_id.indexOf(":") + 1);
Note: See TracChangeset for help on using the changeset viewer.