de.akquinet.chameria.webview
Class WebViewFactory

java.lang.Object
  extended by de.akquinet.chameria.webview.WebViewFactory
All Implemented Interfaces:
BrowserService

public class WebViewFactory
extends java.lang.Object
implements BrowserService

Main component of the web view factory. This component receives the configuration and creates the browser windows and the web view. It also has a couple of up-calls to handle the configuration properly.


Field Summary
 
Fields inherited from interface de.akquinet.chameria.services.BrowserService
SCROLLBAR_ALWAYS_OFF, SCROLLBAR_ALWAYS_ON, SCROLLBAR_AS_NEEDED
 
Constructor Summary
WebViewFactory(org.osgi.framework.BundleContext ctxt)
          Creates a WebViewFactory.
 
Method Summary
 int getDefaultFixedFontSize()
           
 int getDefaultFontSize()
           
 int getHeight()
           
 java.lang.String getHorizontalScrollBarPolicy()
           
 com.trolltech.qt.core.Qt.ScrollBarPolicy getHorizontalScrollBarQTPolicy()
          Gets the horizontal scroll bar policy.
 java.lang.String getLocalStorageLocation()
          Gets the local storage location.
 java.lang.String getURL()
           
 java.lang.String getVerticalScrollBarPolicy()
           
 com.trolltech.qt.core.Qt.ScrollBarPolicy getVerticalScrollBarQTPolicy()
          Gets the vertical scroll bar policy.
 int getWidth()
           
 boolean isContextMenuEnabled()
           
 boolean isContextMenuSupported()
          Is the context menu supported ?
 boolean isDownloadSupported()
           
 boolean isFullScreen()
           
 boolean isInspectorEnabled()
          Checks if the inspector is enabled.
 boolean isLocalStorageEnabled()
          Checks if the local storage is enabled.
 boolean isMenuBarEnabled()
           
 boolean isOpenWindowSupported()
           
 boolean isPrintSupported()
           
 boolean isResizable()
           
 com.trolltech.qt.webkit.QWebView openWindow()
          Open callback (window.open).
 void print(com.trolltech.qt.webkit.QWebView view)
          Print callback.
 void save(com.trolltech.qt.network.QNetworkReply reply)
          Save callback (for unsupported content).
 void setContextMenu(boolean enabled)
           
 void setDownloadSupport(boolean enabled)
           
 void setFullScreen(boolean fullscreen)
           
 void setHorizontalScrollBarPolicy(java.lang.String policy)
           
 void setMenuBar(boolean enabled)
           
 void setOpenWindowSupport(boolean enabled)
           
 void setPrintSupport(boolean enabled)
           
 void setResizable(boolean resizable)
           
 void setSize(int width, int height)
           
 void setURL(java.lang.String url)
          Configuration Property: set the initial URL.
 void setVerticalScrollBarPolicy(java.lang.String policy)
           
 void start()
          Starts the browser and loads the set url in the web view.
 void stop()
          Deletes the create browser.
static void write(java.io.InputStream in, java.io.OutputStream out)
          Utility method to copy a stream to another stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebViewFactory

public WebViewFactory(org.osgi.framework.BundleContext ctxt)
Creates a WebViewFactory.

Parameters:
ctxt - the bundle context.
Method Detail

setURL

public void setURL(java.lang.String url)
Configuration Property: set the initial URL. This property is mandatory. If the browser is already created, this web view loads this new url.

Specified by:
setURL in interface BrowserService
Parameters:
url - the url

stop

public void stop()
Deletes the create browser.


start

public void start()
Starts the browser and loads the set url in the web view.


print

public void print(com.trolltech.qt.webkit.QWebView view)
Print callback. Checks if the print feature is enabled. If so, launch the system print job.

Parameters:
view - the view to print

save

public void save(com.trolltech.qt.network.QNetworkReply reply)
Save callback (for unsupported content). Checks if the 'save' feature is enabled. If so, launch the system save dialog.

Parameters:
reply - the url to save

write

public static void write(java.io.InputStream in,
                         java.io.OutputStream out)
                  throws java.io.IOException
Utility method to copy a stream to another stream.

