Ignore:
Timestamp:
2024-03-02T20:04:36+13:00 (3 months ago)
Author:
anupama
Message:
  1. The Phrase Browse tab (in my tudor collection which has a Phind browser) now links to the webswing-phind.xsl page, loading the Phind applet (JPhind JApplet) as a webswing application. 2. The applet status bar wasn't appearing. I'm not sure if it's because browser support for applets has stopped so that a status window is no longer provided to Applets for showStatus() calls (see the API for this Applet method) or whether webswing doesn't provide a status window, but since we're printing meaningful information to the status window, I've now opened up the JPhind code that creates and uses the custom statusBar when JPhind is run as an application (instead of when run as an applet) when JPhind is now run as an applet also.
Location:
main/trunk/greenstone3/src/java/org/greenstone/applet/phind
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/applet/phind/JPhind.java

    r38800 r38813  
    3434as an application too due to the inclusion of the main() method.
    3535
     36To run as an applet, ensure PhindPhraseBrowse.java refers to JPhind.class
     37(not the old Phind.class Applet), then run in commandline:
     38
     39appletviewer "http://localhost:8383/greenstone3/gs2-library?a=a&rt=d&s=PhindApplet&c=tudor"
     40
    3641To run this applet as an application, for which purpose this class has a main() method, run as:
    3742
     
    338343
    339344    // status bar that applet has, but we want one also if we run JPhind as application
    340     if(!isRunAsApplet) {
     345    // And in fact, when webswing runs our applet, we never get a status bar. So we
     346    // create a custom status bar now even if we're running as an applet.
     347    // When this applet is run through the appletviewer we might end up with 2 status bars.
     348    //if(!isRunAsApplet) {
    341349        statusBar = new JLabel();
    342350        this.add(statusBar, BorderLayout.SOUTH);
    343     }
     351        Dimension d = statusBar.getSize();
     352        d.height = fontSize + 10;
     353        statusBar.setPreferredSize(d);
     354    //}
    344355   
    345356    // Create ResultDisplays and place into the interface
     
    371382        searchForWord(initialSearch);
    372383    }
     384
    373385    }
    374386
     
    621633
    622634    public void showStatus(String msg) {
    623     if(!isRunAsApplet) {
    624         this.statusBar.setText(msg);
    625     } else {
     635    // Either firefox doesn't provide a status bar window for applets any more or webswing
     636    // doesn't provide a status window, so we don't see Applet.showStatus() output appear
     637    // in webswing-phind and in fact don't even see any Applet statusBar in webswing.
     638    // However, since we print useful and interesting information to the status bar,
     639    // we'll now always show and print to our manually added statusBar now
     640    // not only if(!isRunAsApplet) when we needed to manually create a statusBar.
     641    this.statusBar.setText(msg);
     642    if(isRunAsApplet) {
    626643        super.showStatus(msg);
    627644    }
     
    636653    }
    637654    }
    638 
    639     /*
    640     public URL getDocumentBase(String url) {
    641     int index = url.indexOf("?"); // base URL is string before the query parameters
    642     if(index == -1) {
    643         return new URL(url);       
    644     } else {
    645         return new URL(url.substring(index));
    646     }
    647     }*/
    648655   
    649656    // Tidy up URLs
  • main/trunk/greenstone3/src/java/org/greenstone/applet/phind/Phind.java

    r38794 r38813  
    3737
    3838/*********************************************************************
     39To test run this Applet, ensure PhindPhraseBrowse.java refers to this awt Applet Phind.class
     40(not the new JPhind.class JApplet), then run in commandline:
     41
     42appletviewer "http://localhost:8383/greenstone3/gs2-library?a=a&rt=d&s=PhindApplet&c=tudo"r
    3943
    4044To use the applet, you'll need to embed it in a web page like this:
Note: See TracChangeset for help on using the changeset viewer.