本文整理汇总了Java中com.vaadin.data.ValueProvider类的典型用法代码示例。如果您正苦于以下问题:Java ValueProvider类的具体用法?Java ValueProvider怎么用?Java ValueProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueProvider类属于com.vaadin.data包,在下文中一共展示了ValueProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public <PRESENTATION, MODEL> EasyBinding<BEAN, PRESENTATION, MODEL> bind(HasValue<PRESENTATION> field,
String propertyName, Converter<PRESENTATION, ?> converter, boolean readOnly) {
Objects.requireNonNull(converter);
Objects.requireNonNull(propertyName, "Property name cannot be null");
// checkUnbound();
PropertyDefinition<BEAN, ?> definition = propertySet.getProperty(propertyName)
.orElseThrow(() -> new IllegalArgumentException(
"Could not resolve property name " + propertyName + " from " + propertySet));
ValueProvider<BEAN, ?> getter = definition.getGetter();
Setter<BEAN, ?> setter = readOnly ? null : definition.getSetter().orElse(null);
EasyBinding<BEAN, PRESENTATION, MODEL> binding = bind(field, (ValueProvider) getter, (Setter) setter,
propertyName, (Converter) converter);
boundProperties.put(propertyName, binding);
Optional<Field> modelField = getDeclaredFieldByName(definition.getPropertyHolderType(), definition.getName());
if (Arrays.asList(modelField.get().getAnnotations()).stream().anyMatch(requiredConfigurator)) {
field.setRequiredIndicatorVisible(true);
}
return binding;
}
示例2: EasyBinding
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
public EasyBinding(BasicBinder<BEAN> binder, HasValue<FIELDVALUE> field, ValueProvider<BEAN, TARGET> getter,
Setter<BEAN, TARGET> setter, String property,
Converter<FIELDVALUE, TARGET> converterValidatorChain) {
this.field = field;
this.getter = getter;
this.setter = setter;
this.property = property;
this.converterValidatorChain = converterValidatorChain;
registration = field.addValueChangeListener(e -> {
if (binder.getBean() != null) {
if (binder.fieldToBean(this)) {
binder.fireValueChangeEvent(e);
}
}
});
if (setter == null) {
field.setReadOnly(true);
}
}
示例3: bind
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
public <FIELDVALUE, TARGET> EasyBinding<BEAN, FIELDVALUE, TARGET> bind(HasValue<FIELDVALUE> field,
ValueProvider<BEAN, TARGET> getter, Setter<BEAN, TARGET> setter, String property,
Converter<FIELDVALUE, TARGET> converter) {
Objects.requireNonNull(field);
Objects.requireNonNull(getter);
Objects.requireNonNull(converter);
// Register as binding
EasyBinding<BEAN, FIELDVALUE, TARGET> binding = new EasyBinding<BEAN, FIELDVALUE, TARGET>(this, field, getter,
setter, property, converter);
// TODO: remove from binding
/*
* binding.registration = field.addValueChangeListener(e -> { if (getBean() !=
* null) { if(fieldToBean(binding)) { fireValueChangeEvent(e); } } });
*/
bindings.add(binding);
// Add property to validation error map
if (property != null) {
propertyToBindingMap.put(property, binding);
}
if (getBean() != null) {
if (fieldToBean(binding)) {
// TODO: should this be fired?
// fireValueChangeEvent(e);
}
} else {
fireStatusChangeEvent();
}
return binding;
}
示例4: getPropertyPresenter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
/**
* Get the presenter to use with given property id.
* @param property Property id
* @return Optional property value presenter
*/
protected Optional<ValueProvider<?, ?>> getPropertyPresenter(P property) {
Optional<ValueProvider<?, ?>> propertyPresenter = getPropertyColumn(property).getPresentationProvider();
if (propertyPresenter.isPresent()) {
return propertyPresenter;
}
return getDefaultPropertyPresenter(property);
}
示例5: getDefaultPropertyPresenter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Optional<ValueProvider<?, ?>> getDefaultPropertyPresenter(Property property) {
if (property != null) {
if (Component.class.isAssignableFrom(property.getType())) {
return Optional.empty();
}
if (FontIcon.class.isAssignableFrom(property.getType())) {
return Optional.of(v -> ((FontIcon) v).getHtml());
}
return Optional.of(v -> property.present(v));
}
return super.getDefaultPropertyPresenter(property);
}
示例6: render
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public <T, P> GridPropertyListingBuilder render(Property<T> property, ValueProvider<T, P> presentationProvider,
Renderer<? super P> renderer) {
ObjectUtils.argumentNotNull(property, "Property must be not null");
getInstance().getPropertyColumn(property).setPresentationProvider(presentationProvider);
getInstance().getPropertyColumn(property).setRenderer(renderer);
return builder();
}
示例7: render
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public <V, P> GridItemListingBuilder<T> render(String property, ValueProvider<V, P> presentationProvider,
Renderer<? super P> renderer) {
ObjectUtils.argumentNotNull(property, "Property must be not null");
getInstance().getPropertyColumn(property).setPresentationProvider(presentationProvider);
getInstance().getPropertyColumn(property).setRenderer(renderer);
return builder();
}
示例8: getGetter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
default <ITEM> ValueProvider<ITEM, Object> getGetter(ColumnDefinition definition) {
return item -> {
try {
PROPERTY_TYPE modelValue = (PROPERTY_TYPE) definition.getPropertyType()
.cast(definition.getReadMethod().invoke(item));
return requiresConversion() ? asConvertable().convert(modelValue) : modelValue;
} catch (Exception e) {
throw new RuntimeException(e);
}
};
}
示例9: setColumnRenderes
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
private void setColumnRenderes(final Grid grid) {
grid.getColumn("id")
.setRenderer(
new EditDeleteButtonValueRenderer<Inhabitants>(edit -> {
Notification.show(edit.getItem()
.toString() + " want's to get edited", Type.HUMANIZED_MESSAGE);
}, delete -> {
Notification.show(delete.getItem()
.toString() + " want's to get deleted", Type.WARNING_MESSAGE);
}))
.setWidth(160);
grid.getColumn("bodySize")
.setRenderer(new IndicatorRenderer(1.8, 1.1))
.setWidth(150);
grid.getColumn("birthday")
.setRenderer(new DateRenderer(DateFormat.getDateInstance()))
.setWidth(210);
grid.getColumn("onFacebook")
.setRenderer(new BooleanRenderer())
.setWidth(130);
/*
* the icon of the editButton will get overwritten below by css styling @see DemoUI.initColumnAlignments
*/
grid.addColumn((ValueProvider<Inhabitants, String>) value -> String.format("%s <i>(%d)</i>",
value.getCountry()
.getName(),
value.getCountry()
.getPopulation()), new EditButtonValueRenderer<Inhabitants>(e -> {
Notification.show("Goto Link for " + e.getItem()
.getCountry()
.getName(), Type.HUMANIZED_MESSAGE);
}));
}
示例10: bind
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public <FIELDVALUE> Binding<BEAN, FIELDVALUE> bind(HasValue<FIELDVALUE> field,
ValueProvider<BEAN, FIELDVALUE> getter, Setter<BEAN, FIELDVALUE> setter) {
throw new UnsupportedOperationException("Not supported");
}
示例11: getGetter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
public ValueProvider<BEAN, TARGET> getGetter() {
return getter;
}
示例12: setColumnValueProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public void setColumnValueProvider(final String propId, final ValueProvider<T, ?> valueProvider) {
valueProviders.put(propId, valueProvider);
}
示例13: getGetter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public ValueProvider<PropertyBox, V> getGetter() {
return pb -> (valueProvider != null) ? valueProvider.getPropertyValue(pb) : pb.getValue(property);
}
示例14: getPresentationProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public Optional<ValueProvider<?, ?>> getPresentationProvider() {
return Optional.ofNullable(presentationProvider);
}
示例15: setPresentationProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public void setPresentationProvider(ValueProvider<?, ?> presentationProvider) {
this.presentationProvider = presentationProvider;
}