Changeset 1637 for trunk/gsdl/src/phind/client/ResultCanvas.java
- Timestamp:
- 2000-10-31T15:22:17+13:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/phind/client/ResultCanvas.java
r1627 r1637 227 227 int visible = canvasSize.height / lineSpacing; 228 228 229 //System.out.println("h " + canvasSize.height + ", l "230 // + lineSpacing + ", v " + visible);231 232 229 // get the initial scrollbar setting 233 230 // and calculate the first result to output … … 239 236 } 240 237 firstPhraseDisplayed = scrollValue; 238 239 // Draw the phrase area 241 240 242 241 // draw the background … … 257 256 } 258 257 259 // First column 260 g.setColor(new Color(235, 245, 235)); 261 g.fillRect(firstColumn, 0, margin, canvasSize.height); 262 263 // Second column 264 g.setColor(new Color(200, 220, 200)); 265 g.fillRect(secondColumn, 0, margin, canvasSize.height); 266 g.setColor(Color.black); 267 268 // if there are no phrases, output a brief explanation. 258 // If there are no phrases, output a brief explanation. 269 259 if (numberOfPhrases == 0) { 270 260 g.drawString("No phrases match this query.", leftMargin + 10, lineSpacing); … … 272 262 273 263 // Output each of the visible ResultItems 264 ResultItem result; 274 265 int tab, i, y = 0; 275 int center = leftMargin + ((rightMargin - leftMargin - g.getFontMetrics().stringWidth(parent.searchPhrase)) / 2); 276 ResultItem result; 277 278 for (i = scrollValue; (i < numberOfPhrases) && (y + lineSpacing < canvasSize.height); i++) { 266 int center = leftMargin 267 + ((rightMargin - leftMargin 268 - g.getFontMetrics().stringWidth(parent.searchPhrase)) / 2); 269 270 for (i = scrollValue; 271 (i < numberOfPhrases) && (y + lineSpacing < canvasSize.height); i++) { 279 272 280 273 // Get the resultItem to output 281 274 result = (ResultItem) phrases.elementAt(i); 282 275 283 276 // Graphics settings for drawing this line 284 277 y += lineSpacing; … … 292 285 } 293 286 294 // Draw the item - it could be phrase or a URL 295 296 // Write the document frequency 297 if ((result.documents > 1) || result.isPhrase()) { 298 g.drawString(" " + Integer.toString(result.documents), firstColumn, y); 299 } 300 301 // Write the term frequency 302 if (result.freq > 0) { 303 g.drawString(" " + Integer.toString(result.freq), secondColumn, y); 304 } 287 // Draw the item 305 288 306 289 if (result.isPhrase()) { … … 346 329 } 347 330 348 // adjust the scrollbar 331 // Draw the frequecy columns 332 333 // column backgrounds 334 g.setColor(new Color(235, 245, 235)); 335 g.fillRect(firstColumn, 0, margin, canvasSize.height); 336 g.setColor(new Color(200, 220, 200)); 337 g.fillRect(secondColumn, 0, margin, canvasSize.height); 338 339 // fill in the numbers 340 g.setColor(Color.black); 341 g.setFont(areaPlain); 342 y = 0; 343 344 for (i = scrollValue; 345 (i < numberOfPhrases) && (y + lineSpacing < canvasSize.height); i++) { 346 347 // Get the resultItem to output 348 result = (ResultItem) phrases.elementAt(i); 349 350 // Graphics settings for drawing this line 351 y += lineSpacing; 352 353 // Write the document frequency 354 if ((result.documents > 1) || result.isPhrase()) { 355 g.drawString(" " + Integer.toString(result.documents), firstColumn, y); 356 } 357 358 // Write the term frequency 359 if (result.freq > 0) { 360 g.drawString(" " + Integer.toString(result.freq), secondColumn, y); 361 } 362 } 363 364 // Adjust the scrollbar 349 365 if (visible >= numberOfPhrases) { 350 366 parent.disableScrollbar();
Note:
See TracChangeset
for help on using the changeset viewer.