Interface IScript
- All Superinterfaces:
IComponent<IScript>
Script component
A component to generate script codes that will be evaluated at the client.
It is similar to HTML SCRIPT tag, except the defer option (withDefer(boolean))
will cause the evaluation of JavaScript until the widget has been
instantiated and mounted to the DOM tree.
- Author:
- katherine
- See Also:
-
Script
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilds instances of typeIScript.static classBuilds an updater of typeIScriptforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns the character encoding of the source.Returns the content of the script element.Returns the list of packages to load before evaluating the script defined ingetContent().getSrc()Returns the URI of the source that contains the script codes.default StringReturns the client widget class.default booleanisDefer()Returns whether to defer the execution of the script codes until the widget is instantiated and mounted.static IScriptReturns the instance with the given content.static IScriptReturns the instance with the given id.static IScriptReturns the instance with the given src.withCharset(String charset) Returns a copy ofthisimmutable component with the specifiedcharset.withContent(String content) Returns a copy ofthisimmutable component with the specifiedcontent.withDefer(boolean defer) Returns a copy ofthisimmutable component with the specifieddefer.withPackages(String packages) Returns a copy ofthisimmutable component with the specifiedpackages.Returns a copy ofthisimmutable component with the specifiedcharset.Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.utl.Script"- Specified by:
getWidgetClassin interfaceIComponent<IScript>- Returns:
-
getCharset
Returns the character encoding of the source. It is used withgetSrc().Default:
null. -
withCharset
Returns a copy ofthisimmutable component with the specifiedcharset.Sets the character encoding of the source. It is used with
withSrc(java.lang.String).Refer to HTML Character Setsfor more information.
- Parameters:
charset- The character encoding of the source.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getSrc
Returns the URI of the source that contains the script codes.Default:
null. -
withSrc
Returns a copy ofthisimmutable component with the specifiedcharset.Sets the URI of the source that contains the script codes.
- Parameters:
charset- The character encoding of the source.Default:
null.- Returns:
- A modified copy of the
thisobject
-
isDefer
default boolean isDefer()Returns whether to defer the execution of the script codes until the widget is instantiated and mounted.Default:
false.Specifying false (default), if you want to do the desktop-level (or class-level) initialization, such as defining a widget class or a global function.
Specifying true, if you want to access widgets. Notice that
thisreferences to this script widget. -
withDefer
Returns a copy ofthisimmutable component with the specifieddefer.Sets whether to defer the execution of the script codes.
- Parameters:
defer- Whether to defer the execution of the script codes.Default:
false.- Returns:
- A modified copy of the
thisobject
-
getContent
Returns the content of the script element. By content we mean the JavaScript codes that will be enclosed by the HTML SCRIPT element.Default:
null. -
withContent
Returns a copy ofthisimmutable component with the specifiedcontent.Sets the content of the script element. By content we mean the JavaScript codes that will be enclosed by the HTML SCRIPT element.
- Parameters:
content- The content of the script element.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getPackages
Returns the list of packages to load before evaluating the script defined ingetContent(). It is meaning only ifgetContent()not null.Default:
null. -
withPackages
Returns a copy ofthisimmutable component with the specifiedpackages.Sets the list of packages to load before evaluating the script defined in
getContent(). If more than a package to load, separate them with comma.- Parameters:
packages- The list of packages to load before evaluating the script.Default:
null.- Returns:
- A modified copy of the
thisobject
-
of
Returns the instance with the given content.- Parameters:
content- The script content.
-
ofSrc
Returns the instance with the given src.- Parameters:
src- The script URI.
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-