|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
chrriis.dj.nativeswing.swtimpl.NSPanelComponent
chrriis.dj.nativeswing.swtimpl.components.JWebBrowser
public class JWebBrowser
A native web browser, using Internet Explorer or Mozilla on Windows, and Mozilla on other platforms.
Methods execute when this component is initialized. If the component is not initialized, methods will be executed as soon as it gets initialized.
If the initialization fails, the methods will not have any effect. The results from methods have relevant values only when the component is valid.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static String |
COMMAND_LOCATION_PREFIX
The prefix to use when sending a command from some web content, using a static link or by setting window.location from Javascript. |
static String |
COMMAND_STATUS_PREFIX
The prefix to use when sending a command from some web content, by setting window.status from Javascript. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JWebBrowser(NSOption... options)
Construct a new web browser. |
|
| Method Summary | |
|---|---|
void |
addWebBrowserListener(WebBrowserListener listener)
Add a web browser listener. |
static void |
clearSessionCookies()
Clear all session cookies from all web browser instances. |
static String |
convertJavaObjectToJavascript(Object o)
Convert a Java object to Javascript, to simplify the task of executing scripts. |
static void |
copyAppearance(JWebBrowser fromWebBrowser,
JWebBrowser toWebBrowser)
Copy the appearance, the visibility of the various bars, from one web browser to another. |
static void |
copyContent(JWebBrowser fromWebBrowser,
JWebBrowser toWebBrowser)
Copy the content, whether a URL or its HTML content, from one web browser to another. |
static String |
createJavascriptFunctionCall(String functionName,
Object... args)
Create the Javascript function call using the function name and Java objects as arguments. |
void |
executeJavascript(String javascript)
Execute some javascript. |
Object |
executeJavascriptWithResult(String javascript)
Execute some javascript, and wait for the result coming from the return statements. |
static String |
getCookie(String url,
String name)
Get a cookie for a given URL and a given name. |
JMenu |
getFileMenu()
Get the file menu, which allows to modify the items. |
String |
getHTMLContent()
Get the HTML content. |
int |
getLoadingProgress()
Get the loading progress, a value between 0 and 100, where 100 means it is fully loaded. |
JMenuBar |
getMenuBar()
Get the menu bar, which allows to modify the items. |
String |
getPageTitle()
Get the title of the web page. |
String |
getResourceLocation()
Get the location of the resource currently displayed. |
String |
getStatusText()
Get the status text. |
WebBrowserListener[] |
getWebBrowserListeners()
Get the web browser listeners. |
JWebBrowserWindow |
getWebBrowserWindow()
Get the web browser window if the web browser is contained in one. |
boolean |
isBackNavigationEnabled()
Indicate if the web browser Back functionality is enabled. |
boolean |
isButtonBarVisible()
Indicate whether the button bar is visible. |
boolean |
isForwardNavigationEnabled()
Indicate if the web browser Forward functionality is enabled. |
boolean |
isJavascriptEnabled()
Indicate if Javascript will be allowed to run in pages subsequently viewed. |
boolean |
isLocationBarVisible()
Indicate whether the location bar is visible. |
boolean |
isMenuBarVisible()
Indicate whether the menu bar is visible. |
boolean |
isStatusBarVisible()
Indicate whether the status bar is visible. |
boolean |
navigate(String resourceLocation)
Navigate to a resource, with its location specified as a URL or path. |
void |
navigateBack()
Invoke the web browser Back functionality. |
void |
navigateForward()
Invoke the web browser Forward functionality. |
void |
reloadPage()
Invoke the web browser Reload functionality. |
void |
removeWebBrowserListener(WebBrowserListener listener)
Remove a web browser listener. |
void |
setBarsVisible(boolean areBarsVisible)
Show or hide all the bars at once. |
void |
setButtonBarVisible(boolean isButtonBarVisible)
Set whether the button bar is visible. |
static void |
setCookie(String url,
String value)
Set a cookie for all web browser instances. |
void |
setDefaultPopupMenuRegistered(boolean isDefaultPopupMenuRegistered)
Set whether this component is able to detect a popup menu gesture to show its default popup menu. |
boolean |
setHTMLContent(String html)
Set the HTML content. |
void |
setJavascriptEnabled(boolean isJavascriptEnabled)
Set whether javascript will be allowed to run in pages subsequently. |
void |
setLocationBarVisible(boolean isLocationBarVisible)
Set whether the location bar is visible. |
void |
setMenuBarVisible(boolean isMenuBarVisible)
Set whether the menu bar is visible. |
void |
setStatusBarVisible(boolean isStatusBarVisible)
Set whether the status bar is visible. |
void |
stopLoading()
Invoke the web browser Stop functionality, to stop all current loading operations. |
static NSOption |
useXULRunnerRuntime()
Create an option to make the web browser use the Mozilla XULRunner runtime. |
| Methods inherited from class chrriis.dj.nativeswing.swtimpl.NSPanelComponent |
|---|
constrainVisibility, destroyOnFinalization, disposeNativePeer, getNativeComponent, initialize, initializeNativePeer, isNativePeerDisposed, isNativePeerInitialized, isNativePeerValid, proxyComponentHierarchy, runInSequence |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String COMMAND_LOCATION_PREFIX
public static final String COMMAND_STATUS_PREFIX
| Constructor Detail |
|---|
public JWebBrowser(NSOption... options)
options - the options to configure the behavior of this component.| Method Detail |
|---|
public static NSOption useXULRunnerRuntime()
public static void clearSessionCookies()
public static String getCookie(String url,
String name)
public static void setCookie(String url,
String value)
url - the url.the - value, in a cookie form like:
foo=bar (basic session cookie)
foo=bar; path=/; domain=.eclipse.org (session cookie)
foo=bar; expires=Thu, 01-Jan-2030 00:00:01 GMT (persistent cookie)
foo=; expires=Thu, 01-Jan-1970 00:00:01 GMT (deletes cookie foo)
public static void copyAppearance(JWebBrowser fromWebBrowser,
JWebBrowser toWebBrowser)
fromWebBrowser - the web browser to copy the appearance from.toWebBrowser - the web browser to copy the appearance to.
public static void copyContent(JWebBrowser fromWebBrowser,
JWebBrowser toWebBrowser)
fromWebBrowser - the web browser to copy the content from.toWebBrowser - the web browser to copy the content to.public void setStatusBarVisible(boolean isStatusBarVisible)
isStatusBarVisible - true if the status bar should be visible, false otherwise.public boolean isStatusBarVisible()
public void setMenuBarVisible(boolean isMenuBarVisible)
isMenuBarVisible - true if the menu bar should be visible, false otherwise.public boolean isMenuBarVisible()
public void setButtonBarVisible(boolean isButtonBarVisible)
isButtonBarVisible - true if the button bar should be visible, false otherwise.public boolean isButtonBarVisible()
public void setLocationBarVisible(boolean isLocationBarVisible)
isLocationBarVisible - true if the location bar should be visible, false otherwise.public boolean isLocationBarVisible()
public String getPageTitle()
public String getStatusText()
public String getHTMLContent()
public boolean setHTMLContent(String html)
html - the HTML content.public String getResourceLocation()
public boolean navigate(String resourceLocation)
resourceLocation - the URL or path.
public boolean isBackNavigationEnabled()
public void navigateBack()
public boolean isForwardNavigationEnabled()
public void navigateForward()
public void reloadPage()
public void stopLoading()
public boolean isJavascriptEnabled()
public void setJavascriptEnabled(boolean isJavascriptEnabled)
isJavascriptEnabled - true to enable Javascript, false otherwise.public void executeJavascript(String javascript)
javascript - the javascript to execute.public Object executeJavascriptWithResult(String javascript)
javascript - the javascript to execute which must contain explicit return statements.
public static String createJavascriptFunctionCall(String functionName,
Object... args)
functionName - the name of the Javascript funtion.args - the Java objects (String, number, boolean, or array) which will get converted to Javascript arguments.
public static String convertJavaObjectToJavascript(Object o)
o - the object to convert, which can be a String, number, boolean, or array.public int getLoadingProgress()
public void addWebBrowserListener(WebBrowserListener listener)
listener - The web browser listener to add.public void removeWebBrowserListener(WebBrowserListener listener)
listener - the web browser listener to remove.public WebBrowserListener[] getWebBrowserListeners()
public void setBarsVisible(boolean areBarsVisible)
areBarsVisible - true to show all bars, false to hide them all.public JMenuBar getMenuBar()
public JMenu getFileMenu()
public JWebBrowserWindow getWebBrowserWindow()
public void setDefaultPopupMenuRegistered(boolean isDefaultPopupMenuRegistered)
isDefaultPopupMenuRegistered - true if the default popup menu is registered.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||