GithubHelp home page GithubHelp logo

brunoborges / webfx Goto Github PK

View Code? Open in Web Editor NEW
128.0 128.0 30.0 14.55 MB

WebFX runs FXML and Javascript based JavaFX applications remotely

License: Other

Java 89.71% JavaScript 5.46% CSS 2.55% Groovy 0.23% HTML 2.06%

webfx's Introduction

WebFX

The purpose of this project is to investigate both the possibility of building a JavaFX-based web browser, as well a new concept of web pages designed using JavaFX components (by coding, and remotely serving FXML + JS + CSS files) instead of using HTML, to build rich "web pages". With the new Javascript engine, Nashorn, the performance of a JavaFX page in FXML and the controllers in JS will be much higher than it is today. The goal of this project is to build a fully capable JavaFX-based browser, with a security layer, a navigation scheme, and then common web browser features such as bookmarking, cookie management, etc.

Inverted Browser Control Concept

JavaFX contains a feature called WebView, which enables applications to use an embedded version of WebKit to render HTML5 content. As a result, developers can create applications that use this browser to access remote applications. By combining this concept, developers can continualy build web applications that may have extensions built in Java to be executed in the client-side, as long these Java-based extensions are part of a JavaFX desktop application.

Figure 1 represents the legacy of Applets and Web Browsers. It is well known that Applets are no longer supported by all browsers, and that NPAPI is being slowly removed.

Figure 1

Figure 2 representes the inverted browser control concept, where developers build their own "embedded" browser to run remotely served web applications, while expanding the capability of their desktop applications in the client-side with rich features using JavaFX, or even reusing existing Applets codebases.

Figure 2

Running Applets in a JavaFX-based browser

The WebView component does not support the execution of Applets out-of-the-box. Graphical embedded applets (those that would show within a web page) are impossible to run, but for non-graphical Applets it is possible to load them and even have them interacting with your web page's Javascript code. For an example of such use case, see project webfx-appletsupport-sample for more information.

JavaFX-based Web Browser

FXML is the JavaFX markup language used to define user interfaces. UI components can be any JavaFX core component or any 3rd-party component available in the classpath. JavaFX also supports CSS for styling the UI. A web browser powered by JavaFX is then capable of running both regular W3C web pages as well FXML-based web pages remotely served.

YouTube Demo Videos

Hybrid JavaFX Application Architecture

The image below gives developers an idea on how they can leverage existing code, both legacy Applets, and web applications, with modern development approaches of JavaFX Desktop RIA applications.

For more information, check my presentation Migrating from Applets to Java Desktop Applications

Figure 3

webfx's People

Contributors

brunoborges avatar dependabot[bot] avatar pjbooms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webfx's Issues

Is it possible to reinstate the tableview example in webfx samples

  • Attempts to guessing at what it would take to get the tableview sample to work including adding the needed controller don't seem to work.
  • Running jetty:run-war in debug mode on Intellij does not work either.
  • The application just chugs along ignoring all breakpoints.
  • Most of the samples are not working @localhost.
  • This would be a very good alternative to embedded apps and only downloading the webfx browser makes adding new apps easy without further downloads needed.

java.lang.RuntimeException: A bound value cannot be set.

I get the error above when running any sample with your last changes until I uncomment the following line in BrowserFXController:
//urlField.textProperty().unbind();

Should it be uncommented? The stack trace if it is commented is here:

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: A bound value cannot be set.
at javafx.scene.control.TextInputControl$TextProperty.set(TextInputControl.java:1053)
at javafx.scene.control.TextInputControl$TextProperty.set(TextInputControl.java:1032)
at javafx.beans.property.StringProperty.setValue(StringProperty.java:65)
at webfx.browser.BrowserFXController.lambda$initialize$4(BrowserFXController.java:233)
at webfx.browser.BrowserFXController$$Lambda$3/1113725382.changed(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:347)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176)
at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145)
at javafx.scene.control.SelectionModel.setSelectedItem(SelectionModel.java:102)
at javafx.scene.control.TabPane$TabPaneSelectionModel.select(TabPane.java:669)
at javafx.scene.control.SingleSelectionModel.selectLast(SingleSelectionModel.java:190)
at webfx.browser.BrowserFXController.newTab(BrowserFXController.java:111)
at webfx.browser.BrowserFXController.openInNewTab(BrowserFXController.java:261)
at webfx.browser.HTMLTab$1.handleEvent(HTMLTab.java:97)
at com.sun.webkit.dom.EventListenerImpl.fwkHandleEvent(EventListenerImpl.java:107)
at com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webkit.WebPage.dispatchMouseEvent(WebPage.java:742)
at javafx.scene.web.WebView.processMouseEvent(WebView.java:1004)
at javafx.scene.web.WebView.access$2500(WebView.java:76)
at javafx.scene.web.WebView$14.handle(WebView.java:1130)
at javafx.scene.web.WebView$14.handle(WebView.java:1128)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:204)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
at com.sun.glass.ui.View.notifyMouse(View.java:898)

URLVerifier does not handle local URLs

I don't think this is right way to handle Malformed URLs:

    if (!location.startsWith("http://") && !location.startsWith("https://")) {
        location = "http://" + location;
    }

Instead of it, I would suggest to create an URL first, catch MalformedURLException and then try to add "http://".

Obviosly, the code snippet above breaks local urls (starting with "file://").

Setup problems

I had the following problems during setup:

  1. The project file (project.properties) has javac.source=1.7 while lambdas is already used
  2. Broken (not updated) referencies to jfxtras-labs and restfx-server. BTW, where I can find the sources for restfx?
  3. I had to compile webfx-component first and add resulting jar to webfx-browser project libraries to start WebFX. I was not able to import webfx-component to webfx-browser (Netbeans complained that it is not able to import). I believe there should be better way to do this (I am not familiar with Netbeans), and I expected that Netbeans will import it automatically

REST Demo and Calendar Gauge (JFXtras) demos do not work

If you run WebFX browser from Netbeans (after fixing #3), run jetty with samples and try to execute last two samples you will get errors in the NetBeans console:

javafx.fxml.LoadException:
/restdemo/search_demo.fxml:78
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)
...
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: restfx.web.QueryListener
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:382)
...

javafx.fxml.LoadException:
/webfx-samples/calendar/calendar.fxml
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)
...
Caused by: java.lang.ClassNotFoundException: jfxtras.labs.scene.control.CalendarPicker

It seems that dependencies to restfx and jfxtras were not added to the maven dependencies

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.