Parameters:
in - the stream to copy
out - the destination
Throws:
java.io.IOException - the stream cannot be copied

openWindow

public com.trolltech.qt.webkit.QWebView openWindow()
Open callback (window.open). Checks if the 'open new window' feature is enabled. If so, creates the web view


isContextMenuSupported

public boolean isContextMenuSupported()
Is the context menu supported ?

Returns:
true if the context menu is supported, otherwise false

getHorizontalScrollBarQTPolicy

public com.trolltech.qt.core.Qt.ScrollBarPolicy getHorizontalScrollBarQTPolicy()
Gets the horizontal scroll bar policy.

Returns:
the horizontal bar policy

getVerticalScrollBarQTPolicy

public com.trolltech.qt.core.Qt.ScrollBarPolicy getVerticalScrollBarQTPolicy()
Gets the vertical scroll bar policy.

Returns:
the vertical bar policy

isInspectorEnabled

public boolean isInspectorEnabled()
Checks if the inspector is enabled.

Returns:
true if the inspector is enabled.

isLocalStorageEnabled

public boolean isLocalStorageEnabled()
Checks if the local storage is enabled.

Returns:
true if the local storage is enabled.

getLocalStorageLocation

public java.lang.String getLocalStorageLocation()
Gets the local storage location.

Returns:
the local storage location

getHeight

public int getHeight()
Specified by:
getHeight in interface BrowserService

getURL

public java.lang.String getURL()
Specified by:
getURL in interface BrowserService

getWidth

public int getWidth()
Specified by:
getWidth in interface BrowserService

getDefaultFixedFontSize

public int getDefaultFixedFontSize()

getDefaultFontSize

public int getDefaultFontSize()

isContextMenuEnabled

public boolean isContextMenuEnabled()
Specified by:
isContextMenuEnabled in interface BrowserService

isDownloadSupported

public boolean isDownloadSupported()
Specified by:
isDownloadSupported in interface BrowserService

isFullScreen

public boolean isFullScreen()
Specified by:
isFullScreen in interface BrowserService

isMenuBarEnabled

public boolean isMenuBarEnabled()
Specified by:
isMenuBarEnabled in interface BrowserService

isOpenWindowSupported

public boolean isOpenWindowSupported()
Specified by:
isOpenWindowSupported in interface BrowserService

isPrintSupported

public boolean isPrintSupported()
Specified by:
isPrintSupported in interface BrowserService

isResizable

public boolean isResizable()
Specified by:
isResizable in interface BrowserService

setContextMenu

public void setContextMenu(boolean enabled)
Specified by:
setContextMenu in interface BrowserService

setDownloadSupport

public void setDownloadSupport(boolean enabled)
Specified by:
setDownloadSupport in interface BrowserService

setFullScreen

public void setFullScreen(boolean fullscreen)
Specified by:
setFullScreen in interface BrowserService

setHorizontalScrollBarPolicy

public void setHorizontalScrollBarPolicy(java.lang.String policy)
Specified by:
setHorizontalScrollBarPolicy in interface BrowserService

setMenuBar

public void setMenuBar(boolean enabled)
Specified by:
setMenuBar in interface BrowserService

setOpenWindowSupport

public void setOpenWindowSupport(boolean enabled)
Specified by:
setOpenWindowSupport in interface BrowserService

setPrintSupport

public void setPrintSupport(boolean enabled)
Specified by:
setPrintSupport in interface BrowserService

setResizable

public void setResizable(boolean resizable)
Specified by:
setResizable in interface BrowserService

setSize

public void setSize(int width,
                    int height)
Specified by:
setSize in interface BrowserService

setVerticalScrollBarPolicy

public void setVerticalScrollBarPolicy(java.lang.String policy)
Specified by:
setVerticalScrollBarPolicy in interface BrowserService

getHorizontalScrollBarPolicy

public java.lang.String getHorizontalScrollBarPolicy()
Specified by:
getHorizontalScrollBarPolicy in interface BrowserService

getVerticalScrollBarPolicy

public java.lang.String getVerticalScrollBarPolicy()
Specified by:
getVerticalScrollBarPolicy in interface BrowserService


Copyright © 2010-2011 akquinet A.G.. All Rights Reserved.