@SuppressWarnings("unchecked") public EntityCalendarEventProvider (CollectionDatasource datasource) { this.datasource = datasource; collectionChangeListener = createCollectionChangeListener(); itemPropertyChangeListener = createItemPropertyChangeListener(); datasource.addCollectionChangeListener(collectionChangeListener); datasource.addItemPropertyChangeListener(itemPropertyChangeListener); }
protected void addRegionPropertiesDsListener() { reportRegionPropertiesTableDs.addItemChangeListener(e -> showOrHideSortBtns()); reportRegionPropertiesTableDs.addCollectionChangeListener(e -> showOrHideSortBtns()); }
protected void initParametersListeners() { parametersDs.addCollectionChangeListener(e -> { Map<String, Object> paramAliases = new HashMap<>(); for (ReportInputParameter item : e.getDs().getItems()) { paramAliases.put(item.getName(), item.getAlias()); } entitiesParamLookup.setOptionsMap(paramAliases); entityParamLookup.setOptionsMap(paramAliases); }); }
protected void initWidgetTemplateBox() { ddWidgetTemplateBox.setDropHandler(new NotDropHandler()); widgetTemplatesDs.addCollectionChangeListener(e -> updateWidgetTemplates()); widgetTemplatesDs.refresh(); }
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); } }
((CollectionDatasource) dependFrom).addCollectionChangeListener(e -> { if (e.getOperation() == CollectionDatasource.Operation.REFRESH) { datasource.refresh();
@Override public void setBeanLocator(BeanLocator beanLocator) { metadata = beanLocator.get(Metadata.NAME); if (datasource instanceof NestedDatasource) { NestedDatasource nestedDs = (NestedDatasource) this.datasource; MetaProperty nestedDsProperty = nestedDs.getProperty(); MetadataTools metadataTools = beanLocator.get(MetadataTools.NAME); MetaClass masterDsEntityClass = nestedDs.getMaster().getMetaClass(); MetaPropertyPath masterDsMpp = metadataTools.resolveMetaPropertyPath(masterDsEntityClass, nestedDsProperty.getName()); if (masterDsMpp != null) { if (masterDsMpp.getMetaProperty() != nestedDsProperty) { log.debug("Master Datasource property doesn't match with specified nested datasource property"); } else { metaPropertyPath = masterDsMpp; } } else { log.debug("Unable to resolve '{}' for '{}' entity", nestedDsProperty.getName(), masterDsEntityClass); } } datasource.addCollectionChangeListener(this::collectionChanged); }
@SuppressWarnings("unchecked") public void bind(CollectionDatasource ds) { weakItemChangeListener = new WeakItemChangeListener(ds, this); ds.addItemChangeListener(weakItemChangeListener); weakItemPropertyChangeListener = new WeakItemPropertyChangeListener(ds, this); ds.addItemPropertyChangeListener(weakItemPropertyChangeListener); weakStateChangeListener = new WeakStateChangeListener(ds, this); ds.addStateChangeListener(weakStateChangeListener); weakCollectionChangeListener = new WeakCollectionChangeListener(ds, this); ds.addCollectionChangeListener(weakCollectionChangeListener); }
@SuppressWarnings("unchecked") public void bind(CollectionDatasource ds) { ds.addItemChangeListener(new WeakItemChangeListener(ds, this)); ds.addItemPropertyChangeListener(new WeakItemPropertyChangeListener(ds, this)); ds.addStateChangeListener(new WeakStateChangeListener(ds, this)); ds.addCollectionChangeListener(new WeakCollectionChangeListener(ds, this)); } }
@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)); }
@Override public void init(Map<String, Object> params) { super.init(params); attributesTable.unwrap(CubaTable.class) .setTextSelectionEnabled(true); attributesTable.setItemClickAction(editAttributeAction); attributesTable.addGeneratedColumn("type", entity -> { Label<String> label = uiComponents.create(Label.NAME); label.setValue(convertTypeToReadableName(entity.getType())); return label; }); attrDs.addCollectionChangeListener(e -> { if (e.getDs().getItemIds().isEmpty()) { attributesTable.setHeight("80px"); // reduce its height if no attributes } }); removeAction("windowCommit"); }
protected void initAggregationTable() { Supplier<Map<String, Object>> paramsSupplier = () -> ParamsMap.of("existingItems", aggregationsDs.getItems()); CreateAction createAction = CreateAction.create(aggregationsTable); createAction.setWindowParamsSupplier(paramsSupplier); aggregationsTable.addAction(createAction); EditAction editAction = EditAction.create(aggregationsTable); editAction.setWindowParamsSupplier(paramsSupplier); aggregationsTable.addAction(editAction); aggregationsTable.addAction(RemoveAction.create(aggregationsTable)); aggregationsDs.addCollectionChangeListener(e -> { if (e.getOperation() == CollectionDatasource.Operation.REMOVE) { defaultAggregation.setOptionsDatasource(aggregationsDs); } }); }
tipLabel.setValue(getMessage("enterMainParameters")); reportRegionsDs.addCollectionChangeListener(e -> { if (e.getOperation() == CollectionDatasource.Operation.ADD) { regionsTable.setSelected((Collection) e.getItems());
}); usersDs.addCollectionChangeListener(e -> { if (e.getDs().getState() == Datasource.State.VALID) { copyAction.setEnabled(hasPermissionsToCreateUsers && e.getDs().getItem() != null);
lookup.setOptionsDatasource(optionsDataSource); optionsDataSource.addCollectionChangeListener(e -> lookup.setValue(null));