本文整理了Java中com.vaadin.flow.dom.Element.addSynchronizedProperty()
方法的一些代码示例,展示了Element.addSynchronizedProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.addSynchronizedProperty()
方法的具体详情如下:
包路径:com.vaadin.flow.dom.Element
类名称:Element
方法名:addSynchronizedProperty
[英]Adds the property whose value should automatically be synchronized from the client side and updated in this Element.
Synchronization takes place whenever one of the events defined using #addSynchronizedPropertyEvent(String) is fired for the element.
Only properties which can be set using setProperty can be synchronized, e.g. classList cannot be synchronized.
The method is shorthand for #addSynchronizedProperty(String,DisabledUpdateMode) with DisabledUpdateMode.ONLY_WHEN_ENABLED parameter value. #addSynchronizedProperty(String,DisabledUpdateMode)
[中]添加属性,该属性的值应自动从客户端同步并在此元素中更新。
每当为元素触发使用#addSynchronizedPropertyEvent(字符串)定义的一个事件时,就会发生同步。
只能同步可以使用setProperty设置的属性,例如无法同步classList。
该方法是#addSynchronizedProperty(String,DisabledUpdateMode)与DisabledUpdateMode的缩写。仅当启用参数值时才启用#addSynchronizedProperty(字符串,DisabledUpdateMode)
代码示例来源:origin: com.vaadin/flow-server
public Element synchronizeProperty(String property, String eventType,
DisabledUpdateMode mode) {
addSynchronizedProperty(property, mode);
addSynchronizedPropertyEvent(eventType);
return this;
代码示例来源:origin: com.vaadin/flow-server
/**
* Adds the property whose value should automatically be synchronized from
* the client side and updated in this {@link Element}.
* <p>
* Synchronization takes place whenever one of the events defined using
* {@link #addSynchronizedPropertyEvent(String)} is fired for the element.
* <p>
* Only properties which can be set using setProperty can be synchronized,
* e.g. classList cannot be synchronized.
* <p>
* The method is shorthand for
* {@link #addSynchronizedProperty(String, DisabledUpdateMode)} with
* {@literal DisabledUpdateMode.ONLY_WHEN_ENABLED} parameter value.
* {@link #addSynchronizedProperty(String, DisabledUpdateMode)}
*
* @param property
* the property name to synchronize
* @return this element
* @deprecated Use
* {@link #addPropertyChangeListener(String, String, PropertyChangeListener)}
* or
* {@link DomListenerRegistration#synchronizeProperty(String)}
* instead.
*/
@Deprecated
public Element addSynchronizedProperty(String property) {
return addSynchronizedProperty(property,
DisabledUpdateMode.ONLY_WHEN_ENABLED);
}
代码示例来源:origin: appreciated/vaadin-app-layout
getElement().addSynchronizedProperty("opened")
.addPropertyChangeListener("opened", event -> {
if ((Boolean) event.getValue())
代码示例来源:origin: com.vaadin/flow-server
/**
* Configures synchronized properties based on given annotations.
*/
private void configureSynchronizedProperties() {
ComponentUtil.getSynchronizedProperties(getClass()).forEach(
info -> getElement().addSynchronizedProperty(info.getProperty(),
info.getUpdateMode()));
ComponentUtil.getSynchronizedPropertyEvents(getClass())
.forEach(getElement()::addSynchronizedPropertyEvent);
}
内容来源于网络,如有侵权,请联系作者删除!