@Nullable protected CollectionDatasource findOptionsDatasource(Table.Column columnConf, String propertyId) { String optDsName = columnConf.getXmlDescriptor() != null ? columnConf.getXmlDescriptor().attributeValue("optionsDatasource") : ""; if (Strings.isNullOrEmpty(optDsName)) { return null; } else { if (webTable.getDatasource() == null) { throw new IllegalStateException("Table datasource is null"); } DsContext dsContext = webTable.getDatasource().getDsContext(); CollectionDatasource ds = (CollectionDatasource) dsContext.get(optDsName); if (ds == null) { throw new IllegalStateException( String.format("Options datasource for table column '%s' not found: %s", propertyId, optDsName)); } return ds; } } }
public static void autoRefreshInvalid(CollectionDatasource datasource, boolean autoRefresh) { if (datasource instanceof PropertyDatasource) { return; } if (autoRefresh && Datasource.State.INVALID.equals(datasource.getState())) { DsContext dsContext = datasource.getDsContext(); if (dsContext == null || !WindowParams.DISABLE_AUTO_REFRESH.getBool(dsContext.getFrameContext())) { if (datasource instanceof CollectionDatasource.Suspendable) ((CollectionDatasource.Suspendable) datasource).refreshIfNotSuspended(); else datasource.refresh(); } } } }