public class ShadowTemplate extends Object implements org.zkoss.zk.ui.ext.DynamicPropertied, Serializable
Apply, for
example, developers can specify the template(setTemplate(String)) or pass parameters(setDynamicProperty(String, Object)).
The difference is that developers must designate a boolean value, called autodrop, to indicate whether to
drop those rendered children or not. If true, every time user changed template or detach from the original host,
ShadowTemplate will HtmlShadowElement.recreate() or removed the children, otherwise, rendered children will be remained.
After instantiating ShadowTemplate instance and above configuration, developers can trigger apply(Component) to compose
the specified template with shadow host passed as parameter. Note that, the passed host should be the same one if
autodrop is true, or pass null to detach the original host first.
| Constructor and Description |
|---|
ShadowTemplate(boolean autodrop)
Constructor needs a boolean value to indicate whether to detached all rendered children automatically or not when
template or host is changed.
|
| Modifier and Type | Method and Description |
|---|---|
void |
apply(org.zkoss.zk.ui.Component host)
Compose the specified template with the given host.
|
Map<String,Object> |
getDynamicProperties() |
Object |
getDynamicProperty(String name) |
org.zkoss.zk.ui.Component |
getShadowHost()
Return the current shadow host.
|
String |
getTemplate()
Returns the template name
|
String |
getTemplateURI()
Gets the template uri.
|
boolean |
hasDynamicProperty(String name) |
void |
setDynamicProperty(String name,
Object value) |
void |
setTemplate(String template)
Sets the template name, for more detail, please check out
Apply.setTemplate(String) |
void |
setTemplateURI(String templateURI)
Sets the template uri, for more detail, please check out
Apply.setTemplateURI(String) |
public ShadowTemplate(boolean autodrop)
autodrop - a boolean valuepublic String getTemplate()
Default: empty string
public void setTemplate(String template)
Apply.setTemplate(String)public void setTemplateURI(String templateURI)
Apply.setTemplateURI(String)templateURI - the template URIpublic String getTemplateURI()
public boolean hasDynamicProperty(String name)
hasDynamicProperty in interface org.zkoss.zk.ui.ext.DynamicPropertiedpublic Object getDynamicProperty(String name)
getDynamicProperty in interface org.zkoss.zk.ui.ext.DynamicPropertiedpublic void setDynamicProperty(String name, Object value) throws org.zkoss.zk.ui.WrongValueException
setDynamicProperty in interface org.zkoss.zk.ui.ext.DynamicPropertiedorg.zkoss.zk.ui.WrongValueExceptionpublic org.zkoss.zk.ui.Component getShadowHost()
public void apply(org.zkoss.zk.ui.Component host)
host - as known as shadow host mentioned in other shadow elementCopyright © 2020. All rights reserved.