Changeset 4342


Ignore:
Timestamp:
2003-05-27T12:41:03+12:00 (21 years ago)
Author:
jmt12
Message:

Added resetServer method to fire configure action off to local library - John

File:
1 edited

Legend:

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

    r4324 r4342  
    4545import org.greenstone.gatherer.util.Utility;
    4646
    47 public class PreviewPane 
     47public class PreviewPane
    4848     extends JPanel {
    49      
     49
    5050     private CalHTMLPane view   = null;
    5151     private int back_count     = 0;
     
    8787          status = new JLabel(get("Ready"));
    8888     }
    89      
     89
    9090     public void collectionChanged(boolean ready) {
    9191          /**
     
    105105                status.setText(get("Loading", args));
    106106                args = null;
    107                 view.showHTMLDocument((new GURL(url)).getURL());               
     107                view.showHTMLDocument((new GURL(url)).getURL());
    108108          }
    109109          validate();
     
    135135     public void gainFocus() {
    136136          if(Gatherer.c_man.ready() && Gatherer.c_man.built()) {
    137                 // First we ask the server to register our collection, just in case its changed. Wait until the 'page' has loaded to be safe.
    138                 String url = Gatherer.config.exec_address + "?a=config&cmd=add-collection&c=" + Gatherer.c_man.getCollection().getName();
    139                 view.setLoadSynchronously(true);
    140                 view.showHTMLDocument((new GURL(url)).getURL());
    141                 view.setLoadSynchronously(false);
    142137                // Now load the collection
    143                 url = Gatherer.config.exec_path + "?a=p&p=about&c=" + Gatherer.c_man.getCollection().getName();
     138                String url = Gatherer.config.exec_address.toString() + "?a=p&p=about&c=" + Gatherer.c_man.getCollection().getName();
    144139                Gatherer.println("Loading " + url);
    145140                args = new String[1];
     
    150145                page_showing = url;
    151146                homepage = (new GURL(url)).getURL();
     147                url = null;
    152148          }
    153149          validate();
    154150     }
    155151
    156      /** Used to retrieve the phrase that matches the given key from the loaded dictionary. 
     152     /** Used to retrieve the phrase that matches the given key from the loaded dictionary.
    157153      */
    158154     public String get(String key) {
     
    167163     }
    168164
     165    public void resetServer() {
     166        // First we ask the server to register our collection, just in case its changed. Wait until the 'page' has loaded to be safe.
     167        String url = Gatherer.config.exec_address.toString() + "?a=config&cmd=add-collection&c=" + Gatherer.c_man.getCollection().getName();
     168        System.err.println("Action: " + url);
     169        view.setLoadSynchronously(true);
     170        view.showHTMLDocument((new GURL(url)).getURL());
     171        view.setLoadSynchronously(false);
     172        System.err.println("Complete.");
     173        url = null;
     174    }
     175
    169176     public void validate() {
    170177          if(back_count > 0) {
     
    189196     }
    190197
    191      private class BackListener 
     198     private class BackListener
    192199          implements ActionListener {
    193200          public void actionPerformed(ActionEvent event) {
     
    199206     }
    200207
    201      private class ForwardListener 
     208     private class ForwardListener
    202209          implements ActionListener {
    203210          public void actionPerformed(ActionEvent event) {
     
    249256                     // The Pane is attempting to connect to the given URL to receive data.
    250257                case CalCons.PRE_CONNECT:
    251                      System.err.println("Preconnect: " + value + " - " + message);
     258                     System.err.println("Preconnect: " + state + " - " + message);
    252259                     break;
    253260                     // The Pane was unable to connect to the given URL or was unable to parse the content. Most likely this will be due to an incorrectly specified URL. The message argument may contain further details of the reason for failure.
    254261                case CalCons.PARSE_FAILED:
    255                      System.err.println("Parse Failed: " + value + " - " + message);
     262                     System.err.println("Parse Failed: " + state + " - " + message);
    256263                     status.setText(get("CannotConnect") + message);
    257264                     break;
    258265                     // The Pane has established a connection to the given URL and is receiving any content.
    259266                case CalCons.CONNECTED:
    260                      System.err.println("Connected: " + value + " - " + message);
     267                     System.err.println("Connected: " + state + " - " + message);
    261268                     args = new String[1];
    262269                     args[0] = url.toString();
     
    266273                     // The size of the content at the given URL is known and is contained in the value argument.
    267274                case CalCons.DOC_LENGTH:
    268                      System.err.println("Doc Length: " + value + " - " + message);
     275                     System.err.println("Doc Length: " + state + " - " + message);
    269276                     break;
    270277                     // The title of the document for the given URL is known and is contained in the message argument. Only the title of a document in the Pane's top level frame will be sent to this method. If the document has no name, the message will be null, unless the document is a Frameset document in which case the message "Frameset" will be sent.
    271278                case CalCons.TITLE:
    272                      System.err.println("Title: " + value + " - " + message);
     279                     System.err.println("Title: " + state + " - " + message);
    273280                     break;
    274281                     // An exception has been thrown during parsing of the data from the URL. This will most likely be an IOException such as a server time-out.
    275282                case CalCons.PARSE_FAILED_POST_CONNECT:
    276                      System.err.println("Parse Failed Post Connect: " + value + " - " + message);
     283                     System.err.println("Parse Failed Post Connect: " + state + " - " + message);
    277284                     status.setText(get("TimedOut") + message);
    278285                     break;
    279                      // The document has been parsed but formatting cannot be completed because the document contains images of unspecified size. The parsing thread is waiting for image updates to give it the information it needs to format and display the document. 
     286                     // The document has been parsed but formatting cannot be completed because the document contains images of unspecified size. The parsing thread is waiting for image updates to give it the information it needs to format and display the document.
    280287                case CalCons.WAITING_FOR_IMAGES:
    281                      System.err.println("Waiting For Images: " + value + " - " + message);
     288                     System.err.println("Waiting For Images: " + state + " - " + message);
    282289                     break;
    283290                     // All text and image data has been received, parsed and the document structure determined.
    284291                case CalCons.DOC_LOADED:
    285                      System.err.println("Doc Loaded: " + value + " - " + message);
     292                     System.err.println("Doc Loaded: " + state + " - " + message);
    286293                     status.setText(get("Ready"));
    287294                     break;
     
    289296          }
    290297     }
    291 } 
     298}
Note: See TracChangeset for help on using the changeset viewer.