Package org.loboevolution.gui
Class LocalHtmlRendererContext
java.lang.Object
org.loboevolution.gui.LocalHtmlRendererContext
- All Implemented Interfaces:
HtmlRendererContext
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLocalHtmlRendererContext(HtmlPanel htmlPanel, UserAgentContext ucontext) Constructs a HtmlRendererContextImpl. -
Method Summary
Modifier and TypeMethodDescriptionvoidOpens a simple message dialog.voidback()It should navigate back one page.voidblur()It should give up focus on the current browser window.voidclose()It should close the current browser window.booleanOpens a simple confirmation window.voiderror.voiderror.voidfocus()It should request focus for the current browser window.voidforward()forward.Gets the current URL in history.Should return true if and only if the current browser window is closed.intgetHistoryLength.Getter for the field htmlPanel.intgetInnerHeight.intgetInnerWidth.getNextURL.Getter for the field opener.intgetOuterHeight.intgetOuterWidth.Getter parent.getPreviousURL.doubledoublegetStatus.getTop()Getter top.If aUserAgentContextinstance was provided in the constructor, then that instance is returned.booleanisClosed()Should return true if and only if the current browser window is closed.booleanisTest.booleanisVisitedLink.voidlinkClicked(URL url, boolean isNewTab) Implements the link click.voidmoveInHistory(int offset) moveInHistory.voidConvenience method provided to allow loading a document into the renderer.voidImplements simple navigation with incremental rendering by invokingHtmlRendererContext.submitForm(String, URL, String, String, FormInput[])with a GET request method.booleanonContextMenu(HTMLElement element, MouseEvent event) This method must be overridden to implement a context menu.It should open a new browser window.voidopenImageViewer(String fullURL, InputStream stream) openImageViewer.voidopenImageViewer(URL srcUrl) openImageViewer.Shows a simple prompt dialog.voidreload()Implements reload as navigation to current URL.voidresizeBy(double byWidth, double byHeight) resizeBy.voidresizeTo(double width, double height) resizeTo.voidscroll(double x, double y) Changes the origin of the HTML block's scrollable area according to the position given.voidscrollBy(double x, double y) scrollBy.voidsetCursor.voidsetDefaultStatus(String message) setDefaultStatus.voidsetHtmlPanel(HtmlPanel panel) Setter for the field htmlPanel.voidsetOpener(HtmlRendererContext opener) Setter for the field opener.voidsetScrollx(double scrollx) voidsetScrolly(double scrolly) voidsetStatus.voidImplements simple navigation and form submission with incremental rendering and target processing, including frame lookup.voidwarn.voidwarn.
-
Field Details
-
currentConnection
-
-
Constructor Details
-
LocalHtmlRendererContext
Constructs a HtmlRendererContextImpl.- Parameters:
htmlPanel- aHtmlPanelobject.ucontext- aUserAgentContextobject.
-
-
Method Details
-
alert
Opens a simple message dialog.- Specified by:
alertin interfaceHtmlRendererContext- Parameters:
message- aStringobject.
-
back
public void back()It should navigate back one page. This implementation does nothing and should be overridden.- Specified by:
backin 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:
blurin interfaceHtmlRendererContext
-
close
public void close()It should close the current browser window. This implementation does nothing and should be overridden.- Specified by:
closein interfaceHtmlRendererContext
-
confirm
Opens a simple confirmation window.- Specified by:
confirmin interfaceHtmlRendererContext- Parameters:
message- aStringobject.- Returns:
- a boolean.
-
error
error.
- Specified by:
errorin interfaceHtmlRendererContext- Parameters:
message- aStringobject.
-
error
error.
- Specified by:
errorin interfaceHtmlRendererContext- Parameters:
message- aStringobject.throwable- aThrowableobject.
-
focus
public void focus()It should request focus for the current browser window. This implementation does nothing and should be overridden.- Specified by:
focusin interfaceHtmlRendererContext
-
forward
public void forward()forward.
- Specified by:
forwardin interfaceHtmlRendererContext
-
getCurrentURL
Gets the current URL in history.- Specified by:
getCurrentURLin 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:
getDefaultStatusin interfaceHtmlRendererContext- Returns:
- a
Stringobject.
-
getHtmlPanel
Getter for the field htmlPanel.
- Specified by:
getHtmlPanelin interfaceHtmlRendererContext
-
getOpener
Getter for the field opener.
- Specified by:
getOpenerin interfaceHtmlRendererContext- Returns:
- a
HtmlRendererContextobject.
-
getParent
Getter parent.
- Specified by:
getParentin interfaceHtmlRendererContext- Returns:
- a
HtmlRendererContextobject.
-
getTop
Getter top.
- Specified by:
getTopin interfaceHtmlRendererContext- Returns:
- a
HtmlRendererContextobject.
-
getUserAgentContext
If aUserAgentContextinstance was provided in the constructor, then that instance is returned. Otherwise, an instance ofUserAgentContextis created and returned.The context returned by this method is used by local request facilities and other parts of the renderer.
- Specified by:
getUserAgentContextin 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:
isClosedin interfaceHtmlRendererContext- Returns:
- a boolean.
-
isVisitedLink
isVisitedLink.
- Specified by:
isVisitedLinkin interfaceHtmlRendererContext- Parameters:
link- aHTMLAnchorElementobject.- Returns:
- a boolean.
-
linkClicked
Implements the link click.- Specified by:
linkClickedin interfaceHtmlRendererContext
-
moveInHistory
public void moveInHistory(int offset) moveInHistory.
- Specified by:
moveInHistoryin interfaceHtmlRendererContext- Parameters:
offset- aIntegerobject.
-
getPreviousURL
getPreviousURL.
- Specified by:
getPreviousURLin interfaceHtmlRendererContext- Returns:
- a
Stringobject.
-
getNextURL
getNextURL.
- Specified by:
getNextURLin interfaceHtmlRendererContext- Returns:
- a
Stringobject.
-
getHistoryLength
public int getHistoryLength()getHistoryLength.
- Specified by:
getHistoryLengthin interfaceHtmlRendererContext- Returns:
- a
Integerobject.
-
getStatus
Description copied from interface:HtmlRendererContextgetStatus.
- Specified by:
getStatusin interfaceHtmlRendererContext- Returns:
- a
Stringobject.
-
onContextMenu
This method must be overridden to implement a context menu.- Specified by:
onContextMenuin interfaceHtmlRendererContext- Parameters:
element- aHTMLElementobject.event- aMouseEventobject.- Returns:
- a boolean.
-
open
It should open a new browser window. This implementation does nothing and should be overridden.- Specified by:
openin 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
HtmlRendererContextobject.
-
openImageViewer
openImageViewer.
- Specified by:
openImageViewerin interfaceHtmlRendererContext- Parameters:
srcUrl- aURLobject.
-
openImageViewer
openImageViewer.
- Specified by:
openImageViewerin interfaceHtmlRendererContext- Parameters:
fullURL- aStringobject.stream- aInputStreamobject.
-
prompt
Shows a simple prompt dialog.- Specified by:
promptin interfaceHtmlRendererContext- Parameters:
message- aStringobject.inputDefault- aStringobject.- Returns:
- a
Stringobject.
-
reload
public void reload()Implements reload as navigation to current URL. Override to implement a more robust reloading mechanism.- Specified by:
reloadin interfaceHtmlRendererContext
-
resizeBy
public void resizeBy(double byWidth, double byHeight) resizeBy.
- Specified by:
resizeByin interfaceHtmlRendererContext- Parameters:
byWidth- aDoubleobject.byHeight- aDoubleobject.
-
resizeTo
public void resizeTo(double width, double height) resizeTo.
- Specified by:
resizeToin interfaceHtmlRendererContext- Parameters:
width- aDoubleobject.height- aDoubleobject.
-
getInnerHeight
public int getInnerHeight()getInnerHeight.
- Specified by:
getInnerHeightin interfaceHtmlRendererContext
-
getInnerWidth
public int getInnerWidth()getInnerWidth.
- Specified by:
getInnerWidthin interfaceHtmlRendererContext
-
getOuterHeight
public int getOuterHeight()getOuterHeight.
- Specified by:
getOuterHeightin interfaceHtmlRendererContext
-
getOuterWidth
public int getOuterWidth()getOuterWidth.
- Specified by:
getOuterWidthin 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:
scrollin 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:
scrollByin interfaceHtmlRendererContext- Parameters:
x- aDoubleobject.y- aDoubleobject.
-
getScrollx
public double getScrollx()- Specified by:
getScrollxin interfaceHtmlRendererContext
-
setScrollx
public void setScrollx(double scrollx) - Specified by:
setScrollxin interfaceHtmlRendererContext
-
getScrolly
public double getScrolly()- Specified by:
getScrollyin interfaceHtmlRendererContext
-
setScrolly
public void setScrolly(double scrolly) - Specified by:
setScrollyin interfaceHtmlRendererContext
-
setDefaultStatus
setDefaultStatus.
- Specified by:
setDefaultStatusin interfaceHtmlRendererContext- Parameters:
message- aStringobject.
-
setHtmlPanel
Setter for the field htmlPanel.
- Specified by:
setHtmlPanelin interfaceHtmlRendererContext- Parameters:
panel- aHtmlPanelobject.
-
setOpener
Setter for the field opener.
- Specified by:
setOpenerin interfaceHtmlRendererContext- Parameters:
opener- aHtmlRendererContextobject.
-
setStatus
setStatus.
- Specified by:
setStatusin interfaceHtmlRendererContext- Parameters:
message- aStringobject.
-
setCursor
setCursor.
- Specified by:
setCursorin interfaceHtmlRendererContext- Parameters:
cursorOpt- aCursorobject.
-
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:
submitFormin interfaceHtmlRendererContext- Parameters:
method- aStringobject.action- aURLobject.target- aStringobject.enctype- aStringobject.formInputs- an array ofFormInputobjects.- See Also:
-
warn
warn.
- Specified by:
warnin interfaceHtmlRendererContext- Parameters:
message- aStringobject.
-
warn
warn.
- Specified by:
warnin interfaceHtmlRendererContext- Parameters:
message- aStringobject.throwable- aThrowableobject.
-
isTestEnabled
public boolean isTestEnabled()isTest.
- Specified by:
isTestEnabledin interfaceHtmlRendererContext- Returns:
- a boolean.
-