Opened 7 weeks ago
Last modified 6 weeks ago
#964 assigned defect
Turn Phind applet into webswing
Reported by: | anupama | Owned by: | nobody |
---|---|---|---|
Priority: | moderate | Milestone: | Greenstone 3 catch-up |
Component: | Collection Building | Severity: | major |
Keywords: | Cc: |
Description
Webswing supports JApplets (swing) but not Applets (awt). So the steps involved were:
- Port Phind Applet classes to JApplet. Located in the same folder, the new classes start with J (JPhind.java, JResultTitle.java, JResultBox.java, JResultDisplay.java and possibly more).
And src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java changed to refer to the new JPhind (JApplet) class now instead of the old Phind (Applet) class.
The source code is still in src/java/org/greenstone/applet/phind and it's all still compiled into web/applet where there are still 3 jars: phind.jar, xml-apis.jar and xercesImpl.jar.
- Get webswing to display the new JPhind JApplet. This required
- modifying webswing.config.in to add in the new configuration for webswing phind.
JPhind applet jars remain in web/applet, and this location is configured in webswing.config.in as a combination of setting the GS3 web location to be where we run JPhind webswing from and thus to look in its relative folder applet/*.jars as location for the JPhind webswing app(let)'s jar files.
webswing.config.in main class to run is set to being an applet class (that of JPhind) and "parameters" instead of cmdline "args" are set up to be passed to JPhind because it's run as an applet instead of an application.
- adding webswing-phind.xsl into default/transform/pages
This was supposed to add custom parameters ("collection and "library") for the JPhind applet, but these weren't getting through to the JPhind java code, so the java code was modified to work out the collection and library parameters from the docBaseURL instead. Not the ideal solution, but provides a working version for now.
- referring to webswing-phind.xsl in interfaceConfig.xml
- modifying header.xsl to have the Phind browsing classifier tab link to the webswing JPhind URL at http://<GS3host>:<GS3port>/greenstone3/<library>/collection/<collection>/page/phind (instead of the old phind applet URL)
Notes:
- Browsers don't support applets any more, but Java's appletviewer executable can be used to view (J)Applets and test them out
- The JPhind JApplet has been rewritten to run as application, achieved by adding a main() method. But because of the extensive command line args involved, I prefer to run as applet, which are easier to preconfigure.
- Applets use whatever status window the browser provides, if any, to display messages in the status bar with calls to showStatus(). When JPhind is run as an application, a custom status bar widget is added to mimic the status window browsers in the past would provide for applets.
When run as webswing, status bar that is seen through the appletviewer is no longer visible when the same applet is run through the web browser, perhaps because Firefox doesn't provide a status window any more (browser don't even support applets any more).
As useful information is displayed in JPhind's status bar, when it's run as an applet it also creates and writes to a custom status bar (besides still writing to any status bar a browser may provide). This ensures that the webswing JPhind JApplet has a working status bar.
However, as a result, when viewing the JPhind through the appletviewer, two status bars now appear. Greenstone users are anyway less likely to use the appletviewer to interact with the Phind/JPhind applets, so this shouldn't matter. If it does ever begin to matter, the call to super.showStatus() can be commented out so that only the custom status bar is ever used.
Changesets:
- Unrelated general modification affecting webswing GLI too: https://trac.greenstone.org/changeset/38805
- Porting awt Applet to swing JApplet
https://trac.greenstone.org/changeset/38794 to https://trac.greenstone.org/changeset/38796
https://trac.greenstone.org/changeset/38782
https://trac.greenstone.org/changeset/38799
https://trac.greenstone.org/changeset/38800
https://trac.greenstone.org/changeset/38813
https://trac.greenstone.org/changeset/38796 (src/java/org/greenstone/gsdl3/service/PhindPhraseBrowse.java refers to JPhind class now instead of Phind)
- Getting the JApplet to run as a webswing app
https://trac.greenstone.org/changeset/38806
https://trac.greenstone.org/changeset/38813
https://trac.greenstone.org/changeset/38814
https://trac.greenstone.org/changeset/38817 (JPhind for now works out collection and library parameters from docBase URL)
The webswing was changed to run JPhind as application instead of JApplet, in order to ensure custom user parameters could be passed in to Phind through the XML (webswing-phind.xsl).
Changesets:
https://trac.greenstone.org/changeset/38848
https://trac.greenstone.org/changeset/38849