SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
JWebPane Overview

Alexey Ushakov
Sun Microsystems
Where do we need it?

>   Email programs or IMs (viewing HTML)
>   Rich clients for content delivery systems
     (providing reviews for the content)
>   Arbitrary Java or JavaFX applications (adding
     advert banners)
>   Anywhere you can imagine!




                                                    2
Project Goal

 Lightweight HTML component for Java and
  JavaFX providing:
  ●   Easy to use API
  ●   Modern HTML support
  ●   Java - JavaScript binding
  ●   DOM access
  ●   Plugins




                                           3
Solutions
>   Create HTML renderer from scratch
     ●   Huge effort
     ●   Endless ongoing work to match modern HTML
>   Enhance Swing HTML support
     ●   Significant work to get Swing up to date
     ●   Need to keep it up to date
>   Use existing HTML rendering engine
     ●   Mozilla
     ●   Webkit

                                                     4
Solutions: Mozilla, Webkit
>   Mozilla
     ●   Up-to-date
     ●   Opensource
     ●   Heavyweight

>   Webkit
     ●   Up-to-date
     ●   Opensource
     ●   Lightweight

                             5
Webkit based Implementation
                                   User Application

>   WebKit engine for
     HTML parsing, CSS,
     JavaScript                   Java API
                                                  HTML
                                                Component
>   Java for painting,
     metrics calculation,
     events handling,           WebKit
                            browser engine
                                                 Plugins
     networking, unicode,
     input methods
                            Java based Platform Abstraction



                                  Operating System
                                                              6
JWebPane plugins

>   Media Plugin
     ●   Embeds JavaFX Media Component
>   Java Plugin
     ●   Simple wrapper for Applet environment
     ●   Same JVM
>   ActiveX Plugin
     ●   Embeds IE Flash plugin



                                                 7
API: JWebPane

   UIDelegate

                   JWebPane            WebFrame

  PolicyDelegate


                   LoadStateListener




                                                  8
API: JWebPane
>   Provides basic web page browsing functionality
     and basic user interaction, such as navigating
     links, and submitting HTML forms.
     ●   Displays one web page at a time
     ●   Handles scrolling internally (no need for
          JScrollPane)




                                                      9
API: JWebPane

JFrame f = new JFrame(“Browser”);

JWebPane browser = new JWebPane();

f.add(browser);

browser.load(someURL);



                                     10
API: WebFrame
>   WebFrame is a nonvisual object that identifies an
    HTML <frame>, <iframe>, or <frameset>
    element
    ●   One WebFrame per HTML frame displayed in
         a JWebPane
    ●   WebFrames have hierarchical structure
    ●   Disposed after loading new pages



                                                        11
API: WebFrame


WebFrame wf = browser.getRootWebFrame();

for (WebFrame f : wf.getFrames()) {

    log.fine(f.getURL() + “:” + f.getTitle());

}


                                                 12
API: PolicyDelegate
>   Single object associated with JWebPane for
     implementing a browser policy by allowing or
     rejecting sensitive operations such as:
        ●   loading web pages
        ●   opening new browser windows
        ●   running scripts on pages




                                                    13
API. PolicyDelegate

class MyDelegate implements PolicyDelegate {

    public boolean permitAction(PolicyRequest r) {
      return r.getType() != ENABLE_SCRIPTS;
    }

}

browser = new JWebPane(new MyDelegate(), ...);

                                                     14
API: UIDelegate
>   GUI object associated with a JWebPane and
     provides some basic UI for it.
>   Provides a set of GUI-related callbacks invoked
     by associated JWebPane to customize its
     appearance
     ●   Displaying message/input boxes
     ●   Creating new browser view for the given URL
     ●   Setting status bar


                                                       15
API: UIDelegate

class MyUIDelegate extends DefaultUIDelegate {
   @Override
   public JWebPane createView(URL url) {
      JWebPane view = new JWebPane();
      view.load(url);
      return view;
   }
}

browser = new JWebPane(..., new MyUIDelegate());

                                                   16
API: LoadStateListener
>   Listener for loading events such as:
     ●   loadingStarted
     ●   redirectProcessed
     ●   loadingFinished or (if there is some problem)
          ●   loadingRejected - PolicyDelegate rejects
                 an operation
          ●   loadingFailed - loading fails due to an error
          ●   loadingStopped -loading is stopped with
                 the JWebPane.stop() method
                                                              17
API. LoadStateListener
class MyListener implements LoadStateListener {
   public void loadingStarted(LoadStateEvent e) {
      log.fine("Started:" + e.getURL());
   }
   public void loadingFinished(LoadStateEvent e){
      log.fine("Finished:" + e.getFrame().getTitle());
   }
   public void loadingFailed(LoadStateEvent e) {
      log.severe("Failed:" + e.getError());
   }
}
                                                         18
