Package org.lobobrowser.html
Class AbstractHtmlRendererContext
- java.lang.Object
-
- org.lobobrowser.html.AbstractHtmlRendererContext
-
- All Implemented Interfaces:
HtmlRendererContext
public abstract class AbstractHtmlRendererContext extends java.lang.Object implements HtmlRendererContext
Abstract implementation of theHtmlRendererContextinterface with blank methods, provided for developer convenience.
-
-
Constructor Summary
Constructors Constructor Description AbstractHtmlRendererContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalert(java.lang.String message)Opens an alert dialog.voidback()Goes to the previous page in the browser's history.voidblur()Relinquishes focus.voidclose()Closes the browser window, provided this is allowed for the current context.booleanconfirm(java.lang.String message)Opens a confirmation dialog.BrowserFramecreateBrowserFrame()Creates aBrowserFrameinstance.voidfocus()Requests focus for the current window.voidforward()Goes forward one page.java.lang.StringgetCurrentURL()Gets the current URL in history.java.lang.StringgetDefaultStatus()HTMLCollectiongetFrames()Gets a collection of frames from the document currently in the context.intgetHistoryLength()Gets the number of pages in the history list.HtmlObjectgetHtmlObject(HTMLElement element)Gets aHtmlObjectinstance that implements a OBJECT tag from HTML.java.lang.StringgetName()Gets the window name.java.lang.StringgetNextURL()Gets the next URL in the history.HtmlRendererContextgetOpener()Gets the opener of the frame/window in the current context.HtmlRendererContextgetParent()Gets the parent of the frame/window in the current context.java.lang.StringgetPreviousURL()Gets the previous URL in the history.java.lang.StringgetStatus()Gets the window status text.HtmlRendererContextgetTop()Gets the top-most browser frame/window.UserAgentContextgetUserAgentContext()Gets the user agent context.voidgoToHistoryURL(java.lang.String url)Navigates to a URL in the history list.booleanisClosed()Returns false unless overridden.booleanisImageLoadingEnabled()Returns true unless overridden.booleanisVisitedLink(HTMLLinkElement link)Returns false unless overridden.voidlinkClicked(HTMLElement linkNode, java.net.URL url, java.lang.String target)Performs a link click.voidmoveInHistory(int offset)Navigates the history according to the given offset.voidnavigate(java.net.URL url, java.lang.String target)Navigates to the location given.booleanonContextMenu(HTMLElement element, java.awt.event.MouseEvent event)Returns true unless overridden.booleanonDoubleClick(HTMLElement element, java.awt.event.MouseEvent event)Returns true unless overridden.booleanonMouseClick(HTMLElement element, java.awt.event.MouseEvent event)Returns true unless overridden.voidonMouseOut(HTMLElement element, java.awt.event.MouseEvent event)This method is called when the mouse no longer hovers a given element.voidonMouseOver(HTMLElement element, java.awt.event.MouseEvent event)This method is called when the mouse first hovers over an element.HtmlRendererContextopen(java.lang.String absoluteUrl, java.lang.String windowName, java.lang.String windowFeatures, boolean replace)Opens a separate browser window and renders a URL.HtmlRendererContextopen(java.net.URL url, java.lang.String windowName, java.lang.String windowFeatures, boolean replace)Opens a separate browser window and renders a URL.java.lang.Stringprompt(java.lang.String message, java.lang.String inputDefault)Shows a prompt dialog.voidreload()Reloads the current document.voidresizeBy(int byWidth, int byHeight)Resizes the window.voidresizeTo(int width, int height)Resizes the window.voidscroll(int x, int y)Scrolls the client area.voidscrollBy(int x, int y)Scrolls the client area.voidsetDefaultStatus(java.lang.String value)voidsetOpener(HtmlRendererContext opener)Sets the context that opened the current frame/window.voidsetStatus(java.lang.String message)Sets the window status text.voidsubmitForm(java.lang.String method, java.net.URL action, java.lang.String target, java.lang.String enctype, FormInput[] formInputs)Submits a HTML form.
-
-
-
Method Detail
-
alert
public void alert(java.lang.String message)
Description copied from interface:HtmlRendererContextOpens an alert dialog.- Specified by:
alertin interfaceHtmlRendererContext- Parameters:
message- Message shown by the dialog.
-
back
public void back()
Description copied from interface:HtmlRendererContextGoes to the previous page in the browser's history.- Specified by:
backin interfaceHtmlRendererContext
-
blur
public void blur()
Description copied from interface:HtmlRendererContextRelinquishes focus.- Specified by:
blurin interfaceHtmlRendererContext
-
close
public void close()
Description copied from interface:HtmlRendererContextCloses the browser window, provided this is allowed for the current context.- Specified by:
closein interfaceHtmlRendererContext
-
confirm
public boolean confirm(java.lang.String message)
Description copied from interface:HtmlRendererContextOpens a confirmation dialog.- Specified by:
confirmin interfaceHtmlRendererContext- Parameters:
message- The message shown by the confirmation dialog.- Returns:
- True if the user selects YES.
-
createBrowserFrame
public BrowserFrame createBrowserFrame()
Description copied from interface:HtmlRendererContextCreates aBrowserFrameinstance.- Specified by:
createBrowserFramein interfaceHtmlRendererContext
-
focus
public void focus()
Description copied from interface:HtmlRendererContextRequests focus for the current window.- Specified by:
focusin interfaceHtmlRendererContext
-
getDefaultStatus
public java.lang.String getDefaultStatus()
- Specified by:
getDefaultStatusin interfaceHtmlRendererContext
-
getFrames
public HTMLCollection getFrames()
Description copied from interface:HtmlRendererContextGets a collection of frames from the document currently in the context.- Specified by:
getFramesin interfaceHtmlRendererContext
-
getHtmlObject
public HtmlObject getHtmlObject(HTMLElement element)
Description copied from interface:HtmlRendererContextGets aHtmlObjectinstance that implements a OBJECT tag from HTML.- Specified by:
getHtmlObjectin interfaceHtmlRendererContext- Parameters:
element- The DOM element for the object, which may either represent an OBJECT, EMBED or an APPLET tag.- Returns:
- Implementations of this method must return
nullif they have any problems producing aHtmlObjectinstance. This is particularly true of OBJECT tags, where inner HTML of the tag must be rendered if the OBJECT content cannot be handled.
-
getName
public java.lang.String getName()
Description copied from interface:HtmlRendererContextGets the window name.- Specified by:
getNamein interfaceHtmlRendererContext
-
getOpener
public HtmlRendererContext getOpener()
Description copied from interface:HtmlRendererContextGets the opener of the frame/window in the current context.- Specified by:
getOpenerin interfaceHtmlRendererContext
-
getParent
public HtmlRendererContext getParent()
Description copied from interface:HtmlRendererContextGets the parent of the frame/window in the current context.- Specified by:
getParentin interfaceHtmlRendererContext
-
getStatus
public java.lang.String getStatus()
Description copied from interface:HtmlRendererContextGets the window status text.- Specified by:
getStatusin interfaceHtmlRendererContext
-
getTop
public HtmlRendererContext getTop()
Description copied from interface:HtmlRendererContextGets the top-most browser frame/window.- Specified by:
getTopin interfaceHtmlRendererContext
-
getUserAgentContext
public UserAgentContext getUserAgentContext()
Description copied from interface:HtmlRendererContextGets the user agent context.- Specified by:
getUserAgentContextin interfaceHtmlRendererContext
-
isClosed
public boolean isClosed()
Returns false unless overridden.- Specified by:
isClosedin interfaceHtmlRendererContext
-
isImageLoadingEnabled
public boolean isImageLoadingEnabled()
Returns true unless overridden.- Specified by:
isImageLoadingEnabledin interfaceHtmlRendererContext
-
isVisitedLink
public boolean isVisitedLink(HTMLLinkElement link)
Returns false unless overridden.- Specified by:
isVisitedLinkin interfaceHtmlRendererContext
-
linkClicked
public void linkClicked(HTMLElement linkNode, java.net.URL url, java.lang.String target)
Description copied from interface:HtmlRendererContextPerforms a link click. Implementations should invokeHtmlRendererContext.navigate(URL, String).- Specified by:
linkClickedin interfaceHtmlRendererContext- Parameters:
linkNode- The HTML node that was clicked.url- The destination URL.target- Same as the target attribute in the HTML anchor tag, i.e. _top, _blank, etc.
-
navigate
public void navigate(java.net.URL url, java.lang.String target)Description copied from interface:HtmlRendererContextNavigates to the location given. Implementations should retrieve the URL content, parse it and render it.- Specified by:
navigatein interfaceHtmlRendererContext- Parameters:
url- The destination URL.target- Same as the target attribute in the HTML anchor tag, i.e. _top, _blank, etc.
-
onContextMenu
public boolean onContextMenu(HTMLElement element, java.awt.event.MouseEvent event)
Returns true unless overridden.- Specified by:
onContextMenuin interfaceHtmlRendererContext- Parameters:
element- The narrowest element enclosing the mouse location.event- The mouse event.- Returns:
- The method should return true to continue propagating the event, or false to stop propagating it.
-
onMouseOut
public void onMouseOut(HTMLElement element, java.awt.event.MouseEvent event)
Description copied from interface:HtmlRendererContextThis method is called when the mouse no longer hovers a given element.- Specified by:
onMouseOutin interfaceHtmlRendererContext- Parameters:
element- The element that the mouse has just exited.event- The mouse event.
-
onMouseOver
public void onMouseOver(HTMLElement element, java.awt.event.MouseEvent event)
Description copied from interface:HtmlRendererContextThis method is called when the mouse first hovers over an element.- Specified by:
onMouseOverin interfaceHtmlRendererContext- Parameters:
element- The element that the mouse has just entered.event- The mouse event.
-
open
public HtmlRendererContext open(java.lang.String absoluteUrl, java.lang.String windowName, java.lang.String windowFeatures, boolean replace)
Description copied from interface:HtmlRendererContextOpens a separate browser window and renders a URL.- Specified by:
openin interfaceHtmlRendererContext- Parameters:
absoluteUrl- The URL to be rendered.windowName- The name of the new window.windowFeatures- The features of the new window (same as in Javascript open method).- Returns:
- A new
HtmlRendererContextinstance.
-
open
public HtmlRendererContext open(java.net.URL url, java.lang.String windowName, java.lang.String windowFeatures, boolean replace)
Description copied from interface:HtmlRendererContextOpens a separate browser window and renders a URL.- Specified by:
openin interfaceHtmlRendererContext- Parameters:
url- The URL to be rendered.windowName- The name of the new window.windowFeatures- The features of the new window (same as in Javascript open method).- Returns:
- A new
HtmlRendererContextinstance.
-
prompt
public java.lang.String prompt(java.lang.String message, java.lang.String inputDefault)Description copied from interface:HtmlRendererContextShows a prompt dialog.- Specified by:
promptin interfaceHtmlRendererContext- Parameters:
message- The message shown by the dialog.inputDefault- The default input value.- Returns:
- The user's input value.
-
reload
public void reload()
Description copied from interface:HtmlRendererContextReloads the current document.- Specified by:
reloadin interfaceHtmlRendererContext
-
scroll
public void scroll(int x, int y)Description copied from interface:HtmlRendererContextScrolls the client area.- Specified by:
scrollin interfaceHtmlRendererContext- Parameters:
x- Document's x coordinate.y- Document's y coordinate.
-
setDefaultStatus
public void setDefaultStatus(java.lang.String value)
- Specified by:
setDefaultStatusin interfaceHtmlRendererContext
-
setOpener
public void setOpener(HtmlRendererContext opener)
Description copied from interface:HtmlRendererContextSets the context that opened the current frame/window.- Specified by:
setOpenerin interfaceHtmlRendererContext- Parameters:
opener- AHtmlRendererContext.
-
setStatus
public void setStatus(java.lang.String message)
Description copied from interface:HtmlRendererContextSets the window status text.- Specified by:
setStatusin interfaceHtmlRendererContext- Parameters:
message- A string.
-
submitForm
public void submitForm(java.lang.String method, java.net.URL action, java.lang.String target, java.lang.String enctype, FormInput[] formInputs)Description copied from interface:HtmlRendererContextSubmits a HTML form. Note that when the the method is "GET", parameters are still expected to be part offormInputs.- Specified by:
submitFormin interfaceHtmlRendererContext- Parameters:
method- The request method, GET or POST.action- The destination URL.target- Same as the target attribute in the FORM tag, i.e. _blank, _top, etc.enctype- The encoding type.formInputs- An array ofFormInputinstances.
-
onDoubleClick
public boolean onDoubleClick(HTMLElement element, java.awt.event.MouseEvent event)
Returns true unless overridden.- Specified by:
onDoubleClickin interfaceHtmlRendererContext- Parameters:
element- The narrowest element enclosing the mouse location.event- The mouse event.- Returns:
- The method should return true to continue propagating the event, or false to stop propagating it.
-
onMouseClick
public boolean onMouseClick(HTMLElement element, java.awt.event.MouseEvent event)
Returns true unless overridden.- Specified by:
onMouseClickin interfaceHtmlRendererContext- Parameters:
element- The narrowest element enclosing the mouse location.event- The mouse event.- Returns:
- The method should return true to continue propagating the event, or false to stop propagating it.
-
scrollBy
public void scrollBy(int x, int y)Description copied from interface:HtmlRendererContextScrolls the client area.- Specified by:
scrollByin interfaceHtmlRendererContext- Parameters:
x- Horizontal pixels to scroll.y- Vertical pixels to scroll.
-
resizeBy
public void resizeBy(int byWidth, int byHeight)Description copied from interface:HtmlRendererContextResizes the window.- Specified by:
resizeByin interfaceHtmlRendererContext- Parameters:
byWidth- The number of pixels to resize the width by.byHeight- The number of pixels to resize the height by.
-
resizeTo
public void resizeTo(int width, int height)Description copied from interface:HtmlRendererContextResizes the window.- Specified by:
resizeToin interfaceHtmlRendererContext- Parameters:
width- The new width.height- The new height.
-
forward
public void forward()
Description copied from interface:HtmlRendererContextGoes forward one page.- Specified by:
forwardin interfaceHtmlRendererContext
-
getCurrentURL
public java.lang.String getCurrentURL()
Description copied from interface:HtmlRendererContextGets the current URL in history.- Specified by:
getCurrentURLin interfaceHtmlRendererContext
-
getHistoryLength
public int getHistoryLength()
Description copied from interface:HtmlRendererContextGets the number of pages in the history list.- Specified by:
getHistoryLengthin interfaceHtmlRendererContext
-
getNextURL
public java.lang.String getNextURL()
Description copied from interface:HtmlRendererContextGets the next URL in the history.- Specified by:
getNextURLin interfaceHtmlRendererContext
-
getPreviousURL
public java.lang.String getPreviousURL()
Description copied from interface:HtmlRendererContextGets the previous URL in the history.- Specified by:
getPreviousURLin interfaceHtmlRendererContext
-
goToHistoryURL
public void goToHistoryURL(java.lang.String url)
Description copied from interface:HtmlRendererContextNavigates to a URL in the history list.- Specified by:
goToHistoryURLin interfaceHtmlRendererContext
-
moveInHistory
public void moveInHistory(int offset)
Description copied from interface:HtmlRendererContextNavigates the history according to the given offset.- Specified by:
moveInHistoryin interfaceHtmlRendererContext- Parameters:
offset- A positive or negative number. -1 is equivalent toHtmlRendererContext.back(). +1 is equivalent toHtmlRendererContext.forward().
-
-