Changeset 1841
- Timestamp:
- 2001-01-16T18:04:02+13:00 (23 years ago)
- Location:
- trunk/gsdl/src/phind/client
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/phind/client/Phind.java
r1832 r1841 29 29 /********************************************************************* 30 30 31 To use the applet, you'll need to embed it in a web page as follows:31 To use the applet, you'll need to embed it in a web page like this: 32 32 33 33 <APPLET CODE="Phind.class" WIDTH=500 HEIGHT=500> 34 34 35 <PARAM NAME=collection VALUE="fao.org"> 35 36 <PARAM NAME=phindcgi VALUE="http://kowhai/cgi-bin/phindcgi"> 36 37 <PARAM NAME=library VALUE="http://kowhai/cgi-bin/library"> 37 38 38 <PARAM NAME=backdrop VALUE="http://kowhai/~paynter/transfer/phindtest/green1.jpg"> 39 40 <PARAM NAME=collection VALUE="fao.org">41 42 <PARAM NAME=orientation VALUE="vertical">43 <PARAM NAME=depth VALUE="2">44 <PARAM NAME=blocksize VALUE="10">45 46 <PARAM NAME=fontsize VALUE="12">47 39 The Phind java applet. 48 40 </APPLET> 41 42 There are a bunch of other parameters; these are described in the 43 getParameters method below. It is all done for you in Greenstone 44 in the document.dm macro file (the _phindapplet_ macro). 49 45 50 46 You may have problems with Java applet security. Java applet's can only … … 126 122 public String backdrop_address; 127 123 public Image backgroundImage; 124 public boolean showBorder; 128 125 129 126 // Colours … … 582 579 } 583 580 581 // Should we draw a border? 582 showBorder = parameterValue("border", "on").equals("off"); 583 584 584 // Are the windows arranged vertically or horizontally 585 585 if (parameterValue("orientation", "vertical").toLowerCase().startsWith("hori")) { … … 588 588 vertical = true; 589 589 } 590 590 591 591 // How many phind windows are there? 592 592 depth = parameterValue("depth", 3); 593 594 // Result sort order 595 // Standard is "LlEeDd", expansion-first is "EeLlDd" 596 String order = parameterValue("resultorder", "standard"); 597 if (!order.equals("standard")) { 598 int next = 20; 599 ResultItem.sortMessage = next; 600 for (int x = 0; x < order.length(); x++) { 601 if (order.charAt(x) == ',') { 602 next--; 603 } else if (order.charAt(x) == 'L') { 604 ResultItem.sortLinkItem = next; 605 } else if (order.charAt(x) == 'l') { 606 ResultItem.sortMoreLinks = next; 607 } else if (order.charAt(x) == 'E') { 608 ResultItem.sortPhraseItem = next; 609 } else if (order.charAt(x) == 'e') { 610 ResultItem.sortMorePhrases = next; 611 } else if (order.charAt(x) == 'D') { 612 ResultItem.sortDocumentItem = next; 613 } else if (order.charAt(x) == 'd') { 614 ResultItem.sortMoreDocuments = next; 615 } 616 } 617 System.out.println("link: " + ResultItem.sortLinkItem); 618 System.out.println("exps: " + ResultItem.sortPhraseItem); 619 System.out.println("docs: " + ResultItem.sortDocumentItem); 620 621 } 593 622 594 623 // How many phrases should we fetch at any given time? -
trunk/gsdl/src/phind/client/ResultBox.java
r1830 r1841 232 232 buffer = buffer.concat(input); 233 233 234 // if buffer ends with "</phinddata>" then we are finished reading235 finished = buffer.endsWith("</phinddata>\n");236 237 234 // Parse each line until there are no more lines to parse 238 235 while(parseLine()); … … 240 237 if (finished) { 241 238 c.updateMarkers(); 239 buffer = ""; 242 240 } else { 243 241 // We haven't finished, give some feedback about progress … … 256 254 boolean parseLine() { 257 255 258 // System.out.print ln("parseLine " + finished + "(" + expansionsRetrieved+ ")");256 // System.out.print("parseLine " + "(length " + buffer.length() + ")"); 259 257 String item; 260 258 int eol = buffer.indexOf((int) '\n'); … … 265 263 } 266 264 265 // The </phinddata> tag concludes the dataset 266 else if (buffer.startsWith("</phinddata>")) { 267 mode = finishedMode; 268 finished = true; 269 return false; 270 } 271 267 272 // The <expansion> tag 268 273 else if (buffer.startsWith("<expansion ")) { … … 297 302 } 298 303 299 // The </phinddata> tag concludes the dataset300 else if (buffer.startsWith("</phinddata>")) {301 mode = finishedMode;302 return false;303 }304 305 304 // The <phinderror> tag contains an error message 306 305 else if (buffer.startsWith("<phinderror")) { -
trunk/gsdl/src/phind/client/ResultCanvas.java
r1832 r1841 118 118 int index = 0; 119 119 while ((index < numberOfItems) && 120 ((item. kind > ((ResultItem) items.elementAt(index)).kind) ||121 ((item. kind == ((ResultItem) items.elementAt(index)).kind) &&120 ((item.sort < ((ResultItem) items.elementAt(index)).sort) || 121 ((item.sort == ((ResultItem) items.elementAt(index)).sort) && 122 122 (item.frequency <= ((ResultItem) items.elementAt(index)).frequency)))) { 123 123 index++; … … 461 461 462 462 463 g.setColor(phind.panel_fg); 464 g.drawRect(0,0, canvasSize.width - 1, canvasSize.height - 1); 465 } 466 463 // draw the border 464 if (phind.showBorder) { 465 g.setColor(phind.panel_fg); 466 g.drawRect(0,0, canvasSize.width - 1, canvasSize.height - 1); 467 } 468 } 467 469 468 470 // User interaction -
trunk/gsdl/src/phind/client/ResultItem.java
r1833 r1841 40 40 public class ResultItem { 41 41 42 // There are several kinds of ResultItem43 // 1. a phrase (expansion)44 // 2. a "get more phrases" marker45 // 3. a document (or URL)46 // 4. a "get more documents" marker47 // 5. a thesaurus link48 // 6. a "get more thesaurus links" marker49 50 final static int linkItem = 1;51 final static int moreLinks = 2;52 final static int phraseItem = 3;53 final static int morePhrases = 4;54 final static int documentItem = 5;55 final static int moreDocuments = 6;56 final static int unknownResultItem = 9;57 58 42 // A text string describing the item 59 43 String text = "Generic ResultItem"; 44 45 // There are several kinds of ResultItem, identified by their 46 // "kind" field, which has an integer value from the list below. 47 final static int message = 8; 48 final static int linkItem = 7; 49 final static int moreLinks = 6; 50 final static int phraseItem = 5; 51 final static int morePhrases = 4; 52 final static int documentItem = 3; 53 final static int moreDocuments = 2; 54 final static int unknownResultItem = 1; 60 55 61 56 // The kind of the item 62 57 int kind = unknownResultItem; 63 58 64 // The frequency of the item 59 // When results are displayed, they are loosely sorted by their 60 // kind. The user can change the sort order numbers with the 61 // ResultOrder parameter in Phind.java. 62 static int sortMessage = 8; 63 static int sortLinkItem = 7; 64 static int sortMoreLinks = 6; 65 static int sortPhraseItem = 5; 66 static int sortMorePhrases = 4; 67 static int sortDocumentItem = 3; 68 static int sortMoreDocuments = 2; 69 static int sortUnknownResultItem = 1; 70 71 // the primary sort key 72 int sort = 0; 73 74 // The frequency of the item (secondary sort key) 65 75 int frequency = 0; 66 76 … … 80 90 if (kind == moreLinks) { 81 91 text = "get more thesaurus links"; 92 sort = sortMoreLinks; 82 93 } else if (kind == morePhrases) { 83 94 text = "get more phrases"; 95 sort = sortMorePhrases; 84 96 } else if (kind == moreDocuments) { 85 97 text = "get more documents"; 98 sort = sortMoreDocuments; 86 99 } else { 87 100 text = "Unknown result type"; 101 sort = sortUnknownResultItem; 88 102 } 89 103 } -
trunk/gsdl/src/phind/client/ResultItemDocument.java
r1827 r1841 49 49 kind = documentItem; 50 50 text = newTitle; 51 52 sort = sortDocumentItem; 51 53 frequency = Integer.valueOf(newFrequency).intValue(); 52 54 hash = newHash; -
trunk/gsdl/src/phind/client/ResultItemLink.java
r1832 r1841 59 59 symbol = Integer.valueOf(newId).intValue(); 60 60 text = newText.trim(); 61 sort = sortLinkItem; 61 62 linkType = newLinkType; 62 63 frequency = Integer.valueOf(tf).intValue(); -
trunk/gsdl/src/phind/client/ResultItemPhrase.java
r1833 r1841 60 60 symbol = Integer.valueOf(newId).intValue(); 61 61 62 sort = sortPhraseItem; 62 63 frequency = Integer.valueOf(tf).intValue(); 63 64 documentFrequency = Integer.valueOf(df).intValue(); … … 67 68 suffix = s; 68 69 text = (prefix + " " + body + " " + suffix); 70 69 71 } 70 72
Note:
See TracChangeset
for help on using the changeset viewer.