Deployment

>   JWebPane can be deployed as a JNLP extension
     ●   Plugins are deployed as separate JNLP
          extensions
>   Platforms Supported
     ●   Windows
     ●   Mac OS X
     ●   Linux
     ●   Solaris


                                                   19
Metrics (Windows XP)
                                      25


>   Download size                     20




         JWebPane: 2 mb
                                      15
     ●                                                                           JWebPane
                                                                                 Safari
                                      10                                          Firefox
     ●   Safari 3.1: 19.5 mb           5


     ●   Firefox 3: 7.1 mb             0
                                                   Download Size (mb)


>   Performance                       35


    (JWebPane/Safari/Firefox)         30

                                      25

     ●   Bubblemark: 33/26/27 fps     20
                                                                               JWebPane


         GUI Mark: 16/15/12 fps
                                      15                                       Safari
     ●                                                                         Firefox
                                      10


     ●   SunSpider: 2.6/3.9/3.3 sec   5

                                      0
                                                   GUIMark (fps)
                                       Bubblemark (fps)      SunSpider (sec)
                                                                                            20
Questions?




             21
Alexey Ushakov
alexey.ushakov@sun.com

Más contenido relacionado

Similar a JWebPane presentation at JavaOne 2009

[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration[English version] JavaFX and Web Integration
[English version] JavaFX and Web IntegrationKazuchika Sekiya
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overviewjeresig
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...ddrschiw
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)jeresig
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinatingAntonio Goncalves
 
Make web as webapp
Make web as webappMake web as webapp
Make web as webappFred Lin
 
Web Applications Support with the Chromium Embedded Framework on AGL
Web Applications Support with the Chromium Embedded Framework on AGLWeb Applications Support with the Chromium Embedded Framework on AGL
Web Applications Support with the Chromium Embedded Framework on AGLIgalia
 
Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Eduardo Pelegri-Llopart
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with CodeceptionJeremy Coates
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)jeresig
 
IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy: A Collaborative Recipe...
IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy:  A Collaborative Recipe...IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy:  A Collaborative Recipe...
IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy: A Collaborative Recipe...William Holmes
 
GlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for EclipseGlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for EclipseLudovic Champenois
 
7 Habits of Exceptional Performance
7 Habits of Exceptional Performance7 Habits of Exceptional Performance
7 Habits of Exceptional PerformanceNicole Sullivan
 
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT Group
 
Web componenet using angular element
Web componenet using angular elementWeb componenet using angular element
Web componenet using angular elementHimanshu Tamrakar
 

Similar a JWebPane presentation at JavaOne 2009 (20)

[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration
 
Gain more freedom when migrating from Camunda 7 to 8.pdf
Gain more freedom when migrating from Camunda 7 to 8.pdfGain more freedom when migrating from Camunda 7 to 8.pdf
Gain more freedom when migrating from Camunda 7 to 8.pdf
 
JavaScript Library Overview
JavaScript Library OverviewJavaScript Library Overview
JavaScript Library Overview
 
Ad111
Ad111Ad111
Ad111
 
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
AD111 -- Harnessing the Power of Server-Side JavaScript and Other Advanced XP...
 
GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinating
 
Make web as webapp
Make web as webappMake web as webapp
Make web as webapp
 
Web Applications Support with the Chromium Embedded Framework on AGL
Web Applications Support with the Chromium Embedded Framework on AGLWeb Applications Support with the Chromium Embedded Framework on AGL
Web Applications Support with the Chromium Embedded Framework on AGL
 
Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)
 
IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy: A Collaborative Recipe...
IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy:  A Collaborative Recipe...IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy:  A Collaborative Recipe...
IBM Lotusphere 2011 AD306 - IBM Lotus Sametime Proxy: A Collaborative Recipe...
 
GlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for EclipseGlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for Eclipse
 
7 Habits of Exceptional Performance
7 Habits of Exceptional Performance7 Habits of Exceptional Performance
7 Habits of Exceptional Performance
 
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshellWe4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
We4IT LCTY 2013 - x-pages-men - ibm domino xpages - performance in a nutshell
 
Web componenet using angular element
Web componenet using angular elementWeb componenet using angular element
Web componenet using angular element
 

