|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HtmlRendererContext
The HtmlRendererContext
interface must be implemented
in order to use the Cobra HTML renderer. An instance of this interface
will be called back whenever the renderer needs to perform an action that
it is not designed to know how to perform on its own, e.g. opening a browser window
or a context menu. In many ways this
interface parallers the Javascript Window
class (which
in reality represents a browser frame, not a window).
A simple implementation of this interface is provided in
SimpleHtmlRendererContext
.
HtmlPanel.setDocument(org.w3c.dom.Document, HtmlRendererContext)
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()
Gets a value indicating if the window is closed. |
boolean |
isImageLoadingEnabled()
This method should return true if and only if image loading needs to be enabled. |
boolean |
isVisitedLink(org.w3c.dom.html2.HTMLLinkElement link)
It should return true if the link provided has been visited. |
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)
This method is called when a visual element is right-clicked. |
boolean |
onDoubleClick(org.w3c.dom.html2.HTMLElement element,
java.awt.event.MouseEvent event)
This method is called when there's a mouse double-click on an element. |
boolean |
onMouseClick(org.w3c.dom.html2.HTMLElement element,
java.awt.event.MouseEvent event)
This method is called when there's a mouse click on an element. |
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)
Deprecated. Use open(URL, String, String, boolean) instead. |
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. |
Method Detail |
---|
void navigate(java.net.URL url, java.lang.String target)
url
- The destination URL.target
- Same as the target attribute in the HTML anchor tag, i.e. _top, _blank, etc.void linkClicked(org.w3c.dom.html2.HTMLElement linkNode, java.net.URL url, java.lang.String target)
navigate(URL, String)
.
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.org.w3c.dom.html2.HTMLCollection getFrames()
void submitForm(java.lang.String method, java.net.URL action, java.lang.String target, java.lang.String enctype, FormInput[] formInputs)
formInputs
.
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.BrowserFrame createBrowserFrame()
BrowserFrame
instance.
UserAgentContext getUserAgentContext()
HtmlObject getHtmlObject(org.w3c.dom.html2.HTMLElement element)
HtmlObject
instance that implements
a OBJECT tag from HTML.
element
- The DOM element for the object, which may
either represent an OBJECT, EMBED or an APPLET tag.
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.boolean onContextMenu(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
element
- The narrowest element enclosing the mouse location.event
- The mouse event.
boolean onMouseClick(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
element
- The narrowest element enclosing the mouse location.event
- The mouse event.
boolean onDoubleClick(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
element
- The narrowest element enclosing the mouse location.event
- The mouse event.
void onMouseOver(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
element
- The element that the mouse has just entered.event
- The mouse event.void onMouseOut(org.w3c.dom.html2.HTMLElement element, java.awt.event.MouseEvent event)
element
- The element that the mouse has just exited.event
- The mouse event.boolean isImageLoadingEnabled()
void alert(java.lang.String message)
message
- Message shown by the dialog.void back()
void blur()
void close()
boolean confirm(java.lang.String message)
message
- The message shown by the confirmation dialog.
void focus()
HtmlRendererContext open(java.lang.String absoluteUrl, java.lang.String windowName, java.lang.String windowFeatures, boolean replace)
open(URL, String, String, boolean)
instead.
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).replace
-
HtmlRendererContext
instance.HtmlRendererContext open(java.net.URL url, java.lang.String windowName, java.lang.String windowFeatures, boolean replace)
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).replace
-
HtmlRendererContext
instance.java.lang.String prompt(java.lang.String message, java.lang.String inputDefault)
message
- The message shown by the dialog.inputDefault
- The default input value.
void scroll(int x, int y)
x
- Document's x coordinate.y
- Document's y coordinate.void scrollBy(int x, int y)
x
- Horizontal pixels to scroll.y
- Vertical pixels to scroll.void resizeTo(int width, int height)
width
- The new width.height
- The new height.void resizeBy(int byWidth, int byHeight)
byWidth
- The number of pixels to resize the width by.byHeight
- The number of pixels to resize the height by.boolean isClosed()
java.lang.String getDefaultStatus()
void setDefaultStatus(java.lang.String value)
java.lang.String getName()
HtmlRendererContext getParent()
HtmlRendererContext getOpener()
void setOpener(HtmlRendererContext opener)
opener
- A HtmlRendererContext
.java.lang.String getStatus()
void setStatus(java.lang.String message)
message
- A string.HtmlRendererContext getTop()
boolean isVisitedLink(org.w3c.dom.html2.HTMLLinkElement link)
void reload()
int getHistoryLength()
java.lang.String getCurrentURL()
java.lang.String getNextURL()
java.lang.String getPreviousURL()
void forward()
void moveInHistory(int offset)
offset
- A positive or negative number. -1 is
equivalent to back()
. +1 is
equivalent to forward()
.void goToHistoryURL(java.lang.String url)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |