Index: /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Result.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Result.java	(revision 2164)
+++ /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/Result.java	(revision 2165)
@@ -37,6 +37,6 @@
 
 
-    public final static String FAKE_RESULT = "No results returned";
-
+    public final static Result FAKE_RESULT = new Result("No results returned", "", "");
+    public final static Result INITIAL_FAKE_RESULT = new Result("Search results will appear here", "", "");
        // related query
 	   // time, person, collection etc
Index: /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java
===================================================================
--- /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java	(revision 2164)
+++ /trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java	(revision 2165)
@@ -21,5 +21,5 @@
 import java.awt.*;
 import java.awt.event.*;
-import java.io.StringReader;
+import java.io.*;
 import java.io.IOException;
 import java.util.*;
@@ -69,8 +69,9 @@
   JScrollPane scrollDataPane;
   JFrame windowParent;
-
-  JTextPane documentPane;
+    //JEditorPane documentPane;
+    JTextPane documentPane;
   HTMLEditorKit htmlEditorKit;
-  HTMLDocument htmlDoc;
+    GMLDocument htmlDoc = new GMLDocument();
+    final static GMLDocument blankDoc = new GMLDocument();
   
    final static Rectangle TOP_RECT = new Rectangle(0,0,0,0);
@@ -145,10 +146,11 @@
     scrollResultsPane = new JScrollPane(resultsList);
     resultsPanel.add(scrollResultsPane, BorderLayout.CENTER);
-    csModel.addResult(new Result("Search results will appear here", "", ""));
+    csModel.addResult(Result.INITIAL_FAKE_RESULT);
 	
     dataPanel = new JPanel();
     dataPanel.setLayout(new BorderLayout());
     dataPanel.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
-    documentPane = new JTextPane();
+     documentPane = new JTextPane();
+     //documentPane = new JEditorPane();
     htmlEditorKit  =  new HTMLEditorKit();    
     documentPane.setEditorKit(htmlEditorKit);
@@ -177,5 +179,7 @@
   public void actionPerformed(ActionEvent e) {
     if (e.getSource() == searchButton ) { //assume only searchButton generates events
+	// cursor not set when RETURN pressed, only when button clicked ?
       windowParent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+      //System.err.println("set wait cursor..");
       String queryString = searchTextField.getText();
       String collectionName = collectionList.getSelectedItem().toString();
@@ -189,7 +193,10 @@
       NzdlRequest request = new NzdlRequest( nzdlQuery );
       NzdlResponse response = new NzdlResponse();
+      
       nzdl.service( collectionName, request, response );
+     Date t8 = new Date();
       NzdlResultSet results = response.getResultSet();
-      java.util.List docIDs = results.getDocumentIDs();
+      ArrayList docIDs = new ArrayList(results.getDocumentIDs());
+      // System.err.println("Size of docIDs = " + docIDs.size());
       // paired collection of docIDs and Titles - but as Sets!
       Map titleMetaData = csModel.getNzdlService().getMetaData( collectionName, docIDs, "Title" );
@@ -203,10 +210,14 @@
 	titleMap.put(docID, titleList.get(0)); 
       } // end for
+      Date t9 = new Date();
+      long sdiff = t9.getTime() - t8.getTime();
+      System.err.println("processing results = " + sdiff + " ms");
       // update the results list
       csModel.clearResults();
-      // System.err.println("Size of docIDs = " + docIDs.size());
+      
       if (docIDs.size() == 0 ) { // give some feedback for 0 results
-	csModel.addResult(new Result(Result.FAKE_RESULT, "", ""));
-	documentPane.setText("");
+	csModel.addResult(Result.FAKE_RESULT);
+	//documentPane.setText("");
+	documentPane.setStyledDocument(blankDoc);
       }
       else { // there are some results
@@ -233,12 +244,24 @@
 
   class ResultListSelectionHandler implements ListSelectionListener {
+
+      // private Result previousSelection = null;
+
     public void valueChanged(ListSelectionEvent e) {
       // get the result object from the SelectedIndex
       // assume we only get here with events from resultsList
+      if (e.getValueIsAdjusting()) { return; }
       Result result =  (Result) resultsList.getSelectedValue();
-      if (result.toString() == Result.FAKE_RESULT) {
-	  documentPane.setText("");
+      // System.err.println("result = " + result);
+      // System.err.println("fake result = " + Result.FAKE_RESULT);
+      if ((result == Result.FAKE_RESULT) || (result == Result.INITIAL_FAKE_RESULT)) {
+	  //documentPane.setText("");
+	  documentPane.setStyledDocument( blankDoc );
+	  System.err.println("clicked on fake result");
       }
       else {
+
+	  Date startTime = new Date();
+	  Date t1 = new Date();
+
 	  windowParent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 	  
@@ -251,20 +274,40 @@
 	  }
 
-	  htmlDoc = new HTMLDocument(); 
-	  try 
-	      { // get the document and read it in as HTML
+	  htmlDoc = new GMLDocument(); 
+	  try { // get the document and read it in as HTML
 	      htmlEditorKit.read( new StringReader(csModel.getNzdlService().getDocument(result.getCollectionName(),  result.getDocID())), htmlDoc, 0);
 	  }
 	  catch(BadLocationException badLocException)
 	  {
-	      System.err.println("Bad Location Exception in creating HTML doc" + badLocException);
+	  System.err.println("Bad Location Exception in creating HTML doc" + badLocException);
 	  }
 	  catch(IOException ioException)
 	  {
 	      System.err.println("IO Exception whilst reading doc contents" + ioException);
-	  }
+	   } 
+	  Date t2 = new Date();
+	  long diff = t2.getTime() - t1.getTime();
+	  System.err.println("getDocument() = " + diff + " ms");
+	  
+	  Date t3 = new Date(); 
+
 	  documentPane.setStyledDocument( htmlDoc );
+
+	  Date t4 = new Date();
+	  long diff2 = t4.getTime() - t3.getTime();
+	  System.err.println("documentPane set " + diff2 + " ms");
+
 	  documentPane.scrollRectToVisible(TOP_RECT);
+
+	  Date t5 = new Date();
+	  long diff7 = t5.getTime() - t4.getTime();
+	  System.err.println("documentPane scroll " + diff7 + " ms");
+
+	  //System.err.println("getting image data...");
+	  //	  htmlDoc.getImageData();
 	  windowParent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+	  Date endTime = new Date();
+	  long diff5 = endTime.getTime() - startTime.getTime();
+	  System.err.println("total time " + diff5 + " ms");
       }
     } //end valueChanged
