@Override public BindingState getState() { if (datasource.getState() == Datasource.State.VALID) { return BindingState.ACTIVE; } return BindingState.INACTIVE; }
@Override public BindingState getState() { if (metaPropertyPath == null) { return datasource.getState() == Datasource.State.VALID ? BindingState.ACTIVE : BindingState.INACTIVE; } else { Datasource master = ((NestedDatasource) datasource).getMaster(); boolean masterValid = master.getState() == Datasource.State.VALID; boolean masterEntitySpecified = master.getItem() != null; boolean nestedValid = datasource.getState() == Datasource.State.VALID; return masterValid && masterEntitySpecified && nestedValid ? BindingState.ACTIVE : BindingState.INACTIVE; } }
public DatasourceDataGridItems(CollectionDatasource<E, K> datasource) { if (!(datasource instanceof CollectionDatasource.Indexed)) { throw new IllegalArgumentException("Datasource must implement " + "com.haulmont.cuba.gui.data.CollectionDatasource.Indexed"); } this.datasource = (CollectionDatasource.Indexed<E, K>) datasource; this.datasource.addStateChangeListener(this::datasourceStateChanged); this.datasource.addItemPropertyChangeListener(this::datasourceItemPropertyChanged); this.datasource.addCollectionChangeListener(this::datasourceCollectionChanged); this.datasource.addItemChangeListener(this::datasourceItemChanged); CollectionDsHelper.autoRefreshInvalid(datasource, true); if (datasource.getState() == Datasource.State.VALID) { setState(BindingState.ACTIVE); } }
public DatasourceOptions(CollectionDatasource<E, K> datasource) { this.datasource = datasource; this.datasource.addStateChangeListener(this::datasourceStateChanged); this.datasource.addItemPropertyChangeListener(this::datasourceItemPropertyChanged); this.datasource.addCollectionChangeListener(this::datasourceCollectionChanged); CollectionDsHelper.autoRefreshInvalid(datasource, true); if (datasource.getState() == Datasource.State.VALID) { setState(BindingState.ACTIVE); } }
protected boolean isDataAvailable() { if (listComponent.getItems() instanceof ContainerDataUnit) { ContainerDataUnit unit = (ContainerDataUnit) listComponent.getItems(); CollectionContainer container = unit.getContainer(); return container instanceof HasLoader && unit.getState() == BindingState.ACTIVE && !container.getItems().isEmpty(); } else { CollectionDatasource ds = listComponent.getDatasource(); if (ds != null) return ds.getState() == Datasource.State.VALID && ds.size() > 0; } return false; }
public DatasourceTableItems(CollectionDatasource<E, K> datasource) { this.datasource = datasource; this.datasource.addStateChangeListener(this::datasourceStateChanged); this.datasource.addItemPropertyChangeListener(this::datasourceItemPropertyChanged); this.datasource.addCollectionChangeListener(this::datasourceCollectionChanged); this.datasource.addItemChangeListener(this::datasourceItemChanged); CollectionDsHelper.autoRefreshInvalid(datasource, true); if (datasource.getState() == Datasource.State.VALID) { setState(BindingState.ACTIVE); } }
if (datasource.getState() == Datasource.State.VALID) { doGroup(); } else if (datasource instanceof PropertyDatasource) {
if (optionsDatasource.getState() == Datasource.State.VALID) { optionsDatasource.clear(); optionsDatasource.refresh(Collections.singletonMap(SEARCH_STRING_PARAM, filterForDs)); if (optionsDatasource.getState() == Datasource.State.VALID) { if (optionsDatasource.size() == 0) { if (searchNotifications != null) { if (optionsDatasource.getState() == Datasource.State.VALID) { optionsDatasource.clear();
if (optionsDatasource.getState() == Datasource.State.VALID) { optionsDatasource.clear(); optionsDatasource.refresh(Collections.singletonMap(SEARCH_STRING_PARAM, filterForDs)); if (optionsDatasource.getState() == Datasource.State.VALID) { if (optionsDatasource.size() == 0) { if (searchNotifications != null) { if (optionsDatasource.getState() == Datasource.State.VALID) { optionsDatasource.clear();
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(); } } } }
if (VALID == dataSets.getDatasource().getState()) { onTableReady(dataSets, bandDefinitionDs); } else {
if (e.getDs().getState() == Datasource.State.VALID) { copyAction.setEnabled(hasPermissionsToCreateUsers && e.getDs().getItem() != null); changePasswAction.setEnabled(hasPermissionsToUpdateUsers && e.getDs().getItem() != null);