本文整理汇总了Java中com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl类的典型用法代码示例。如果您正苦于以下问题:Java CollectionDatasourceImpl类的具体用法?Java CollectionDatasourceImpl怎么用?Java CollectionDatasourceImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CollectionDatasourceImpl类属于com.haulmont.cuba.gui.data.impl包,在下文中一共展示了CollectionDatasourceImpl类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFakeFilter
import com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl; //导入依赖的package包/类
public Filter createFakeFilter() {
if (filter != null) {
return filter;
}
final Filter fakeFilter = AppBeans.get(ComponentsFactory.NAME, ComponentsFactory.class).createComponent(Filter.class);
fakeFilter.setXmlDescriptor(Dom4j.readDocument("<filter/>").getRootElement());
CollectionDatasourceImpl fakeDatasource = new CollectionDatasourceImpl();
DsContextImpl fakeDsContext = new DsContextImpl(frame.getDsContext().getDataSupplier());
FrameContextImpl fakeFrameContext = new FrameContextImpl(frame, Collections.<String, Object>emptyMap());
fakeDsContext.setFrameContext(fakeFrameContext);
fakeDatasource.setDsContext(fakeDsContext);
//Attention: this query should match the logic in com.haulmont.reports.wizard.ReportingWizardBean.createJpqlDataSet()
fakeDatasource.setQuery("select queryEntity from " + metaClass.getName() + " queryEntity");
fakeDatasource.setMetaClass(metaClass);
fakeFilter.setDatasource(fakeDatasource);
fakeFilter.setFrame(this.frame);
return fakeFilter;
}
示例2: getTestCollectionDatasource
import com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl; //导入依赖的package包/类
protected CollectionDatasource<Group, UUID> getTestCollectionDatasource() {
// noinspection unchecked
CollectionDatasource<Group, UUID> collectionDatasource = new DsBuilder()
.setId("testDs")
.setJavaClass(Group.class)
.setView(viewRepository.getView(Group.class, View.LOCAL))
.setRefreshMode(CollectionDatasource.RefreshMode.NEVER)
.setAllowCommit(false)
.buildCollectionDatasource();
for (int i = 0; i < 3; i++) {
Group group = metadata.create(Group.class);
group.setName("Group #" + (i + 1));
Group parentGroup = metadata.create(Group.class);
parentGroup.setName("Parent group #" + (i + 1));
group.setParent(parentGroup);
collectionDatasource.addItem(group);
}
((CollectionDatasourceImpl) collectionDatasource).valid();
return collectionDatasource;
}