|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface WebBrowser
Interface to an embedded web browser. Use WebBrowserFactory to create browser instances.
RequestListener
,
StatusChangeListener
,
TitleChangeListener
,
ContextMenuListener
,
ContentHandler
,
WebBrowserPrinting
,
ClipboardSupport
,
BrowserAttributes
,
BadCertificateHandler
Method Summary | |
---|---|
void |
activate()
Make browser component active. |
void |
addContentHandler(ContentHandler contentHandler)
Register an object that can observe and intercept document loading based on content type. |
void |
addContextMenuListener(ContextMenuListener listener)
|
void |
addHistoryChangeListener(HistoryChangeListener listener)
Adds browser history change event listener |
void |
addRequestListener(RequestListener listener)
Adds browser progress event listener. |
void |
addStatusChangeListener(StatusChangeListener listener)
|
void |
addTitleChangeListener(TitleChangeListener listener)
|
void |
deactivate()
Make browser component inactive. |
void |
displayAsSource(boolean asSource)
Switch browser to display source mode |
void |
dispose()
Releases resources associated with this browser. |
java.lang.String |
evaluateScript(java.lang.String scriptString)
Evaluate the script |
boolean |
findString(java.lang.String searchString)
Search specific string in current document |
AsyncHandlerFactory |
getAsyncHandler()
Returns current asynchronous operation handler of this browser object |
BrowserAttributes |
getAttributes()
Returns current browser attributes |
boolean |
getCanGoBack()
Deprecated. |
boolean |
getCanGoForward()
Deprecated. |
ClipboardSupport |
getClipboardSupport()
Returns interface for interact with the system-wide OS clipboard. |
java.awt.Component |
getComponent()
Returns the AWT component that is hosting this web browser. |
org.w3c.dom.Document |
getDocument()
Returns the DOM document wrapper for the document that is currently loaded in the browser. |
java.lang.String |
getDocumentContent(java.lang.String contentType)
Returns browser document content as a string. |
WebBrowserHistory |
getHistory()
Returns the browser navigation history. |
java.lang.String |
getLocationURL()
Returns the URL of the resource that Mozilla web browser is currently displaying. |
WebBrowserPrinting |
getPrinting()
Return the printing API for this web browser instance |
java.lang.String |
getTitle()
Return the title of the browser. |
void |
goBack()
Navigates backward one item in the history list. |
void |
goForward()
Navigates forward one item in the history list. |
boolean |
isDisposed()
Return disposed state |
void |
navigate(java.lang.String url)
Navigates to a resource specified by a URL or to the file identified by a full path. |
void |
navigate(java.lang.String url,
java.lang.String postData)
Navigates to a resource specified by a URL or to the file identified by a full path. |
void |
pageDown()
Scroll content down to one page |
void |
pageUp()
Scroll content up to one page |
void |
refresh()
Reloads the file that is currently displayed in the object. |
void |
removeContextMenuListener(ContextMenuListener listener)
|
void |
removeHistoryChangeListener(HistoryChangeListener listener)
Removes history change event listener |
void |
removeRequestListener(RequestListener listener)
Removes browser progress event listener. |
void |
removeStatusChangeListener(StatusChangeListener listener)
|
void |
removeTitleChangeListener(TitleChangeListener listener)
|
void |
resetBadCertificateHandler(BadCertificateHandler newCertificateHandler)
Reset the default BadCertificateHandler |
void |
saveCurrentDocument(java.io.File file,
RequestListener requestListener)
Save the current loaded document in to file. |
void |
saveURLtoFile(java.net.URL url,
java.io.File file,
RequestListener extendedListener)
Save URL in to local file |
void |
setAsyncHandler(AsyncHandlerFactory handler)
Set a handler that will be used for all asynchronous invocations within this browser object. |
void |
setAttributes(BrowserAttributes attributes)
Apply new browser attributes |
void |
setContent(java.lang.String content,
java.lang.String contentType)
Shows specified content |
void |
setContent(java.lang.String content,
java.lang.String contentType,
java.lang.String charset)
Shows specified content |
void |
setContentWithContext(java.lang.String content,
java.lang.String contentType,
java.lang.String contextURI)
Shows specified content. |
void |
setFocusAtFirstElement()
Set focus at first element. |
void |
setWindowCreator(WindowCreator childWindowCreator)
Sets the implementation of the window creation for this browser. |
void |
showOpenFileDialog()
Show open file dialog, and open the file. |
void |
showSaveFileDialog()
Show save file dialog, and save the file. |
void |
stop()
Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations. |
java.awt.image.BufferedImage |
toImage()
Return the image of the currently loaded web page or null
when it's impossible to create an image of the web page. |
Method Detail |
---|
void navigate(java.lang.String url)
url
- URL to navigate to.void navigate(java.lang.String url, java.lang.String postData)
Content-Type
header will be set to
application/x-www-form-urlencoded
and the
Content-Length
header will be set to the post data length.
url
- URL to navigate to.postData
- HTTP post data in the form
name1=value1&name2=value2
.void setContent(java.lang.String content, java.lang.String contentType)
content
- content. Can be HTML.contentType
- content MIME Type. Should be text/html for HTML content.
If null, contentType is set up to the text/html type.void setContent(java.lang.String content, java.lang.String contentType, java.lang.String charset)
content
- content. Can be HTML.contentType
- content MIME Type. Should be text/html for HTML content.
If null, contentType is set up to the text/html type.charset
- charset of the content.
If null, charset is set up to the UTF-8void setContentWithContext(java.lang.String content, java.lang.String contentType, java.lang.String contextURI)
content
- content. Can be HTML.contentType
- content MIME Type. Should be text/html for HTML content.contextURI
- the URI that is used as a context for external reference
resolution.java.lang.String getLocationURL()
java.lang.String getTitle()
void goForward()
void goBack()
@Deprecated boolean getCanGoBack()
@Deprecated boolean getCanGoForward()
void stop()
void refresh()
boolean findString(java.lang.String searchString)
searchString
- string to find
void addRequestListener(RequestListener listener)
listener
- browser event listener.void removeRequestListener(RequestListener listener)
listener
- browser event listener.void addStatusChangeListener(StatusChangeListener listener)
listener
- status change listenervoid removeStatusChangeListener(StatusChangeListener listener)
listener
- status change listenervoid addTitleChangeListener(TitleChangeListener listener)
listener
- title change listenervoid removeTitleChangeListener(TitleChangeListener listener)
listener
- title change listenervoid addContextMenuListener(ContextMenuListener listener)
listener
- context menu listenervoid removeContextMenuListener(ContextMenuListener listener)
listener
- context menu listenervoid addHistoryChangeListener(HistoryChangeListener listener)
void removeHistoryChangeListener(HistoryChangeListener listener)
listener
- history change listener listenerjava.awt.Component getComponent()
void setWindowCreator(WindowCreator childWindowCreator)
childWindowCreator
- window creator instanceorg.w3c.dom.Document getDocument()
NOTE: it is recommended to perform all operations on this object from within the XPCOM event dispatching thread.
WebBrowserHistory getHistory()
void dispose()
boolean isDisposed()
void activate()
void deactivate()
java.lang.String evaluateScript(java.lang.String scriptString)
scriptString
-
void setAsyncHandler(AsyncHandlerFactory handler)
AsyncHandlerFactory getAsyncHandler()
void saveURLtoFile(java.net.URL url, java.io.File file, RequestListener extendedListener)
url
- URL to object what you want to save;file
- local file where object can be saved;extendedListener
- - this listener can be used to notify any GUI object (as
JProgress bar), or something else different object, to saving
data progress. This parameter is optional if you did't need
any notification of saving progress (for example if file size
is to little and load very fast) you can set this parameter to
null. Otherwise you need implement this interface yourself (
for example see the realization of SaveImageAction class in
com.teamdev.xpcom.mozilla.demo.JxBrowserDemo.java).void saveCurrentDocument(java.io.File file, RequestListener requestListener)
file
- local file where object can be saved;requestListener
- - this listener can be used to notify any GUI object (as
JProgress bar), or something else different object, to saving
data progress. This parameter is optional if you did't need
any notification of saving progress (for example if file size
is to little and load very fast) you can set this parameter to
null. Otherwise you need implement this interface yourselfvoid showOpenFileDialog()
void showSaveFileDialog()
void addContentHandler(ContentHandler contentHandler)
contentHandler
- content handler implementationvoid resetBadCertificateHandler(BadCertificateHandler newCertificateHandler)
newCertificateHandler
- new BadCertificateHandlerClipboardSupport getClipboardSupport()
WebBrowserPrinting getPrinting()
void setFocusAtFirstElement()
void setAttributes(BrowserAttributes attributes)
attributes
- the attributes structureBrowserAttributes getAttributes()
void displayAsSource(boolean asSource)
asSource
- TODOjava.lang.String getDocumentContent(java.lang.String contentType)
contentType
- content type specification or null for defaultvoid pageUp()
void pageDown()
java.awt.image.BufferedImage toImage()
null
when it's impossible to create an image of the web page. Before
invoking this method please make sure that the web page is loaded
completely. To make sure that the web page is loaded completely
use the StateEvent.isLoadingCompleted
property in the
RequestListener.stateChanged
event.
null
.StateEvent
,
RequestListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |