本文整理汇总了Java中com.haulmont.cuba.gui.data.CollectionDatasource.getState方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionDatasource.getState方法的具体用法?Java CollectionDatasource.getState怎么用?Java CollectionDatasource.getState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.haulmont.cuba.gui.data.CollectionDatasource
的用法示例。
在下文中一共展示了CollectionDatasource.getState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDatasource
import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void setDatasource(CollectionDatasource datasource) {
this.datasource = datasource;
if (datasource != null) {
collectionChangeListener = e -> {
samePage = Operation.REFRESH != e.getOperation()
&& Operation.CLEAR != e.getOperation();
onCollectionChanged();
};
//noinspection unchecked
this.datasource.addCollectionChangeListener(new WeakCollectionChangeListener(this.datasource, collectionChangeListener));
impl.getCountButton().addActionListener(e -> onLinkClick());
impl.getPrevButton().addActionListener(e -> onPrevClick());
impl.getNextButton().addActionListener(e -> onNextClick());
impl.getFirstButton().addActionListener(e -> onFirstClick());
impl.getLastButton().addActionListener(e -> onLastClick());
if (datasource.getState() == Datasource.State.VALID) {
onCollectionChanged();
}
}
}
示例2: setDatasource
import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void setDatasource(CollectionDatasource datasource) {
Preconditions.checkNotNullArgument(datasource, "datasource is null");
if (this.datasource != null) {
//noinspection unchecked
this.datasource.removeCollectionChangeListener(weakCollectionChangeListener);
weakCollectionChangeListener = null;
} else {
//noinspection unchecked
collectionChangeListener = e -> {
samePage = Operation.REFRESH != e.getOperation()
&& Operation.CLEAR != e.getOperation();
onCollectionChanged();
};
}
this.datasource = datasource;
weakCollectionChangeListener = new WeakCollectionChangeListener(datasource, collectionChangeListener);
//noinspection unchecked
datasource.addCollectionChangeListener(weakCollectionChangeListener);
component.getCountButton().addClickListener(event -> onLinkClick());
component.getPrevButton().addClickListener(event -> onPrevClick());
component.getNextButton().addClickListener(event -> onNextClick());
component.getFirstButton().addClickListener(event -> onFirstClick());
component.getLastButton().addClickListener(event -> onLastClick());
if (datasource.getState() == Datasource.State.VALID) {
onCollectionChanged();
}
}
示例3: setOptionsDatasource
import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void setOptionsDatasource(CollectionDatasource datasource) {
if (optionsInitialized)
return;
super.setOptionsDatasource(datasource);
if (optionsDatasource != null) {
if (!optionsDatasource.getState().equals(Datasource.State.VALID)) {
optionsDatasource.refresh();
}
for (Entity item : optionsDatasource.getItems()) {
addItem(new EntityWrapper(item));
}
collectionChangeListener = e -> {
Object value = getValue();
removeAllItems();
for (Object id : e.getDs().getItemIds()) {
addItem(new EntityWrapper(e.getDs().getItem(id)));
}
updateComponent(value);
fireChangeListeners(getValue());
impl.revalidate();
impl.repaint();
};
optionsDatasource.addCollectionChangeListener(new WeakCollectionChangeListener(optionsDatasource, collectionChangeListener));
if ((datasource!= null) && (datasource.getState() == Datasource.State.VALID)) {
Entity newValue = datasource.getItem();
updateComponent(newValue);
fireChangeListeners(newValue);
}
optionsInitialized = true;
}
assignAutoDebugId();
}