@Override public void setDatasource(CollectionDatasource datasource) { if (datasource == null) { setEventProvider(null); } else { CollectionDsHelper.autoRefreshInvalid(datasource, true); setEventProvider(new com.haulmont.cuba.gui.components.calendar.EntityCalendarEventProvider(datasource)); } }
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 DatasourceTreeItems(HierarchicalDatasource<E, K> datasource) { if (!(datasource instanceof CollectionDatasource.Indexed)) { throw new IllegalArgumentException("Datasource must implement " + "com.haulmont.cuba.gui.data.CollectionDatasource.Indexed"); } 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); } }
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); } }
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); } }
try { if (properties != null) { CollectionDsHelper.autoRefreshInvalid(datasource, true);
@SuppressWarnings("unchecked") public EntityDataProvider(CollectionDatasource datasource) { CollectionDsHelper.autoRefreshInvalid(datasource, true); this.datasource = datasource; collectionChangeListener = e -> { DataChangeOperation operation = null; switch (e.getOperation()) { case ADD: operation = DataChangeOperation.ADD; break; case REMOVE: operation = DataChangeOperation.REMOVE; break; case UPDATE: operation = DataChangeOperation.UPDATE; break; case REFRESH: case CLEAR: operation = DataChangeOperation.REFRESH; break; } fireDataChanged(operation, e.getItems()); }; this.datasource.addCollectionChangeListener(new WeakCollectionChangeListener(datasource, collectionChangeListener)); }