本文整理汇总了Java中com.haulmont.cuba.gui.data.CollectionDatasource.addStateChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionDatasource.addStateChangeListener方法的具体用法?Java CollectionDatasource.addStateChangeListener怎么用?Java CollectionDatasource.addStateChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.haulmont.cuba.gui.data.CollectionDatasource
的用法示例。
在下文中一共展示了CollectionDatasource.addStateChangeListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void bind(CollectionDatasource ds) {
weakItemChangeListener = new WeakItemChangeListener(ds, this);
ds.addItemChangeListener(weakItemChangeListener);
weakItemPropertyChangeListener = new WeakItemPropertyChangeListener(ds, this);
ds.addItemPropertyChangeListener(weakItemPropertyChangeListener);
weakStateChangeListener = new WeakStateChangeListener(ds, this);
ds.addStateChangeListener(weakStateChangeListener);
weakCollectionChangeListener = new WeakCollectionChangeListener(ds, this);
ds.addCollectionChangeListener(weakCollectionChangeListener);
}
示例2: bind
import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void bind(CollectionDatasource ds) {
ds.addItemChangeListener(new WeakItemChangeListener(ds, this));
ds.addItemPropertyChangeListener(new WeakItemPropertyChangeListener(ds, this));
ds.addStateChangeListener(new WeakStateChangeListener(ds, this));
ds.addCollectionChangeListener(new WeakCollectionChangeListener(ds, this));
}
示例3: OptionsDsWrapper
import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public OptionsDsWrapper(CollectionDatasource datasource, Collection<MetaPropertyPath> properties, boolean autoRefresh) {
this.datasource = datasource;
this.autoRefresh = autoRefresh;
final View view = datasource.getView();
final MetaClass metaClass = datasource.getMetaClass();
if (properties == null) {
createProperties(view, metaClass);
} else {
this.properties.addAll(properties);
}
dsStateChangeListener = e -> itemsCache.clear();
dsItemPropertyChangeListener = e -> {
Item wrapper = getItemWrapper(e.getItem());
// MetaProperty worked wrong with properties from inherited superclasses
MetaPropertyPath metaPropertyPath = datasource.getMetaClass().getPropertyPath(e.getProperty());
if (metaPropertyPath == null) {
return;
}
Property itemProperty = wrapper.getItemProperty(metaPropertyPath);
if (itemProperty instanceof PropertyWrapper) {
((PropertyWrapper) itemProperty).fireValueChangeEvent();
}
};
cdsCollectionChangeListener = e -> {
final boolean prevIgnoreListeners = ignoreListeners;
try {
itemsCache.clear();
fireItemSetChanged();
} finally {
ignoreListeners = prevIgnoreListeners;
}
};
weakDsListenerAdapter = new WeakDsListenerAdapter(datasource, dsItemPropertyChangeListener, dsStateChangeListener, cdsCollectionChangeListener);
datasource.addCollectionChangeListener(weakDsListenerAdapter);
datasource.addStateChangeListener(weakDsListenerAdapter);
datasource.addItemPropertyChangeListener(weakDsListenerAdapter);
}