Ignore:
Timestamp:
2001-03-09T19:00:03+13:00 (23 years ago)
Author:
say1
Message:

fixed bugs and added error checking ...

Location:
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/CSModel.java

    r2145 r2148  
    111111  public String getFirstCollection()
    112112  {
    113     return (String)collectionList.get(0);
     113    if (collectionList.size() > 0)
     114      return (String)collectionList.get(0);
     115    else
     116      return "no collections";
    114117  }
    115118  /**
  • trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java

    r2147 r2148  
    1919package org.nzdl.gsdl.SimpleGraphicalClient;
    2020
     21import java.awt.*;
     22import java.awt.event.*;
     23import java.io.*;
     24import java.util.*;
    2125import javax.swing.*;
    2226import javax.swing.border.*;
    23 import java.awt.*;
    24 import java.awt.event.*;
    25 import java.util.*;
    2627import javax.swing.event.*;
    27 import java.io.*;
    28 
    2928
    3029// local libraries
     
    6564  JScrollPane scrollResultsPane;
    6665  /** where the doc contents are displayed */
    67   JTextArea dataTextArea; 
     66  JEditorPane dataTextArea; 
    6867  JScrollPane scrollDataPane;
     68
     69  final static String DOC_HEADER = "<html><body>";
     70  final static String DOC_FOOTER = "</body></html>";
    6971
    7072  /**
     
    158160    dataPanel.setLayout(new BorderLayout());
    159161    dataPanel.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
    160     dataTextArea = new JTextArea("Document details will appear here", 10, 0);
     162    dataTextArea = new JEditorPane("text/html",
     163                   "<html><body>Document details will appear here.\n\n\n</body></html>");
    161164    dataTextArea.setEditable(false);
    162     dataTextArea.setLineWrap(true);
     165    dataTextArea.setEditable(false);
    163166    dataTextArea.setFont(docFont);
    164167    dataTextArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     168    //dataTextArea.setPreferredSize(new Dimension(100, 100));
    165169    scrollDataPane = new JScrollPane(dataTextArea);
     170    scrollDataPane.setPreferredSize(new Dimension(100, 100));
    166171    dataPanel.add(scrollDataPane, BorderLayout.CENTER);
    167172   
     
    179184  }
    180185
    181 
    182 
    183     /* respond to the user pressing the Search button */
     186  /** respond to the user pressing the Search button */
    184187
    185188public void actionPerformed(ActionEvent e) {
     
    225228       } // end else
    226229           // default to showing the top ranked document
     230      if (docIDs.size() > 0)
    227231           resultsList.setSelectedIndex(0);
    228232       } // end if
     
    232236 } //end actionPerformed
    233237
    234 
    235 
    236     /* handles selection events in the results list so that when the
     238  /** handles selection events in the results list so that when the
    237239       user selects a new title (say) the document contents is
    238240       automatically displayed in the main panel */
     
    252254         // should cache document contents here to speed access
    253255         String documentContents = csModel.getNzdlService().getDocument(result.getCollectionName(),  result.getDocID());
     256         documentContents = DOC_HEADER + documentContents + DOC_FOOTER;
    254257         dataTextArea.setText(documentContents);
    255258         dataTextArea.setCaretPosition(0);
     
    257260     } //end valueChanged
    258261}//end ResultListSelectionHandler
     262>>>>>>> 1.4
    259263
    260264
Note: See TracChangeset for help on using the changeset viewer.