By Scott Hommel-Oracle on May 30, 2008
When designing an embedded browser instance, the following features are typically considered:
- Accessing certain domains
- Accessing the local file system
- Loading a URL
- Moving forward or backward in the browser's history
- Printing web page
- Reloading the current web page
- Stopping loading the web page in progress
The following structure depicts the internal architecture of the embedded browser.
Figure 1. The HTML component architecture
JWebPane component provides basic web page browsing functionality. It renders web pages and provides basic user interaction, such as navigating links, and submitting HTML forms. The
JWebPane component displays one web page at a time. The
PolicyDelegate is intended for implementing a browser policy. Implementations may use arbitrary logic to enable or reject sensitive operations such as loading web pages, opening new browser windows or running scripts on pages. An implementation may thus act as a list-based URL filter or a popup blocker. A single
PolicyDelegate may be associated with a
JWebPane object. It then receives notifications from the
JWebPane about changes to the browser state that are about to happen. The
PolicyDelegate may either accept or reject these changes. The
LoadStateListener tracks the state of a page load.
At the moment the project is 70% complete. The
JWebPane component implemented as a lightweight component extending the
JComponent class, which enables easy embedding into an application UI context. Moreover, the
JWebPane component may contain several web frames with the specified icon, title, and URL. The following browsing features are available:
- Loading control — load, stop, and reload functions.
- Listeners handling. — typical function enabling a developer to get, add, and remove listeners.
- Page loading started
- HTTP server redirection processed
- Icon for the page received
- Page title received
- Page content loaded completely
- An image contained in the page loaded
- Page and all its resources loaded completely
- Loading Failed
Figure 2. The HTML component embedded into the JavaFX application Click the image to view it at its natural size.
The following new features are scheduled to be implemented by August'08:
- Viewing the History, including Back and Forward functions.
- Notifications of external resources loading
- Progress status
- Viewing page source
JWebPanecomponent in the Artem Ananiev's Blog.
-- Alla Redko