|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.smartgwt.client.widgets.BaseWidget
com.smartgwt.client.widgets.Canvas
com.smartgwt.client.widgets.HTMLFlow
public class HTMLFlow
Use the HTMLFlow component to display HTML content that should expand to its natural size without scrolling.
HTML content can be loaded and reloaded from a URL via the property
contentsURL
. This method of loading is for simple HTML content
only; SmartGWT components should be loaded via the ViewLoader
class.
NOTE: Since the size of an HTMLFlow component is determined by its HTML contents, this component will draw at varying sizes if given content of varying size. When using HTMLFlow components within a Layout, consider what will happen if the HTMLFlow renders at various sizes. An HTMLFlow which can expand should be placed in a container where other components can render smaller, where the container is allowed to scroll, or where there is padding to expand into.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled |
Field Summary |
---|
Fields inherited from class com.smartgwt.client.widgets.BaseWidget |
---|
config, configOnly, id, isElementSet |
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
HTMLFlow()
|
|
HTMLFlow(com.google.gwt.core.client.JavaScriptObject jsObj)
|
|
HTMLFlow(java.lang.String contents)
|
Method Summary | |
---|---|
HandlerRegistration |
addContentLoadedHandler(ContentLoadedHandler handler)
Add a contentLoaded handler. |
protected com.google.gwt.core.client.JavaScriptObject |
create()
|
java.lang.Boolean |
getAllowCaching()
By default an HTMLFlow will explicitly prevent browser caching. |
java.lang.Boolean |
getCaptureSCComponents()
If true, SmartGWT components created while executing the loaded HTML are captured for rendering inside the HTMLFlow. |
java.lang.String |
getContents()
The contents of a canvas or label widget. |
ContentsType |
getContentsType()
The default setting of 'null' or 'fragment' indicates that HTML loaded from contentsURL is assumed to be an HTML fragment rather than a
complete page. |
java.lang.String |
getContentsURL()
URL to load content from. |
java.lang.Boolean |
getDynamicContents()
Dynamic contents allows the contents string to be treated as a simple, but powerful template. |
java.lang.Boolean |
getEvalScriptBlocks()
If evalScriptBlocks is true, HTMLFlow will pre-process the loaded HTML in order to
mimic how the HTML would execute if it were loaded as an independent page or loaded via an
IFRAME. |
SendMethod |
getHttpMethod()
Selects the HTTP method that will be used when fetching content. |
java.lang.String |
getLoadingMessage()
HTML to show while content is being fetched, active only if the contentsURL
property has been set.
|
static HTMLFlow |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
|
void |
loadingContent()
Returns true if this htmlFlow is currently loading content from the server. Note: Does not apply to htmlFlows with contentsType set to
"page"
|
void |
setAllowCaching(java.lang.Boolean allowCaching)
By default an HTMLFlow will explicitly prevent browser caching. |
void |
setCaptureSCComponents(java.lang.Boolean captureSCComponents)
If true, SmartGWT components created while executing the loaded HTML are captured for rendering inside the HTMLFlow. |
void |
setContents(java.lang.String contents)
The contents of a canvas or label widget. |
void |
setContentsType(ContentsType contentsType)
The default setting of 'null' or 'fragment' indicates that HTML loaded from contentsURL is assumed to be an HTML fragment rather than a
complete page. |
void |
setContentsURL(java.lang.String contentsURL)
URL to load content from. |
void |
setContentsURLParams(java.util.Map contentsURLParams)
Parameters to be sent to the contentsURL when fetching content. |
void |
setDynamicContents(java.lang.Boolean dynamicContents)
Dynamic contents allows the contents string to be treated as a simple, but powerful template. |
void |
setEvalScriptBlocks(java.lang.Boolean evalScriptBlocks)
If evalScriptBlocks is true, HTMLFlow will pre-process the loaded HTML in order to
mimic how the HTML would execute if it were loaded as an independent page or loaded via an
IFRAME. |
void |
setHttpMethod(SendMethod httpMethod)
Selects the HTTP method that will be used when fetching content. |
void |
setLoadingMessage(java.lang.String loadingMessage)
HTML to show while content is being fetched, active only if the contentsURL
property has been set.
|
void |
transformHTML(java.lang.String html)
Override to modify the loaded HTML before it is rendered. |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getStyleElement, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setPixelSize, setSize, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Constructor Detail |
---|
public HTMLFlow()
public HTMLFlow(com.google.gwt.core.client.JavaScriptObject jsObj)
public HTMLFlow(java.lang.String contents)
Method Detail |
---|
public static HTMLFlow getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
protected com.google.gwt.core.client.JavaScriptObject create()
create
in class Canvas
public void setContents(java.lang.String contents)
setContents
in class Canvas
contents
- contents Default value is " "public java.lang.String getContents()
getContents
in class Canvas
public void setDynamicContents(java.lang.Boolean dynamicContents)
You can use this feature to build some simple custom components. For example, let's say you want to show the value of a Slider in a Canvas somewhere on the screen. You can do this by observing the valueChanged() method on the slider and calling setContents() on your canvas with the new string or you can set the contents of the canvas to something like:
"The slider value is \${sliderInstance.getValue()}."
Next you set dynamicContents: true on the canvas, observe valueChanged() on the slider and call canvas.markForRedraw() in that observation. This approach is cleaner than setContents() when the Canvas is aggregating several values or dynamic expressions. Like so:
Slider.create({ ID: "mySlider" }); Canvas.create({ ID: "myCanvas", dynamicContents: true, contents: "The slider value is \${mySlider.getValue()}." }); myCanvas.observe(mySlider, "valueChanged", "observer.markForRedraw()");You can embed an arbitrary number of dynamic expressions in the contents string. The search and replace is optimized for speed.
If an error occurs during the evaluation of one of the expressions, a warning is logged to the ISC Developer Console and the error string is embedded in place of the expected value in the Canvas.
The value of a function is its return value. The value of any variable is the same as that returned by its toString() representation.
Inside the evalution contentext, this
points to the canvas instance that
has the dynamicContents string as its contents - in other words the canvas instance on
which the template is declared.
Note : This is an advanced setting
setDynamicContents
in class Canvas
dynamicContents
- dynamicContents Default value is falsepublic java.lang.Boolean getDynamicContents()
You can use this feature to build some simple custom components. For example, let's say you want to show the value of a Slider in a Canvas somewhere on the screen. You can do this by observing the valueChanged() method on the slider and calling setContents() on your canvas with the new string or you can set the contents of the canvas to something like:
"The slider value is \${sliderInstance.getValue()}."
Next you set dynamicContents: true on the canvas, observe valueChanged() on the slider and call canvas.markForRedraw() in that observation. This approach is cleaner than setContents() when the Canvas is aggregating several values or dynamic expressions. Like so:
Slider.create({ ID: "mySlider" }); Canvas.create({ ID: "myCanvas", dynamicContents: true, contents: "The slider value is \${mySlider.getValue()}." }); myCanvas.observe(mySlider, "valueChanged", "observer.markForRedraw()");You can embed an arbitrary number of dynamic expressions in the contents string. The search and replace is optimized for speed.
If an error occurs during the evaluation of one of the expressions, a warning is logged to the ISC Developer Console and the error string is embedded in place of the expected value in the Canvas.
The value of a function is its return value. The value of any variable is the same as that returned by its toString() representation.
Inside the evalution contentext, this
points to the canvas instance that
has the dynamicContents string as its contents - in other words the canvas instance on
which the template is declared.
getDynamicContents
in class Canvas
public void setContentsURL(java.lang.String contentsURL)
If specified, this component will load HTML content from the specified URL when it is first drawn.
This feature relies on the XMLHttpRequest object which can be disabled by end-users in some
supported browsers. See PlatformDependencies
for more information.
Change the URL this component loads content from. Triggers a fetch for content from the new
URL.
Can also be called with no arguments to reload content from the existing contentsURL
.
This feature relies on the XMLHttpRequest object which can be disabled by end-users in some
supported browsers. See PlatformDependencies
for more information.
contentsURL
- URL to retrieve contents from. Default value is nullpublic java.lang.String getContentsURL()
If specified, this component will load HTML content from the specified URL when it is first drawn.
This feature relies on the XMLHttpRequest object which can be disabled by end-users in some
supported browsers. See PlatformDependencies
for more information.
public void setLoadingMessage(java.lang.String loadingMessage)
contentsURL
property has been set.
The loading message will show both during the initial load of content, and during reload if
the contents are reloaded or the contentsURL changed. For a first-time only loading
message, initialize the contents
property instead.
Note: the loadingMessage
is never displayed when loading complete web pages
rather than HTML fragments (see contentsType
).
loadingMessage
- loadingMessage Default value is nullpublic java.lang.String getLoadingMessage()
contentsURL
property has been set.
The loading message will show both during the initial load of content, and during reload if
the contents are reloaded or the contentsURL changed. For a first-time only loading
message, initialize the contents
property instead.
Note: the loadingMessage
is never displayed when loading complete web pages
rather than HTML fragments (see contentsType
).
public void setHttpMethod(SendMethod httpMethod)
httpMethod
- httpMethod Default value is "GET"public SendMethod getHttpMethod()
public void setAllowCaching(java.lang.Boolean allowCaching) throws java.lang.IllegalStateException
Set to true to allow browser caching if the browser would normally do so, in other words, if the HTTP headers returned with the response indicate that the response can be cached.
allowCaching
- allowCaching Default value is false
java.lang.IllegalStateException
- this property cannot be changed after the component has been createdpublic java.lang.Boolean getAllowCaching()
Set to true to allow browser caching if the browser would normally do so, in other words, if the HTTP headers returned with the response indicate that the response can be cached.
public void setEvalScriptBlocks(java.lang.Boolean evalScriptBlocks) throws java.lang.IllegalStateException
evalScriptBlocks
is true, HTMLFlow will pre-process the loaded HTML in order to
mimic how the HTML would execute if it were loaded as an independent page or loaded via an
IFRAME.
This feature is intended to assist with migrating existing applications to SmartGWT.
Note that, if evalScriptBlocks is false, <SCRIPT> blocks will still be detected and disabled to avoid the inconsistent results across different browsers.
Only applies when contentsType is not "page".
evalScriptBlocks
- evalScriptBlocks Default value is true
java.lang.IllegalStateException
- this property cannot be changed after the component has been createdpublic java.lang.Boolean getEvalScriptBlocks()
evalScriptBlocks
is true, HTMLFlow will pre-process the loaded HTML in order to
mimic how the HTML would execute if it were loaded as an independent page or loaded via an
IFRAME.
This feature is intended to assist with migrating existing applications to SmartGWT.
Note that, if evalScriptBlocks is false, <SCRIPT> blocks will still be detected and disabled to avoid the inconsistent results across different browsers.
Only applies when contentsType is not "page".
public void setCaptureSCComponents(java.lang.Boolean captureSCComponents) throws java.lang.IllegalStateException
Only applies when contentsType is not "page".
captureSCComponents
- captureSCComponents Default value is true
java.lang.IllegalStateException
- this property cannot be changed after the component has been createdpublic java.lang.Boolean getCaptureSCComponents()
Only applies when contentsType is not "page".
public void loadingContent()
contentsType
set to
"page"
public void transformHTML(java.lang.String html)
html
- the html as loaded from the server return (HTML) html to be renderedpublic HandlerRegistration addContentLoadedHandler(ContentLoadedHandler handler)
StringMethod fired when content is completely loaded in this htmlFlow. Has no default implementation. May be observed or overridden as a notification type method to fire custom logic when loading completes.
Note: Does not apply to htmlFlows with contentsType
set
to "page"
addContentLoadedHandler
in interface HasContentLoadedHandlers
handler
- the contentLoaded handler
HandlerRegistration
used to remove this handlerpublic void setContentsType(ContentsType contentsType) throws java.lang.IllegalStateException
contentsURL
is assumed to be an HTML fragment rather than a
complete page. Set to "page" to load HTML as a standalone page, via an IFRAME.
contentsType:"page"
should only be used for controlled HTML content, and only when such content
cannot be delivered as an HTML fragment instead (the default). To dynamically load SmartGWT components, use
ViewLoader
, never this mechanism (click here for why).
Loading HTML content as a fragment is less resource intensive and avoids visual artifacts such as translucent media becoming opaque or disappearing when placed over an IFRAME.
Loading third-party, uncontrolled content could
lead to the surrounding page disappearing if a user clicks on an HTML link with target=_top
.
With contentsType:"page"
, loadingMessage
is not supported, and only "GET" is supported for httpMethod
.
contentsType
- contentsType Default value is null
java.lang.IllegalStateException
- this property cannot be changed after the component has been createdpublic ContentsType getContentsType()
contentsURL
is assumed to be an HTML fragment rather than a
complete page. Set to "page" to load HTML as a standalone page, via an IFRAME.
contentsType:"page"
should only be used for controlled HTML content, and only when such content
cannot be delivered as an HTML fragment instead (the default). To dynamically load SmartGWT components, use
ViewLoader
, never this mechanism (click here for why).
Loading HTML content as a fragment is less resource intensive and avoids visual artifacts such as translucent media becoming opaque or disappearing when placed over an IFRAME.
Loading third-party, uncontrolled content could
lead to the surrounding page disappearing if a user clicks on an HTML link with target=_top
.
With contentsType:"page"
, loadingMessage
is not supported, and only "GET" is supported for httpMethod
.
public void setContentsURLParams(java.util.Map contentsURLParams)
contentsURLParams
- parameters
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |