Demos
From OpenSiddurProject
Contents |
Version 0.3/r418
You may run the demo:
- As an applet (try this first!)
- Via Java Web Start (JNLP) (an alternative start method).
You may also:
Please report any bugs, issues, or feature requests at our issue tracker or send an email to the mailing list.
Description
An applet that generates XHTML from our internal XML format. For now, we only have Tanach (which we will reference from the siddur to avoid duplication), and the applet can generate and display XHTML in a web browser from any part of Tanach.
Why This is Important
A compiler application is needed to convert the siddur texts from our storage format to a form that can be displayed (as in web browsers).
The compiler applet contains:
- a simple front end to choosing sample texts
- a client-side compiler that accesses data from the database and converts it into XHTML that web browsers can display. It also stores a simple CSS stylesheet to control the display of the XHTML.
The recipe compiler is an integral part of the project. Performing processor-intensive activities on the client-side reduces the processing power and memory requirements on the server side, reducing the overall cost of the project.
Browser Compatibility
These browser configurations have been tested:
- Windows/Firefox 3.5/Sun Java
- Linux (Debian "squeeze")/Firefox 3.5/OpenJDK
- Windows/Firefox < 3.5 (Ezra SIL font must be installed)
- Windows/Internet Explorer 8
- Windows/Internet Explorer 7 (No spacing between text segments)
- Windows/Internet Explorer <= 6 (Unsupported)
- Windows/Chrome (Ezra SIL font must be installed, or font-face explicitly enabled)
- Linux/Konquerer 4.3 (Security manager must be disabled, which is not recommended, font-face support unknown)
- Mac OS X 10.5 or 10.6/Firefox 3.5 (Applet works, font-face works, but font renders incorrectly)
- Mac OS X 10.5/Safari 4.0 (Applet works, font-face works, but font renders incorrectly)
- Mac OS X 10.6/Safari (font renders readably, with some display errors)
New in this release
- Cross-browser support: Firefox, IE, Chrome
- New tabs open in the same browser as applet, instead of default browser
- No font installation needed for FF 3.5+ and IE 7+; font-face support used instead
- IE7
- IE7 no longer breaks font file supplied for font-face
- bug: no spacing displayed between segments (fixed in IE8)
- Mac support
- Now using Jetty instead of com.sun.httpserver
- Caught an exception thrown because of Mac Java 1.6 incompatibility
- bug OS X 10.5 does not support complex OpenType font layouts (like Ezra SIL uses)
- Improved logging
- Improved code documentation
- HTML Validation
- The compiler web interface validates as XHTML 1.0 Transitional
- Generated muXHTML validates as XHTML 1.0 Transitional
Already completed
- Transforming JLPTEI to muXHTML
- Minimal CSS styling of muXHTML
Still todo
- Testing on Mac OS X (particularly Snow Leopard)
- Integrating recipe support
- Interfacing with eXist DB for update API
- Other output formats, including PDF
- Spruce up the web interface with jQuery/CSS
- Optimize compilation times
- Optimize for parallel compilation
- Style muXHTML better
- Test more complex layouts and JLPTEI features
Hacking the Code
Getting Started
- Checkout the trunk
- The source: /trunk/code/JLPDemo/
- Building the project with Ant:
- Run ant in /trunk/code/JLPDemo/
- The necessary jars get copied to /trunk/code/JLPDemo/jars
- The html entry point is at /trunk/code/JLPDemo/JLPDemo.htm
- The JNLP entry is at /trunk/code/JLPDemo/jars/JLPDemo.jnlp
- The docs (javadoc) get generated at /trunk/docs/JLPDemo/
- Developing with Eclipse:
- Classpath (most of these can be found at /trunk/lib/:
- saxon9he.jar
- xmldb.jar
- exist.jar
- resolver-1.2.jar
- log4j-1.2.15.jar
- ws-commons-util-1.0.2.jar
- xmlrpc-client-3.1.2.jar
- xmlrpc-common-3.1.2.jar
- jetty-6.1.22.jar
- servlet-api-2.5-20081211.jar
- jetty-util-6.1.22.jar
- plugin.jar located at ${java.home}/lib/plugin.jar (java.home being the JRE home directory)
- Classpath (most of these can be found at /trunk/lib/:
- The project uses many libs, but is itself released under the LGPL license
A Closer Look
- Main things to look at
- JLPDemo.htm: The HTML entry point; it embeds the applet in the page and provides JS callbacks so that the applet can interface properly with it.
- Demo.java: The applet entry point and driver. I think its a bit over commented, and if you have any questions feel free to shoot an email to the ML. The applet does something mighty queer: it runs a web server. Thats right. It runs a web server. Jetty to be exact. The reason it runs a web server is that the purpose of the applet is to produce XHTML, which is best served in the browser. In the future, there might be an option to use JS-Java communication to not require a web server running on the client.
- To open a browser window to the correct location (the port is chosen by the system to avoid conflict), the applet tries many different fallbacks, some of which depend on the manner of launch (JNLP, Applet, application), some of them the browser (eg. support for netscape.javascript), some the version of Java, and perhaps the system.
- Using a JS-Java bridge (netscape.javascript) and using an iframe provided on the calling web page (in our case, JLPDemo.htm)
- Using a JS-Java bridge (netscape.javascript) and simply calling window.open() (sometimes gets blocked by popup blocker, but at least opens in the same browser as the applet itself, though sometimes in another window instead of tab, like in IE)
- Using the AppletContext TODO: use the JNLP BasicService API
- Using the Desktop API to open a page in the default browser (Recent JDK)
- Simply printing the localhost URL to the Jetty server on the console
- To open a browser window to the correct location (the port is chosen by the system to avoid conflict), the applet tries many different fallbacks, some of which depend on the manner of launch (JNLP, Applet, application), some of them the browser (eg. support for netscape.javascript), some the version of Java, and perhaps the system.
- src/index.htm: The main page that Jetty serves. Provides links to the license, and the menu.
- src/menu.htm: Displays the entry points that are available in our eXist database.
- src/menu.xql: This XQuery script is sent to the database, to retrieve the entry points that are available. TODO: can use some tinkering and tweaking.
- MenuServlet.java: This serves menu.htm, running menu.xql to get the list of entry points TODO: see above.
- CompilerServlet.java: Once an entry point is requested, the CompilerServlet retrieves the entry point and the XSLT stylesheets, and begins the transform. When it is complete (some time later), it caches and displays it to the client.
- src/xhtmlcompat.xsl: After the muXHTML is generated, this transform is performed to put in any ugly XHTML that might be needed for browser insanity.
- src/style.css: This styles the generated muXHTML in the user's browser. The muXHTML is heavily classed to allow for styling every aspect. TODO: Make this nicer!, request more classes as necessary.
- ExistQuery.java: This class is a helper class that executes an XQuery against our database and handles the result. TODO: this can be tweaked, and will additionally become more complex as our queries do.
- Other stuff
- The Ant script used to build the project
Next release goals
This section shows broad release goals for the next version of the demo applet, version 0.4:
Features
- Simple recipes: build a new, valid, JLPTEI file with a selection that references data in existing files in order
- Save locally
- Save to database (may wait until 0.5)
- Automated transliterations, using SBL or Modern Israeli Hebrew pronunciations in Latin characters
- Backend support (almost complete)
- Front-end support (UI can be as simple as a checkbox and/or a drop down list)
- CSS support for parallel texts
