Changeset 4342
- Timestamp:
- 2003-05-27T12:41:03+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/PreviewPane.java
r4324 r4342 45 45 import org.greenstone.gatherer.util.Utility; 46 46 47 public class PreviewPane 47 public class PreviewPane 48 48 extends JPanel { 49 49 50 50 private CalHTMLPane view = null; 51 51 private int back_count = 0; … … 87 87 status = new JLabel(get("Ready")); 88 88 } 89 89 90 90 public void collectionChanged(boolean ready) { 91 91 /** … … 105 105 status.setText(get("Loading", args)); 106 106 args = null; 107 view.showHTMLDocument((new GURL(url)).getURL()); 107 view.showHTMLDocument((new GURL(url)).getURL()); 108 108 } 109 109 validate(); … … 135 135 public void gainFocus() { 136 136 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);142 137 // 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(); 144 139 Gatherer.println("Loading " + url); 145 140 args = new String[1]; … … 150 145 page_showing = url; 151 146 homepage = (new GURL(url)).getURL(); 147 url = null; 152 148 } 153 149 validate(); 154 150 } 155 151 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. 157 153 */ 158 154 public String get(String key) { … … 167 163 } 168 164 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 169 176 public void validate() { 170 177 if(back_count > 0) { … … 189 196 } 190 197 191 private class BackListener 198 private class BackListener 192 199 implements ActionListener { 193 200 public void actionPerformed(ActionEvent event) { … … 199 206 } 200 207 201 private class ForwardListener 208 private class ForwardListener 202 209 implements ActionListener { 203 210 public void actionPerformed(ActionEvent event) { … … 249 256 // The Pane is attempting to connect to the given URL to receive data. 250 257 case CalCons.PRE_CONNECT: 251 System.err.println("Preconnect: " + value + " - " + message);258 System.err.println("Preconnect: " + state + " - " + message); 252 259 break; 253 260 // 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. 254 261 case CalCons.PARSE_FAILED: 255 System.err.println("Parse Failed: " + value + " - " + message);262 System.err.println("Parse Failed: " + state + " - " + message); 256 263 status.setText(get("CannotConnect") + message); 257 264 break; 258 265 // The Pane has established a connection to the given URL and is receiving any content. 259 266 case CalCons.CONNECTED: 260 System.err.println("Connected: " + value + " - " + message);267 System.err.println("Connected: " + state + " - " + message); 261 268 args = new String[1]; 262 269 args[0] = url.toString(); … … 266 273 // The size of the content at the given URL is known and is contained in the value argument. 267 274 case CalCons.DOC_LENGTH: 268 System.err.println("Doc Length: " + value + " - " + message);275 System.err.println("Doc Length: " + state + " - " + message); 269 276 break; 270 277 // 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. 271 278 case CalCons.TITLE: 272 System.err.println("Title: " + value + " - " + message);279 System.err.println("Title: " + state + " - " + message); 273 280 break; 274 281 // 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. 275 282 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); 277 284 status.setText(get("TimedOut") + message); 278 285 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. 280 287 case CalCons.WAITING_FOR_IMAGES: 281 System.err.println("Waiting For Images: " + value + " - " + message);288 System.err.println("Waiting For Images: " + state + " - " + message); 282 289 break; 283 290 // All text and image data has been received, parsed and the document structure determined. 284 291 case CalCons.DOC_LOADED: 285 System.err.println("Doc Loaded: " + value + " - " + message);292 System.err.println("Doc Loaded: " + state + " - " + message); 286 293 status.setText(get("Ready")); 287 294 break; … … 289 296 } 290 297 } 291 } 298 }
Note:
See TracChangeset
for help on using the changeset viewer.