BibleGet-I-O / bibleget-openoffice

BibleGet I/O Project plugin for Open Office
Apache License 2.0
2 stars 1 forks source link

implement JCEF #1

Closed JohnRDOrazio closed 3 years ago

JohnRDOrazio commented 3 years ago

Currently, the Preferences window of the plugin for OpenOffice uses a JTextEditor with HTMLEditorKit provided by swing in order to provide a real time preview of the text formatting of the Bible quotes in HTML+CSS, based on the options selected in the preferences window.

This works kind of ok, but it has a lot of drawbacks. HTMLEditorKit is old technology now. It only supports HTML version 3.2 and CSS2, and it doesn't seem to be getting any new updates any time soon, looking at it's history. Currently, the preview area is not capable of previewing line-height . It doesn't support either CSS3 or HTML5.

In the meantime I have updated the Google Docs plugin and the Microsoft Word plugin adding an HTML5 canvas element to the preview area which draws out a simulation of the document ruler, in order to preview the right and left indent tabs. This is a nice touch to the preview area. However it is impossible to implement with HTMLEditorKit, which has no support for HTML5.

I'm thinking that maybe the Jave Chrome Embedded Framework could solve this issue. If JCEF can be used in place of HTMLEditorKit, then all of the best web technologies should be available through the components it provides.

Now, OpenOffice on Windows is only 32 bit, so at least for this we would need to use JCEF 32 bit I believe. Which means the OpenOffice plugin builds should probably be differentiated once JCEF is implemented, seeing that JCEF is also platform dependent (different builds for different platforms). So we would have:

  1. BibleGet for OpenOffice Win-32, built with JDK 1.8 x86 and JCEF Win32
  2. BibleGet for OpenOffice Linux-32, built with JDK 1.8 x86 and JCEF Linux32
  3. BibleGet for OpenOffice Linux-64, built with JDK 1.8 x64 and JCEF Linux64
  4. BibleGet for OpenOffice MacOS-64, built with JDK 1.8 x64 and JCEF MacOS64

I initially created a JCEF branch in order to test development on this, which has been merged into the master and development branches in the meantime. Development continues on the development branch.


ready made builds of JCEF

https://github.com/jcefbuild/jcefbuild

How to load custom html using a data URI

https://magpcss.org/ceforum/viewtopic.php?f=17&t=14956

JohnRDOrazio commented 3 years ago

NOTE 9 September 2020

I have succeeded in adding the necessary library to the classpath, which allows me to import the classes and use the class methods... However the pak files and the dlls are also required in order for the component to function. How should the pak files and the dlls be added to the project?

NOTE 10 September 2020

My Netbeans seemed a little quirky and it seemed like it was seeing conflict in the JCEF branch for some reason, so to make sure everything was truly clean I went and deleted the branch and created it again, to be sure it really was lined up with the master branch. After doing all this, I realized there wasn't an actual conflict, it was just the Netbeans interface that was automatically filling in the commit message area with old message material which had nothing to do with the current situation. If anyone had already pulled the branch, I apologize, you might need to delete and pull again. It shouldn't happen again 😄

In any case I just made the first push on this branch. I've succeeded in not getting an error at least. I have the JCEF native library folder (\path\to\jcef_win32_1-0-10-84\java-cef-build-bin\bin\lib\win32) in my system path for now. I tried setting Run -> VMOptions to -Djava.library.path="\path\to\jcef_win32_1-0-10-84\java-cef-build-bin\bin\lib\win32" but that didn't seem to do the trick, I was still getting an Exception in thread "main" java.lang.UnsatisfiedLinkError: no chrome_elf in java.library.path.

I tried doing it on runtime from within the code using System.setProperty("java.library.path", "\path\to\jcef_win32_1-0-10-84\java-cef-build-bin\bin\lib\win32"); but that didn't do the trick either.

Only thing that solved for the time being is setting the path inside of my system PATH variable.

Even though I'm no longer getting an error, I'm still not getting an actual browser with a Google page either, I just see an empty JInternalFrame. Need to do more testing, if anyone has any ideas they are more than welcome

JohnRDOrazio commented 3 years ago

a good part of this is accomplished in PR #9 and PR #11 . However still have to tackle how to package the native libraries and make them available to the system path...

JohnRDOrazio commented 3 years ago

Maybe have to set java.library.path and then loadLibrary? It's worth a try. Problem is figuring out how to package and make available on the final user's system...

In the meantime this might be useful: https://magpcss.org/ceforum/viewtopic.php?f=17&t=12230

JohnRDOrazio commented 3 years ago

done as far as functionality is concerned. Now still have to figure out packaging and distribution, making native libraries available