Changeset 12067


Ignore:
Timestamp:
2006-07-07T11:23:28+12:00 (18 years ago)
Author:
kjdon
Message:

preview button is now a PReviewButton, and code for handling this is moved to that new class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java

    r11318 r12067  
    4949import org.greenstone.gatherer.Gatherer;
    5050import org.greenstone.gatherer.LocalLibraryServer;
    51 import org.greenstone.gatherer.cdm.SearchTypeManager;
     51import org.greenstone.gatherer.cdm.BuildTypeManager;
    5252import org.greenstone.gatherer.cdm.CollectionDesignManager;
    5353import org.greenstone.gatherer.collection.Collection;
     
    148148    private String args[] = null;
    149149    /** The homepage address of the current collection */
    150     private String homepage = null;
     150    public String homepage = null;
    151151
    152152
     
    208208    BuildButtonListener bbl = new BuildButtonListener();
    209209    CancelButtonListener cbl = new CancelButtonListener();
    210     PreviewButtonListener pbl = new PreviewButtonListener();
    211 
     210   
    212211    build_button = new GLIButton();
    213212    build_button.addActionListener(bbl);
     
    221220    Dictionary.registerBoth(cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip");
    222221
    223     preview_button = new GLIButton();
    224     preview_button.addActionListener(pbl);
     222    preview_button = new PreviewButton();
     223    //preview_button.addActionListener(pbl);
    225224    if(Gatherer.c_man != null) {
    226225        preview_button.setEnabled(Gatherer.c_man.built());
     
    243242    Dictionary.registerBoth(simple_cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip");
    244243
    245     simple_preview_button = new GLIButton();
    246     simple_preview_button.addActionListener(pbl);
     244    simple_preview_button = new PreviewButton();
     245    //simple_preview_button.addActionListener(pbl);
    247246    if(Gatherer.c_man != null) {
    248247        simple_preview_button.setEnabled(Gatherer.c_man.built());
     
    256255    bbl = null;
    257256    cbl = null;
    258     pbl = null;
     257    //pbl = null;
    259258    }
    260259
     
    630629    }
    631630    }
    632 
    633 
    634     private void configureHomeURL() {   
    635     // set up the home page for the current collection
    636     Collection current_collection = Gatherer.c_man.getCollection();
    637     String site = Configuration.site_name; // for GS3 colls
    638     String extra_args = "";
    639     SearchTypeManager st_man = current_collection.cdm.searchtype_manager;
    640     if (!Gatherer.GS3 && st_man.isSearchTypeEnabled()) {
    641         if (st_man.isLucene()) {
    642         extra_args = "&ct=2";
    643         } else { // MGPP default
    644         extra_args = "&ct=1";
    645         }
    646         // we need some more args on the url
    647         String search_types = st_man.getSearchTypes();
    648         if (search_types.equals("")) {
    649         extra_args += "&qt=0&qto=3";
    650         } else if (search_types.equals("plain")) {
    651         extra_args += "&qt=0&qto=1";
    652         } else if (search_types.equals("form")) {
    653         extra_args += "&qt=1&qto=2";
    654         } else if (search_types.equals("plain,form")) {
    655         extra_args += "&qt=0&qto=3";
    656         } else if (search_types.equals("form,plain")) {
    657         extra_args += "&qt=1&qto=3";
    658         }
    659     }
    660     // Remember to add unique timestamp
    661     if (Gatherer.GS3) {
    662         homepage = Configuration.library_url.toString() + Configuration.getServletPath()+ "?a=p&sa=about&c=" + current_collection.getName()+"&l="+Configuration.getLanguage(); //+extra_args + StaticStrings.TIMESTAMP_ARGUMENT + System.currentTimeMillis();
    663     } else {
    664         homepage = Configuration.library_url.toString() + "?a=p&p=about&c=" + current_collection.getName()+"&l="+Configuration.getLanguage()+extra_args + StaticStrings.TIMESTAMP_ARGUMENT + System.currentTimeMillis();
    665     }
    666     }
    667    
    668631
    669632    /** This class serves as the listener for actions on the build button. */
     
    793756    }
    794757
    795     private class PreviewButtonListener
    796     implements ActionListener {
    797    
    798     public void actionPerformed(ActionEvent event) {
    799         Gatherer.c_man.getCollection().cdm.save(); // save the config file just in case
    800         configureHomeURL();
    801         // check that the local library server is stil running  - doesn't do anything if its not supposed to be running
    802         LocalLibraryServer.checkServerRunning();
    803        
    804         Gatherer.spawnBrowser(homepage);
    805 
    806     }
    807     }
    808758   
    809759    /** The OptionTree is simply a tree structure that has a root node labelled "Options" and then has a child node for each available options screen. These screens are either combinations of the available import and build arguments, or a message log detailing the shell processes progress. */
     
    900850        }
    901851        }
    902                 //scroll_pane.setViewportView(previous_pane);
     852        //scroll_pane.setViewportView(previous_pane);
    903853        //previous_pane.validate();
    904854        right.validate();
Note: See TracChangeset for help on using the changeset viewer.