Ignore:
Timestamp:
2000-10-30T15:10:28+13:00 (24 years ago)
Author:
paynter
Message:

The applet is now operational. Phrases work, documents work, getting new
phrases and documents work, backdrops work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/phind/client/Phind.java

    r1626 r1627  
    5555   words on the screen, and handles user input from the mouse.
    56566. ResultItem represents a single result object (a phrase or document).
    57 
    58 7. PhindTitle is for drawing backdrops in empty Displays. (?)
     577. PhindTitle is for drawing backdrops in ResultDisplays.
    5958
    6059**********************************************************************/
     
    104103
    105104    // Do we want a background image in the applet?
     105    String backdrop_address;
    106106    public boolean showImage;
    107107    public Image backgroundImage;
     
    109109    // Holders for the downloaded data
    110110    Panel resultPanel;
    111     PhindTitle title;
    112111    ResultDisplay firstDisplay, lastDisplay;
    113112
     
    198197    System.out.println("Phind library: " + library_address);
    199198
     199    // Should we display a background image?
     200    showImage = false;
     201    try {
     202        backdrop_address = new String(getParameter("backdrop"));
     203        URL backdrop_url = new URL(backdrop_address);
     204        backgroundImage = getImage(backdrop_url);
     205        showImage = true;
     206        System.out.println("Phind backdrop: " + backdrop_address);
     207    } catch (Exception e) {
     208        System.out.println("Phind backdrop not set");
     209    }
     210
    200211    // Is there a search URL for this collection?
    201212    try {
     
    238249    System.out.println("Phind phrase block size: " + phraseBlockSize);
    239250
    240     // Should we display a background image?
    241     showImage = false;
    242     try {
    243         if (getParameter("background").toLowerCase().equals("on")) {
    244         showImage = true;
    245         System.out.println("Phind background: on");
    246         }
    247     } catch (Exception e) {
    248         System.out.println("Phind background: off");
    249     }
    250 
    251 
    252251    // How large should the font be?
    253252    try {
     
    271270    // The phind applet layout manager
    272271    setLayout(new BorderLayout());
    273 
    274     // the Phind title window
    275     if (showImage) backgroundImage = getImage(getCodeBase(), "sequitur.jpg");
    276     title = new PhindTitle(this, true);
    277272
    278273    // initialise the user interface
     
    495490    throws IOException {
    496491
    497     // Set up connections (streams)
    498     //connection = new Socket(server, Integer.parseInt(port));
    499     //OutputStream out = connection.getOutputStream();
    500     //InputStream in = connection.getInputStream();
    501 
    502492    // Build the query
    503493    String query = phindcgi_address + "?x=1&c=" + collection;
    504494
    505495    if (keyKnown) {
    506         query = query + "&n=" + word;
     496      query = query + "&n=" + word;
    507497    } else {
    508         query = query + "&p=" + word;
    509     }
    510 
    511     // Specify the number of results to return and the first and last results.
     498      query = query + "&p=" + word;
     499    }
     500
     501   
     502    // Specify the set of results to return
     503    int first_e = 0;
     504    int last_e = 0;
     505    int first_d = 0;
     506    int last_d = 0;
     507
     508    // the initial query
    512509    if (queryMode <= 2) {
    513         query = query + "&f=0&d=" + phraseBlockSize + "&g=0&e=" + phraseBlockSize;
    514     } else if (queryMode == 3) {
    515         // Add phrases to an existing result set.
    516         query = query + "&f=0&d=" + phraseBlockSize + "&g=0&e=" + phraseBlockSize;
    517         // query = (word + " " + queryMode + " " + phraseBlockSize + " " + area.nextPhraseBlock);
    518         area.nextPhraseBlock++;
    519     } else if (queryMode == 4) {
    520         // Add documents to existing result set.
    521         query = query + "&f=0&d=" + phraseBlockSize + "&g=0&e=" + phraseBlockSize;
    522         // query = (word + " " + queryMode + " " + phraseBlockSize + " " + area.nextDocumentBlock);
    523         area.nextDocumentBlock++;
    524     }
    525 
     510      last_e = phraseBlockSize;
     511      last_d = phraseBlockSize;
     512    }
     513 
     514    // add phrases to an existing result set
     515    else if (queryMode == 3) {
     516      first_e = area.nextPhraseBlock * phraseBlockSize;
     517      area.nextPhraseBlock++;
     518      last_e = area.nextPhraseBlock * phraseBlockSize;
     519    }
     520   
     521    // add documents to existing result set
     522    else if (queryMode == 4) {
     523      first_d = area.nextDocumentBlock * phraseBlockSize;
     524      area.nextDocumentBlock++;
     525      last_d = area.nextDocumentBlock * phraseBlockSize;
     526    }
     527
     528    query = query + "&f=" + first_d + "&d=" + last_d
     529                  + "&g=" + first_e + "&e=" + last_e;
    526530
    527531    // Send the query to the phindcgi program
Note: See TracChangeset for help on using the changeset viewer.