franks42 / clj-ns-browser

Smalltalk-like namespace/class/var/function browser for clojure docs and source-code based on seesaw
Eclipse Public License 1.0
175 stars 11 forks source link

Make text-area have clickable links, color-highlighting of code, etc. #29

Open jafingerhut opened 12 years ago

jafingerhut commented 12 years ago

get swing html-text widget to work properly and replace the text-area (looks nicer, will have links working, code-highlighting, etc...) - rendering works in stand-alone browser window, but swing-widget doesn't look very nice...

jafingerhut commented 12 years ago

This Stackoverflow question has some discussion about Java HTML rendering libraries that might be useful:

http://stackoverflow.com/questions/2438201/pure-java-html-viewer-renderer

The Flying Saucer library is recommended there, among others. Might be worth trying out with some simple HTML containing different fonts, headings, links (are they clickable with events back to our code?), and text colors.

http://code.google.com/p/flying-saucer/

https://github.com/flyingsaucerproject/flyingsaucer

jafingerhut commented 12 years ago

Flying saucer looks interesting, but seems not to be under active development any more, and so bug fixes or enhancements would have to be done by us. Not desirable.

Frank mentioned JavaFX to me. http://javafx.com It definitely appears to be under active development and looks to be full-featured. The only downside I can think of is that it seems like it might require JDK 1.7 or higher, and isn't there for Linux yet. Maybe also a bit bleeding edge.

Another possibility is to rely more on the user's web browser, e.g. Firefox, Safari, Chrome, IE. One issue is that if the clj-ns-browser has the window it does now, and we use the web browser, effective interaction will require seeing both of those windows at once on the screen, plus perhaps the user's REPL session.

Here I'll toss out a probably crazy idea: The user starts up the browser in their REPL session. This starts up a little web server in that JVM process intended only for serving requests that come from the user's local web browser, e.g. Firefox. All of what is now the clj-ns-browser's interface is then somehow implemented between this server and the web browser. Big down sides: Effectively a rewrite of clj-ns-browser to get back up to today's functionality. Couldn't use Seesaw, and have to learn web server/browser ways of building such an interface. Potentially compatibility issues dealing with different web browsers. Up sides? Can take advantage of many features in modern browsers for display and interaction. Links to outside web pages are trivially made clickable.