JWebPane presentation at JavaOne 2009

  • 2. Where do we need it? > Email programs or IMs (viewing HTML) > Rich clients for content delivery systems (providing reviews for the content) > Arbitrary Java or JavaFX applications (adding advert banners) > Anywhere you can imagine! 2
  • 3. Project Goal Lightweight HTML component for Java and JavaFX providing: ● Easy to use API ● Modern HTML support ● Java - JavaScript binding ● DOM access ● Plugins 3
  • 4. Solutions > Create HTML renderer from scratch ● Huge effort ● Endless ongoing work to match modern HTML > Enhance Swing HTML support ● Significant work to get Swing up to date ● Need to keep it up to date > Use existing HTML rendering engine ● Mozilla ● Webkit 4
  • 5. Solutions: Mozilla, Webkit > Mozilla ● Up-to-date ● Opensource ● Heavyweight > Webkit ● Up-to-date ● Opensource ● Lightweight 5
  • 6. Webkit based Implementation User Application > WebKit engine for HTML parsing, CSS, JavaScript Java API HTML Component > Java for painting, metrics calculation, events handling, WebKit browser engine Plugins networking, unicode, input methods Java based Platform Abstraction Operating System 6
  • 7. JWebPane plugins > Media Plugin ● Embeds JavaFX Media Component > Java Plugin ● Simple wrapper for Applet environment ● Same JVM > ActiveX Plugin ● Embeds IE Flash plugin 7
  • 8. API: JWebPane UIDelegate JWebPane WebFrame PolicyDelegate LoadStateListener 8
  • 9. API: JWebPane > Provides basic web page browsing functionality and basic user interaction, such as navigating links, and submitting HTML forms. ● Displays one web page at a time ● Handles scrolling internally (no need for JScrollPane) 9
  • 10. API: JWebPane JFrame f = new JFrame(“Browser”); JWebPane browser = new JWebPane(); f.add(browser); browser.load(someURL); 10
  • 11. API: WebFrame > WebFrame is a nonvisual object that identifies an HTML <frame>, <iframe>, or <frameset> element ● One WebFrame per HTML frame displayed in a JWebPane ● WebFrames have hierarchical structure ● Disposed after loading new pages 11
  • 12. API: WebFrame WebFrame wf = browser.getRootWebFrame(); for (WebFrame f : wf.getFrames()) { log.fine(f.getURL() + “:” + f.getTitle()); } 12
  • 13. API: PolicyDelegate > Single object associated with JWebPane for implementing a browser policy by allowing or rejecting sensitive operations such as: ● loading web pages ● opening new browser windows ● running scripts on pages 13
  • 14. API. PolicyDelegate class MyDelegate implements PolicyDelegate { public boolean permitAction(PolicyRequest r) { return r.getType() != ENABLE_SCRIPTS; } } browser = new JWebPane(new MyDelegate(), ...); 14
  • 15. API: UIDelegate > GUI object associated with a JWebPane and provides some basic UI for it. > Provides a set of GUI-related callbacks invoked by associated JWebPane to customize its appearance ● Displaying message/input boxes ● Creating new browser view for the given URL ● Setting status bar 15
  • 16. API: UIDelegate class MyUIDelegate extends DefaultUIDelegate { @Override public JWebPane createView(URL url) { JWebPane view = new JWebPane(); view.load(url); return view; } } browser = new JWebPane(..., new MyUIDelegate()); 16
  • 17. API: LoadStateListener > Listener for loading events such as: ● loadingStarted ● redirectProcessed ● loadingFinished or (if there is some problem) ● loadingRejected - PolicyDelegate rejects an operation ● loadingFailed - loading fails due to an error ● loadingStopped -loading is stopped with the JWebPane.stop() method 17
  • 18. API. LoadStateListener class MyListener implements LoadStateListener { public void loadingStarted(LoadStateEvent e) { log.fine("Started:" + e.getURL()); } public void loadingFinished(LoadStateEvent e){ log.fine("Finished:" + e.getFrame().getTitle()); } public void loadingFailed(LoadStateEvent e) { log.severe("Failed:" + e.getError()); } } 18
  • 19. Deployment > JWebPane can be deployed as a JNLP extension ● Plugins are deployed as separate JNLP extensions > Platforms Supported ● Windows ● Mac OS X ● Linux ● Solaris 19
  • 20. Metrics (Windows XP) 25 > Download size 20 JWebPane: 2 mb 15 ● JWebPane Safari 10 Firefox ● Safari 3.1: 19.5 mb 5 ● Firefox 3: 7.1 mb 0 Download Size (mb) > Performance 35 (JWebPane/Safari/Firefox) 30 25 ● Bubblemark: 33/26/27 fps 20 JWebPane GUI Mark: 16/15/12 fps 15 Safari ● Firefox 10 ● SunSpider: 2.6/3.9/3.3 sec 5 0 GUIMark (fps) Bubblemark (fps) SunSpider (sec) 20