Package org.lobobrowser.html
Class AbstractHtmlRendererContext
java.lang.Object
org.lobobrowser.html.AbstractHtmlRendererContext
- All Implemented Interfaces:
HtmlRendererContext
Abstract implementation of the
HtmlRendererContext
interface with
blank methods, provided for developer convenience.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Opens an alert dialog.void
back()
Goes to the previous page in the browser's history.void
blur()
Relinquishes focus.void
close()
Closes the browser window, provided this is allowed for the current context.boolean
Opens a confirmation dialog.Creates aBrowserFrame
instance.void
focus()
Requests focus for the current window.void
forward()
Goes forward one page.Gets the current URL in history.Gets a collection of frames from the document currently in the context.int
Gets the number of pages in the history list.getHtmlObject
(HTMLElement element) Gets aHtmlObject
instance that implements a OBJECT tag from HTML.getName()
Gets the window name.Gets the next URL in the history.Gets the opener of the frame/window in the current context.Gets the parent of the frame/window in the current context.Gets the previous URL in the history.Gets the window status text.getTop()
Gets the top-most browser frame/window.Gets the user agent context.void
goToHistoryURL
(String url) Navigates to a URL in the history list.boolean
isClosed()
Returns false unless overridden.boolean
Returns true unless overridden.boolean
isVisitedLink
(HTMLLinkElement link) Returns false unless overridden.void
linkClicked
(HTMLElement linkNode, URL url, String target) Performs a link click.void
moveInHistory
(int offset) Navigates the history according to the given offset.void
Navigates to the location given.boolean
onContextMenu
(HTMLElement element, MouseEvent event) Returns true unless overridden.boolean
onDoubleClick
(HTMLElement element, MouseEvent event) Returns true unless overridden.boolean
onMouseClick
(HTMLElement element, MouseEvent event) Returns true unless overridden.void
onMouseOut
(HTMLElement element, MouseEvent event) This method is called when the mouse no longer hovers a given element.void
onMouseOver
(HTMLElement element, MouseEvent event) This method is called when the mouse first hovers over an element.Opens a separate browser window and renders a URL.Opens a separate browser window and renders a URL.Shows a prompt dialog.void
reload()
Reloads the current document.void
resizeBy
(int byWidth, int byHeight) Resizes the window.void
resizeTo
(int width, int height) Resizes the window.void
scroll
(int x, int y) Scrolls the client area.void
scrollBy
(int x, int y) Scrolls the client area.void
setDefaultStatus
(String value) void
setOpener
(HtmlRendererContext opener) Sets the context that opened the current frame/window.void
Sets the window status text.void
Submits a HTML form.
-
Constructor Details
-
AbstractHtmlRendererContext
public AbstractHtmlRendererContext()
-
-
Method Details
-
alert
Description copied from interface:HtmlRendererContext
Opens an alert dialog.- Specified by:
alert
in interfaceHtmlRendererContext
- Parameters:
message
- Message shown by the dialog.
-
back
public void back()Description copied from interface:HtmlRendererContext
Goes to the previous page in the browser's history.- Specified by:
back
in interfaceHtmlRendererContext
-
blur
public void blur()Description copied from interface:HtmlRendererContext
Relinquishes focus.- Specified by:
blur
in interfaceHtmlRendererContext
-
close
public void close()Description copied from interface:HtmlRendererContext
Closes the browser window, provided this is allowed for the current context.- Specified by:
close
in interfaceHtmlRendererContext
-
confirm
Description copied from interface:HtmlRendererContext
Opens a confirmation dialog.- Specified by:
confirm
in interfaceHtmlRendererContext
- Parameters:
message
- The message shown by the confirmation dialog.- Returns:
- True if the user selects YES.
-
createBrowserFrame
Description copied from interface:HtmlRendererContext
Creates aBrowserFrame
instance.- Specified by:
createBrowserFrame
in interfaceHtmlRendererContext
-
focus
public void focus()Description copied from interface:HtmlRendererContext
Requests focus for the current window.- Specified by:
focus
in interfaceHtmlRendererContext
-
getDefaultStatus
- Specified by:
getDefaultStatus
in interfaceHtmlRendererContext
-
getFrames
Description copied from interface:HtmlRendererContext
Gets a collection of frames from the document currently in the context.- Specified by:
getFrames
in interfaceHtmlRendererContext
-
getHtmlObject
Description copied from interface:HtmlRendererContext
Gets aHtmlObject
instance that implements a OBJECT tag from HTML.- Specified by:
getHtmlObject
in 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
null
if they have any problems producing aHtmlObject
instance. This is particularly true of OBJECT tags, where inner HTML of the tag must be rendered if the OBJECT content cannot be handled.
-
getName
Description copied from interface:HtmlRendererContext
Gets the window name.- Specified by:
getName
in interfaceHtmlRendererContext
-
getOpener
Description copied from interface:HtmlRendererContext
Gets the opener of the frame/window in the current context.- Specified by:
getOpener
in interfaceHtmlRendererContext
-
getParent
Description copied from interface:HtmlRendererContext
Gets the parent of the frame/window in the current context.- Specified by:
getParent
in interfaceHtmlRendererContext
-
getStatus
Description copied from interface:HtmlRendererContext
Gets the window status text.- Specified by:
getStatus
in interfaceHtmlRendererContext
-
getTop
Description copied from interface:HtmlRendererContext
Gets the top-most browser frame/window.- Specified by:
getTop
in interfaceHtmlRendererContext
-
getUserAgentContext
Description copied from interface:HtmlRendererContext
Gets the user agent context.- Specified by:
getUserAgentContext
in interfaceHtmlRendererContext
-
isClosed
public boolean isClosed()Returns false unless overridden.- Specified by:
isClosed
in interfaceHtmlRendererContext
-
isImageLoadingEnabled
public boolean isImageLoadingEnabled()Returns true unless overridden.- Specified by:
isImageLoadingEnabled
in interfaceHtmlRendererContext
-
isVisitedLink
Returns false unless overridden.- Specified by:
isVisitedLink
in interfaceHtmlRendererContext
-
linkClicked
Description copied from interface:HtmlRendererContext
Performs a link click. Implementations should invokeHtmlRendererContext.navigate(URL, String)
.- Specified by:
linkClicked
in 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.
-
onContextMenu
Returns true unless overridden.- Specified by:
onContextMenu
in 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
Description copied from interface:HtmlRendererContext
This method is called when the mouse no longer hovers a given element.- Specified by:
onMouseOut
in interfaceHtmlRendererContext
- Parameters:
element
- The element that the mouse has just exited.event
- The mouse event.
-
onMouseOver
Description copied from interface:HtmlRendererContext
This method is called when the mouse first hovers over an element.- Specified by:
onMouseOver
in interfaceHtmlRendererContext
- Parameters:
element
- The element that the mouse has just entered.event
- The mouse event.
-
open
public HtmlRendererContext open(String absoluteUrl, String windowName, String windowFeatures, boolean replace) Description copied from interface:HtmlRendererContext
Opens a separate browser window and renders a URL.- Specified by:
open
in 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
HtmlRendererContext
instance.
-
open
Description copied from interface:HtmlRendererContext
Opens a separate browser window and renders a URL.- Specified by:
open
in 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
HtmlRendererContext
instance.
-
prompt
Description copied from interface:HtmlRendererContext
Shows a prompt dialog.- Specified by:
prompt
in 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:HtmlRendererContext
Reloads the current document.- Specified by:
reload
in interfaceHtmlRendererContext
-
scroll
public void scroll(int x, int y) Description copied from interface:HtmlRendererContext
Scrolls the client area.- Specified by:
scroll
in interfaceHtmlRendererContext
- Parameters:
x
- Document's x coordinate.y
- Document's y coordinate.
-
setDefaultStatus
- Specified by:
setDefaultStatus
in interfaceHtmlRendererContext
-
setOpener
Description copied from interface:HtmlRendererContext
Sets the context that opened the current frame/window.- Specified by:
setOpener
in interfaceHtmlRendererContext
- Parameters:
opener
- AHtmlRendererContext
.
-
setStatus
Description copied from interface:HtmlRendererContext
Sets the window status text.- Specified by:
setStatus
in interfaceHtmlRendererContext
- Parameters:
message
- A string.
-
submitForm
public void submitForm(String method, URL action, String target, String enctype, FormInput[] formInputs) Description copied from interface:HtmlRendererContext
Submits a HTML form. Note that when the the method is "GET", parameters are still expected to be part offormInputs
.- Specified by:
submitForm
in 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 ofFormInput
instances.
-
onDoubleClick
Returns true unless overridden.- Specified by:
onDoubleClick
in 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
Returns true unless overridden.- Specified by:
onMouseClick
in 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:HtmlRendererContext
Scrolls the client area.- Specified by:
scrollBy
in interfaceHtmlRendererContext
- Parameters:
x
- Horizontal pixels to scroll.y
- Vertical pixels to scroll.
-
resizeBy
public void resizeBy(int byWidth, int byHeight) Description copied from interface:HtmlRendererContext
Resizes the window.- Specified by:
resizeBy
in 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:HtmlRendererContext
Resizes the window.- Specified by:
resizeTo
in interfaceHtmlRendererContext
- Parameters:
width
- The new width.height
- The new height.
-
forward
public void forward()Description copied from interface:HtmlRendererContext
Goes forward one page.- Specified by:
forward
in interfaceHtmlRendererContext
-
getCurrentURL
Description copied from interface:HtmlRendererContext
Gets the current URL in history.- Specified by:
getCurrentURL
in interfaceHtmlRendererContext
-
getHistoryLength
public int getHistoryLength()Description copied from interface:HtmlRendererContext
Gets the number of pages in the history list.- Specified by:
getHistoryLength
in interfaceHtmlRendererContext
-
getNextURL
Description copied from interface:HtmlRendererContext
Gets the next URL in the history.- Specified by:
getNextURL
in interfaceHtmlRendererContext
-
getPreviousURL
Description copied from interface:HtmlRendererContext
Gets the previous URL in the history.- Specified by:
getPreviousURL
in interfaceHtmlRendererContext
-
goToHistoryURL
Description copied from interface:HtmlRendererContext
Navigates to a URL in the history list.- Specified by:
goToHistoryURL
in interfaceHtmlRendererContext
-
moveInHistory
public void moveInHistory(int offset) Description copied from interface:HtmlRendererContext
Navigates the history according to the given offset.- Specified by:
moveInHistory
in interfaceHtmlRendererContext
- Parameters:
offset
- A positive or negative number. -1 is equivalent toHtmlRendererContext.back()
. +1 is equivalent toHtmlRendererContext.forward()
.
-