com.vaadin.server.SerializableFunction Java Examples

The following examples show how to use com.vaadin.server.SerializableFunction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
@Override
public <C> void setDataProvider(final DataProvider<T, C> dataProvider, final SerializableFunction<String, C> filterConverter) {
    Objects.requireNonNull(dataProvider, "dataProvider cannot be null");
    Objects.requireNonNull(filterConverter, "filterConverter cannot be null");

    final SerializableFunction<String, C> convertOrNull = filterText -> {
        if (filterText == null || filterText.isEmpty()) {
            return null;
        }

        return filterConverter.apply(filterText);
    };

    final SerializableConsumer<C> providerFilterSlot = internalSetDataProvider(dataProvider, convertOrNull.apply(this.currentFilterText));

    this.filterSlot = filter -> providerFilterSlot.accept(convertOrNull.apply(filter));
}
 
Example #2
Source File: ComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
@Override
public <C> void setDataProvider(final DataProvider<T, C> dataProvider, final SerializableFunction<String, C> filterConverter) {
    Objects.requireNonNull(dataProvider, "dataProvider cannot be null");
    Objects.requireNonNull(filterConverter, "filterConverter cannot be null");

    final SerializableFunction<String, C> convertOrNull = filterText -> {
        if (filterText == null || filterText.isEmpty()) {
            return null;
        }

        return filterConverter.apply(filterText);
    };

    final SerializableConsumer<C> providerFilterSlot = internalSetDataProvider(dataProvider, convertOrNull.apply(this.currentFilterText));

    this.filterSlot = filter -> providerFilterSlot.accept(convertOrNull.apply(filter));
}
 
Example #3
Source File: CubaFoldersPane.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Stream<T> getChildrenRecursively(T parent) {
    Supplier<Stream<T>> children = () -> getChildren(parent);
    Stream<T> items = children.get().flatMap((SerializableFunction<T, Stream<T>>)
            this::getChildrenRecursively);

    return Stream.concat(children.get(), items);
}
 
Example #4
Source File: BuildCriterionComponent.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private Object getConvertedValue(HasValue<?> component) {
    if (component instanceof Converter) {
        Converter converter = (Converter) component;
        Result result = converter.convertToModel(component.getValue(), null);
        try {
            return result.getOrThrow(SerializableFunction.identity());
        } catch (Throwable throwable) {
            throw new MyCollabException(throwable);
        }
    }
    return component.getValue();
}