Changeset 2198
- Timestamp:
- 2001-03-20T10:35:58+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java
r2195 r2198 130 130 searchTextFieldPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); 131 131 searchTextFieldPanel.add(searchTextField); 132 132 133 133 searchButtonPanel = new JPanel(); 134 134 searchButtonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); 135 135 searchButtonPanel.add(searchButton); 136 136 137 137 queryFormulationPanel = new JPanel(); 138 138 queryFormulationPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 142 142 queryFormulationPanel.add(searchTextFieldPanel); 143 143 queryFormulationPanel.add(searchButtonPanel); 144 144 145 145 resultsPanel = new JPanel(); 146 146 resultsPanel.setLayout(new BorderLayout()); … … 154 154 resultsPanel.add(scrollResultsPane, BorderLayout.CENTER); 155 155 csModel.addResult(Result.INITIAL_FAKE_RESULT); 156 156 157 157 dataPanel = new JPanel(); 158 158 dataPanel.setLayout(new BorderLayout()); … … 170 170 } 171 171 }; // end custom JTextPane 172 172 173 documentPane.setEditable(false); 173 174 documentPane.setFont(docFont); … … 178 179 scrollDataPane.setPreferredSize(new Dimension(300, 300)); 179 180 dataPanel.add(scrollDataPane, BorderLayout.CENTER); 180 181 181 182 parent.getRootPane().setDefaultButton(searchButton); 182 183 … … 193 194 194 195 public void actionPerformed(ActionEvent e) { 195 if (e.getSource() == searchButton ) { //assume only searchButton generates events196 196 if (e.getSource() == searchButton ) { 197 // cursor not set when RETURN pressed, only when button clicked ? 197 198 windowParent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 198 //System.err.println("set wait cursor..");199 199 String queryString = searchTextField.getText(); 200 200 String collectionName = collectionList.getSelectedItem().toString(); … … 215 215 // System.err.println("Size of docIDs = " + docIDs.size()); 216 216 // paired collection of docIDs and Titles - but as Sets! 217 Map titleMetaData = csModel.getNzdlService().getMetaData( collectionName, docIDs, "Title" );217 Map titleMetaData = nzdl.getMetaData( collectionName, docIDs, "Title" ); 218 218 // created a paired collection of docIDs and Titles - as simple Strings! 219 219 HashMap titleMap = new HashMap(); … … 233 233 if (docIDs.size() == 0 ) { // give some feedback for 0 results 234 234 csModel.addResult(Result.FAKE_RESULT); 235 //documentPane.setText("");236 235 documentPane.setStyledDocument(blankDoc); 237 236 } … … 274 273 if (e.getValueIsAdjusting()) { return; } 275 274 Result result = (Result) resultsList.getSelectedValue(); 276 // System.err.println("result = " + result);277 // System.err.println("fake result = " + Result.FAKE_RESULT);278 275 if ((result == Result.FAKE_RESULT) || (result == Result.INITIAL_FAKE_RESULT)) { 279 //documentPane.setText("");280 276 documentPane.setStyledDocument( blankDoc ); 281 277 System.err.println("clicked on fake result"); … … 292 288 defaultStyledDoc.remove(0, defaultStyledDoc.getLength()); 293 289 } catch (Exception exception) { 294 290 throw new Error (exception.toString()); 295 291 } 296 292 defaultStyledDoc = new DefaultStyledDocument(); … … 299 295 try { // get the document 300 296 String docContents = csModel.getNzdlService().getDocument(result.getCollectionName(), result.getDocID()); 301 StringReader sr = new StringReader( 297 StringReader sr = new StringReader(docContents); 302 298 if (NzdlPreferences.getInstance().getBoolean(Constants.RAW_TEXT)) { // display the document as raw text 303 299 documentPane.setEditorKit(styledEditorKit); … … 310 306 documentPane.setStyledDocument( htmlDoc ); 311 307 } 312 // htmlEditorKit.read( new StringReader(csModel.getNzdlService().getDocument(result.getCollectionName(), result.getDocID())), htmlDoc, 0); 313 } 308 } // end try 314 309 catch(BadLocationException badLocException) 315 310 { … … 321 316 } 322 317 323 //documentPane.setStyledDocument( htmlDoc ); 324 // should check for empty document here 325 documentPane.setCaretPosition(1); 318 if (documentPane.getLength > 0) 319 documentPane.setCaretPosition(1); 326 320 // we might not be using htmlDoc at this point!! 327 321 htmlDoc.getImageData(nzdl, result.getCollectionName());
Note:
See TracChangeset
for help on using the changeset viewer.