use of com.haulmont.cuba.gui.FrameContextImpl in project cuba by cuba-platform.
the class FakeFilterSupport method createFakeFilter.
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;
}
Aggregations