Package org.loboevolution.gui
Class LocalHtmlRendererContext
java.lang.Object
org.loboevolution.gui.LocalHtmlRendererContext
- All Implemented Interfaces:
HtmlRendererContext
-
Field Summary
-
Constructor Summary
ConstructorDescriptionLocalHtmlRendererContext
(HtmlPanel htmlPanel, UserAgentContext ucontext) Constructs a HtmlRendererContextImpl. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Opens a simple message dialog.void
back()
It should navigate back one page.void
blur()
It should give up focus on the current browser window.void
close()
It should close the current browser window.boolean
Opens a simple confirmation window.void
error.void
error.void
focus()
It should request focus for the current browser window.void
forward()
forward.Gets the current URL in history.Should return true if and only if the current browser window is closed.int
getHistoryLength.Getter for the field htmlPanel.int
getInnerHeight.int
getInnerWidth.getNextURL.Getter for the field opener.int
getOuterHeight.int
getOuterWidth.Getter parent.getPreviousURL.double
double
getStatus.getTop()
Getter top.If aUserAgentContext
instance was provided in the constructor, then that instance is returned.boolean
isClosed()
Should return true if and only if the current browser window is closed.boolean
isTest.boolean
isVisitedLink.void
linkClicked
(URL url, boolean isNewTab) Implements the link click.void
moveInHistory
(int offset) moveInHistory.void
Convenience method provided to allow loading a document into the renderer.void
Implements simple navigation with incremental rendering by invokingHtmlRendererContext.submitForm(String, URL, String, String, FormInput[])
with a GET request method.boolean
onContextMenu
(HTMLElement element, MouseEvent event) This method must be overridden to implement a context menu.It should open a new browser window.void
openImageViewer
(String fullURL, InputStream stream) openImageViewer.void
openImageViewer
(URL srcUrl) openImageViewer.Shows a simple prompt dialog.void
reload()
Implements reload as navigation to current URL.void
resizeBy
(double byWidth, double byHeight) resizeBy.void
resizeTo
(double width, double height) resizeTo.void
scroll
(double x, double y) Changes the origin of the HTML block's scrollable area according to the position given.void
scrollBy
(double x, double y) scrollBy.void
setCursor.void
setDefaultStatus
(String message) setDefaultStatus.void
setHtmlPanel
(HtmlPanel panel) Setter for the field htmlPanel.void
setOpener
(HtmlRendererContext opener) Setter for the field opener.void
setScrollx
(double scrollx) void
setScrolly
(double scrolly) void
setStatus.void
Implements simple navigation and form submission with incremental rendering and target processing, including frame lookup.void
warn.void
warn.
-
Field Details
-
currentConnection
-
-
Constructor Details
-
LocalHtmlRendererContext
Constructs a HtmlRendererContextImpl.- Parameters:
htmlPanel
- aHtmlPanel
object.ucontext
- aUserAgentContext
object.
-
-
Method Details
-
alert
Opens a simple message dialog.- Specified by:
alert
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.
-
back
public void back()It should navigate back one page. This implementation does nothing and should be overridden.- Specified by:
back
in interfaceHtmlRendererContext
-
blur
public void blur()It should give up focus on the current browser window. This implementation does nothing and should be overridden.- Specified by:
blur
in interfaceHtmlRendererContext
-
close
public void close()It should close the current browser window. This implementation does nothing and should be overridden.- Specified by:
close
in interfaceHtmlRendererContext
-
confirm
Opens a simple confirmation window.- Specified by:
confirm
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.- Returns:
- a boolean.
-
error
error.
- Specified by:
error
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.
-
error
error.
- Specified by:
error
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.throwable
- aThrowable
object.
-
focus
public void focus()It should request focus for the current browser window. This implementation does nothing and should be overridden.- Specified by:
focus
in interfaceHtmlRendererContext
-
forward
public void forward()forward.
- Specified by:
forward
in interfaceHtmlRendererContext
-
getCurrentURL
Gets the current URL in history.- Specified by:
getCurrentURL
in interfaceHtmlRendererContext
-
getDefaultStatus
Should return true if and only if the current browser window is closed. This implementation returns false and should be overridden.- Specified by:
getDefaultStatus
in interfaceHtmlRendererContext
- Returns:
- a
String
object.
-
getHtmlPanel
Getter for the field htmlPanel.
- Specified by:
getHtmlPanel
in interfaceHtmlRendererContext
-
getOpener
Getter for the field opener.
- Specified by:
getOpener
in interfaceHtmlRendererContext
- Returns:
- a
HtmlRendererContext
object.
-
getParent
Getter parent.
- Specified by:
getParent
in interfaceHtmlRendererContext
- Returns:
- a
HtmlRendererContext
object.
-
getTop
Getter top.
- Specified by:
getTop
in interfaceHtmlRendererContext
- Returns:
- a
HtmlRendererContext
object.
-
getUserAgentContext
If aUserAgentContext
instance was provided in the constructor, then that instance is returned. Otherwise, an instance ofUserAgentContext
is created and returned.The context returned by this method is used by local request facilities and other parts of the renderer.
- Specified by:
getUserAgentContext
in interfaceHtmlRendererContext
-
isClosed
public boolean isClosed()Should return true if and only if the current browser window is closed. This implementation returns false and should be overridden.- Specified by:
isClosed
in interfaceHtmlRendererContext
- Returns:
- a boolean.
-
isVisitedLink
isVisitedLink.
- Specified by:
isVisitedLink
in interfaceHtmlRendererContext
- Parameters:
link
- aHTMLAnchorElement
object.- Returns:
- a boolean.
-
linkClicked
Implements the link click.- Specified by:
linkClicked
in interfaceHtmlRendererContext
-
moveInHistory
public void moveInHistory(int offset) moveInHistory.
- Specified by:
moveInHistory
in interfaceHtmlRendererContext
- Parameters:
offset
- aInteger
object.
-
getPreviousURL
getPreviousURL.
- Specified by:
getPreviousURL
in interfaceHtmlRendererContext
- Returns:
- a
String
object.
-
getNextURL
getNextURL.
- Specified by:
getNextURL
in interfaceHtmlRendererContext
- Returns:
- a
String
object.
-
getHistoryLength
public int getHistoryLength()getHistoryLength.
- Specified by:
getHistoryLength
in interfaceHtmlRendererContext
- Returns:
- a
Integer
object.
-
getStatus
Description copied from interface:HtmlRendererContext
getStatus.
- Specified by:
getStatus
in interfaceHtmlRendererContext
- Returns:
- a
String
object.
-
onContextMenu
This method must be overridden to implement a context menu.- Specified by:
onContextMenu
in interfaceHtmlRendererContext
- Parameters:
element
- aHTMLElement
object.event
- aMouseEvent
object.- Returns:
- a boolean.
-
open
It should open a new browser window. This implementation does nothing and should be overridden.- Specified by:
open
in interfaceHtmlRendererContext
- Parameters:
url
- The requested URL.windowName
- A window identifier.windowFeatures
- WindowImpl features specified in a format equivalent to that of window.open() in Javascript.replace
- Whether an existing window with the same name should be replaced.- Returns:
- a
HtmlRendererContext
object.
-
openImageViewer
openImageViewer.
- Specified by:
openImageViewer
in interfaceHtmlRendererContext
- Parameters:
srcUrl
- aURL
object.
-
openImageViewer
openImageViewer.
- Specified by:
openImageViewer
in interfaceHtmlRendererContext
- Parameters:
fullURL
- aString
object.stream
- aInputStream
object.
-
prompt
Shows a simple prompt dialog.- Specified by:
prompt
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.inputDefault
- aString
object.- Returns:
- a
String
object.
-
reload
public void reload()Implements reload as navigation to current URL. Override to implement a more robust reloading mechanism.- Specified by:
reload
in interfaceHtmlRendererContext
-
resizeBy
public void resizeBy(double byWidth, double byHeight) resizeBy.
- Specified by:
resizeBy
in interfaceHtmlRendererContext
- Parameters:
byWidth
- aDouble
object.byHeight
- aDouble
object.
-
resizeTo
public void resizeTo(double width, double height) resizeTo.
- Specified by:
resizeTo
in interfaceHtmlRendererContext
- Parameters:
width
- aDouble
object.height
- aDouble
object.
-
getInnerHeight
public int getInnerHeight()getInnerHeight.
- Specified by:
getInnerHeight
in interfaceHtmlRendererContext
-
getInnerWidth
public int getInnerWidth()getInnerWidth.
- Specified by:
getInnerWidth
in interfaceHtmlRendererContext
-
getOuterHeight
public int getOuterHeight()getOuterHeight.
- Specified by:
getOuterHeight
in interfaceHtmlRendererContext
-
getOuterWidth
public int getOuterWidth()getOuterWidth.
- Specified by:
getOuterWidth
in interfaceHtmlRendererContext
-
scroll
public void scroll(double x, double y) Changes the origin of the HTML block's scrollable area according to the position given.This method may be called outside of the GUI thread. The operation is scheduled immediately in that thread as needed.
- Specified by:
scroll
in interfaceHtmlRendererContext
- Parameters:
x
- The new x coordinate for the origin.y
- The new y coordinate for the origin.
-
scrollBy
public void scrollBy(double x, double y) scrollBy.
- Specified by:
scrollBy
in interfaceHtmlRendererContext
- Parameters:
x
- aDouble
object.y
- aDouble
object.
-
getScrollx
public double getScrollx()- Specified by:
getScrollx
in interfaceHtmlRendererContext
-
setScrollx
public void setScrollx(double scrollx) - Specified by:
setScrollx
in interfaceHtmlRendererContext
-
getScrolly
public double getScrolly()- Specified by:
getScrolly
in interfaceHtmlRendererContext
-
setScrolly
public void setScrolly(double scrolly) - Specified by:
setScrolly
in interfaceHtmlRendererContext
-
setDefaultStatus
setDefaultStatus.
- Specified by:
setDefaultStatus
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.
-
setHtmlPanel
Setter for the field htmlPanel.
- Specified by:
setHtmlPanel
in interfaceHtmlRendererContext
- Parameters:
panel
- aHtmlPanel
object.
-
setOpener
Setter for the field opener.
- Specified by:
setOpener
in interfaceHtmlRendererContext
- Parameters:
opener
- aHtmlRendererContext
object.
-
setStatus
setStatus.
- Specified by:
setStatus
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.
-
setCursor
setCursor.
- Specified by:
setCursor
in interfaceHtmlRendererContext
- Parameters:
cursorOpt
- aCursor
object.
-
submitForm
public void submitForm(String method, URL action, String target, String enctype, FormInput[] formInputs) Implements simple navigation and form submission with incremental rendering and target processing, including frame lookup. Should be overridden to allow for more robust browser navigation and form submission.Notes:
- Document encoding is defined by {link #getDocumentCharset(URLConnection)}.
- Caching is not implemented.
- Cookies are not implemented.
- Incremental rendering is not optimized for ignorable document change notifications.
- Other HTTP features are not implemented.
- The only form encoding type supported is application/x-www-form-urlencoded.
- Navigation is normally asynchronous.
- Specified by:
submitForm
in interfaceHtmlRendererContext
- Parameters:
method
- aString
object.action
- aURL
object.target
- aString
object.enctype
- aString
object.formInputs
- an array ofFormInput
objects.- See Also:
-
warn
warn.
- Specified by:
warn
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.
-
warn
warn.
- Specified by:
warn
in interfaceHtmlRendererContext
- Parameters:
message
- aString
object.throwable
- aThrowable
object.
-
isTestEnabled
public boolean isTestEnabled()isTest.
- Specified by:
isTestEnabled
in interfaceHtmlRendererContext
- Returns:
- a boolean.
-