org.lobobrowser.html
Class AbstractHtmlRendererContext

java.lang.Object
  extended by org.lobobrowser.html.AbstractHtmlRendererContext
All Implemented Interfaces:
HtmlRendererContext

public abstract class AbstractHtmlRendererContext
extends java.lang.Object
implements HtmlRendererContext

Abstract implementation of the HtmlRendererContext interface with blank methods, provided for developer convenience.


Constructor Summary
AbstractHtmlRendererContext()
           
 
Method Summary
 void alert(java.lang.String message)
          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 confirm(java.lang.String message)
          Opens a confirmation dialog.
 BrowserFrame createBrowserFrame()
          Creates a BrowserFrame instance.
 void focus()
          Requests focus for the current window.
 void forward()
          Goes forward one page.
 java.lang.String getCurrentURL()
          Gets the current URL in history.
 java.lang.String getDefaultStatus()
           
 org.w3c.dom.html2.HTMLCollection getFrames()
          Gets a collection of frames from the document currently in the context.
 int getHistoryLength()
          Gets the number of pages in the history list.
 HtmlObject getHtmlObject(org.w3c.dom.html2.HTMLElement element)
          Gets a HtmlObject instance that implements a OBJECT tag from HTML.
 java.lang.String getName()
          Gets the window name.
 java.lang.String getNextURL()
          Gets the next URL in the history.
 HtmlRendererContext getOpener()
          Gets the opener of the frame/window in the current context.
 HtmlRendererContext getParent()
          Gets the parent of the frame/window in the current context.
 java.lang.String getPreviousURL()
          Gets the previous URL in the history.
 java.lang.String getStatus()
          Gets the window status text.
 HtmlRendererContext getTop()
          Gets the top-most browser frame/window.
 UserAgentContext getUserAgentContext()
          Gets the user agent context.
 void goToHistoryURL(java.lang.String url)
          Navigates to a URL in the history list.
 boolean isClosed()
          Returns false unless overridden.
 boolean isImageLoadingEnabled()
          Returns true unless overridden.
 boolean isVisitedLink(org.w3c.dom.html2.HTMLLinkElement link)
          Returns false unless overridden.
 void linkClicked(org.w3c.dom.html2.HTMLElement linkNode, java.net.URL url, java.lang.String target)
          Performs a link click.
 void moveInHistory(int offset)
          Navigates the history according to the given offset.
 void navigate(java.net.URL url, java.lang.String target)
          Navigates to the location given.
 boolean onContextMenu(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
          Returns true unless overridden.
 boolean onDoubleClick(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
          Returns true unless overridden.
 boolean onMouseClick(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
          Returns true unless overridden.
 void onMouseOut(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
          This method is called when the mouse no longer hovers a given element.
 void onMouseOver(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
          This method is called when the mouse first hovers over an element.
 HtmlRendererContext open(java.lang.String absoluteUrl, java.lang.String windowName, java.lang.String windowFeatures, boolean replace)
          Opens a separate browser window and renders a URL.
 HtmlRendererContext open(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.String prompt(java.lang.String message, java.lang.String inputDefault)
          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(java.lang.String value)
           
 void setOpener(HtmlRendererContext opener)
          Sets the context that opened the current frame/window.
 void setStatus(java.lang.String message)
          Sets the window status text.
 void submitForm(java.lang.String method, java.net.URL action, java.lang.String target, java.lang.String enctype, FormInput[] formInputs)
          Submits a HTML form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHtmlRendererContext

public AbstractHtmlRendererContext()
Method Detail

alert

public void alert(java.lang.String message)
Description copied from interface: HtmlRendererContext
Opens an alert dialog.

Specified by:
alert in interface HtmlRendererContext
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 interface HtmlRendererContext

blur

public void blur()
Description copied from interface: HtmlRendererContext
Relinquishes focus.

Specified by:
blur in interface HtmlRendererContext

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 interface HtmlRendererContext

confirm

public boolean confirm(java.lang.String message)
Description copied from interface: HtmlRendererContext
Opens a confirmation dialog.

Specified by:
confirm in interface HtmlRendererContext
Parameters:
message - The message shown by the confirmation dialog.
Returns:
True if the user selects YES.

createBrowserFrame

public BrowserFrame createBrowserFrame()
Description copied from interface: HtmlRendererContext
Creates a BrowserFrame instance.

Specified by:
createBrowserFrame in interface HtmlRendererContext

focus

public void focus()
Description copied from interface: HtmlRendererContext
Requests focus for the current window.

Specified by:
focus in interface HtmlRendererContext

getDefaultStatus

public java.lang.String getDefaultStatus()
Specified by:
getDefaultStatus in interface HtmlRendererContext

getFrames

public org.w3c.dom.html2.HTMLCollection getFrames()
Description copied from interface: HtmlRendererContext
Gets a collection of frames from the document currently in the context.

Specified by:
getFrames in interface HtmlRendererContext

getHtmlObject

public HtmlObject getHtmlObject(org.w3c.dom.html2.HTMLElement element)
Description copied from interface: HtmlRendererContext
Gets a HtmlObject instance that implements a OBJECT tag from HTML.

Specified by:
getHtmlObject in interface HtmlRendererContext
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 a HtmlObject 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

public java.lang.String getName()
Description copied from interface: HtmlRendererContext
Gets the window name.

Specified by:
getName in interface HtmlRendererContext

getOpener

public HtmlRendererContext getOpener()
Description copied from interface: HtmlRendererContext
Gets the opener of the frame/window in the current context.

Specified by:
getOpener in interface HtmlRendererContext

getParent

public HtmlRendererContext getParent()
Description copied from interface: HtmlRendererContext
Gets the parent of the frame/window in the current context.

Specified by:
getParent in interface HtmlRendererContext

getStatus

public java.lang.String getStatus()
Description copied from interface: HtmlRendererContext
Gets the window status text.

Specified by:
getStatus in interface HtmlRendererContext

getTop

public HtmlRendererContext getTop()
Description copied from interface: HtmlRendererContext
Gets the top-most browser frame/window.

Specified by:
getTop in interface HtmlRendererContext

getUserAgentContext

public UserAgentContext getUserAgentContext()
Description copied from interface: HtmlRendererContext
Gets the user agent context.

Specified by:
getUserAgentContext in interface HtmlRendererContext

isClosed

public boolean isClosed()
Returns false unless overridden.

Specified by:
isClosed in interface HtmlRendererContext

isImageLoadingEnabled

public boolean isImageLoadingEnabled()
Returns true unless overridden.

Specified by:
isImageLoadingEnabled in interface HtmlRendererContext

isVisitedLink

public boolean isVisitedLink(org.w3c.dom.html2.HTMLLinkElement link)
Returns false unless overridden.

Specified by:
isVisitedLink in interface HtmlRendererContext

linkClicked

public void linkClicked(org.w3c.dom.html2.HTMLElement linkNode,
                        java.net.URL url,
                        java.lang.String target)
Description copied from interface: HtmlRendererContext
Performs a link click. Implementations should invoke HtmlRendererContext.navigate(URL, String).

Specified by:
linkClicked in interface HtmlRendererContext
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: HtmlRendererContext
Navigates to the location given. Implementations should retrieve the URL content, parse it and render it.

Specified by:
navigate in interface HtmlRendererContext
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(org.w3c.dom.html2.HTMLElement element,
                             java.awt.event.MouseEvent event)
Returns true unless overridden.

Specified by:
onContextMenu in interface HtmlRendererContext
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(org.w3c.dom.html2.HTMLElement element,
                       java.awt.event.MouseEvent event)
Description copied from interface: HtmlRendererContext
This method is called when the mouse no longer hovers a given element.

Specified by:
onMouseOut in interface HtmlRendererContext
Parameters:
element - The element that the mouse has just exited.
event - The mouse event.

onMouseOver

public void onMouseOver(org.w3c.dom.html2.HTMLElement element,
                        java.awt.event.MouseEvent event)
Description copied from interface: HtmlRendererContext
This method is called when the mouse first hovers over an element.

Specified by:
onMouseOver in interface HtmlRendererContext
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: HtmlRendererContext
Opens a separate browser window and renders a URL.

Specified by:
open in interface HtmlRendererContext
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

public HtmlRendererContext open(java.net.URL url,
                                java.lang.String windowName,
                                java.lang.String windowFeatures,
                                boolean replace)
Description copied from interface: HtmlRendererContext
Opens a separate browser window and renders a URL.

Specified by:
open in interface HtmlRendererContext
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

public java.lang.String prompt(java.lang.String message,
                               java.lang.String inputDefault)
Description copied from interface: HtmlRendererContext
Shows a prompt dialog.

Specified by:
prompt in interface HtmlRendererContext
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 interface HtmlRendererContext

scroll

public void scroll(int x,
                   int y)
Description copied from interface: HtmlRendererContext
Scrolls the client area.

Specified by:
scroll in interface HtmlRendererContext
Parameters:
x - Document's x coordinate.
y - Document's y coordinate.

setDefaultStatus

public void setDefaultStatus(java.lang.String value)
Specified by:
setDefaultStatus in interface HtmlRendererContext

setOpener

public void setOpener(HtmlRendererContext opener)
Description copied from interface: HtmlRendererContext
Sets the context that opened the current frame/window.

Specified by:
setOpener in interface HtmlRendererContext
Parameters:
opener - A HtmlRendererContext.

setStatus

public void setStatus(java.lang.String message)
Description copied from interface: HtmlRendererContext
Sets the window status text.

Specified by:
setStatus in interface HtmlRendererContext
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: HtmlRendererContext
Submits a HTML form. Note that when the the method is "GET", parameters are still expected to be part of formInputs.

Specified by:
submitForm in interface HtmlRendererContext
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 of FormInput instances.

onDoubleClick

public boolean onDoubleClick(org.w3c.dom.html2.HTMLElement element,
                             java.awt.event.MouseEvent event)
Returns true unless overridden.

Specified by:
onDoubleClick in interface HtmlRendererContext
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(org.w3c.dom.html2.HTMLElement element,
                            java.awt.event.MouseEvent event)
Returns true unless overridden.

Specified by:
onMouseClick in interface HtmlRendererContext
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 interface HtmlRendererContext
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 interface HtmlRendererContext
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 interface HtmlRendererContext
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 interface HtmlRendererContext

getCurrentURL

public java.lang.String getCurrentURL()
Description copied from interface: HtmlRendererContext
Gets the current URL in history.

Specified by:
getCurrentURL in interface HtmlRendererContext

getHistoryLength

public int getHistoryLength()
Description copied from interface: HtmlRendererContext
Gets the number of pages in the history list.

Specified by:
getHistoryLength in interface HtmlRendererContext

getNextURL

public java.lang.String getNextURL()
Description copied from interface: HtmlRendererContext
Gets the next URL in the history.

Specified by:
getNextURL in interface HtmlRendererContext

getPreviousURL

public java.lang.String getPreviousURL()
Description copied from interface: HtmlRendererContext
Gets the previous URL in the history.

Specified by:
getPreviousURL in interface HtmlRendererContext

goToHistoryURL

public void goToHistoryURL(java.lang.String url)
Description copied from interface: HtmlRendererContext
Navigates to a URL in the history list.

Specified by:
goToHistoryURL in interface HtmlRendererContext

moveInHistory

public void moveInHistory(int offset)
Description copied from interface: HtmlRendererContext
Navigates the history according to the given offset.

Specified by:
moveInHistory in interface HtmlRendererContext
Parameters:
offset - A positive or negative number. -1 is equivalent to HtmlRendererContext.back(). +1 is equivalent to HtmlRendererContext.forward().


SourceForge.net LogoCopyright © 2005, 2006, 2007 The Lobo Project. All Rights Reserved.
[Cobra Project Home]