本文整理汇总了Java中com.vaadin.data.ValueProvider类的典型用法代码示例。如果您正苦于以下问题:Java ValueProvider类的具体用法?Java ValueProvider怎么用?Java ValueProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueProvider类属于com.vaadin.data包,在下文中一共展示了ValueProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ljessendk,项目名称:easybinder,代码行数:27,代码来源:ReflectionBinder.java
示例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);
}
}
开发者ID:ljessendk,项目名称:easybinder,代码行数:22,代码来源:BasicBinder.java
示例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;
}
开发者ID:ljessendk,项目名称:easybinder,代码行数:37,代码来源:BasicBinder.java
示例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);
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:13,代码来源:DefaultItemListing.java
示例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);
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:15,代码来源:DefaultPropertyListing.java
示例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();
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:9,代码来源:DefaultGridPropertyListingBuilder.java
示例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();
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:9,代码来源:DefaultGridItemListingBuilder.java
示例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);
}
};
}
开发者ID:peterl1084,项目名称:bean-grid,代码行数:14,代码来源:BeanGridValueProvider.java
示例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);
}));
}
开发者ID:melistik,项目名称:vaadin-grid-util,代码行数:37,代码来源:DemoUI.java
示例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");
}
开发者ID:ljessendk,项目名称:easybinder,代码行数:6,代码来源:BinderAdapter.java
示例11: getGetter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
public ValueProvider<BEAN, TARGET> getGetter() {
return getter;
}
开发者ID:ljessendk,项目名称:easybinder,代码行数:4,代码来源:BasicBinder.java
示例12: setColumnValueProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public void setColumnValueProvider(final String propId, final ValueProvider<T, ?> valueProvider) {
valueProviders.put(propId, valueProvider);
}
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:5,代码来源:DefaultGridHolder.java
示例13: getGetter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public ValueProvider<PropertyBox, V> getGetter() {
return pb -> (valueProvider != null) ? valueProvider.getPropertyValue(pb) : pb.getValue(property);
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:5,代码来源:DefaultPropertyListing.java
示例14: getPresentationProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public Optional<ValueProvider<?, ?>> getPresentationProvider() {
return Optional.ofNullable(presentationProvider);
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:5,代码来源:DefaultPropertyColumn.java
示例15: setPresentationProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public void setPresentationProvider(ValueProvider<?, ?> presentationProvider) {
this.presentationProvider = presentationProvider;
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:5,代码来源:DefaultPropertyColumn.java
示例16: getGetter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
@Override
public ValueProvider getGetter() {
return new MjTableValueProvider();
}
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:5,代码来源:VaadinTable.java
示例17: getPresentationProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
/**
* Get the presentation provider.
* @return Optional presentation provider
*/
Optional<ValueProvider<?, ?>> getPresentationProvider();
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:6,代码来源:PropertyColumn.java
示例18: setPresentationProvider
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
/**
* Set the presentation provider.
* @param presentationProvider the presentation provider to set
*/
void setPresentationProvider(ValueProvider<?, ?> presentationProvider);
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:6,代码来源:PropertyColumn.java
示例19: getDefaultPropertyPresenter
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
/**
* Get the default presenter to use for given property value.
* @param property Property id
* @return Optional default editor presenter
*/
protected Optional<ValueProvider<?, ?>> getDefaultPropertyPresenter(P property) {
return Optional.empty();
}
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:9,代码来源:DefaultItemListing.java
示例20: render
import com.vaadin.data.ValueProvider; //导入依赖的package包/类
/**
* Set a custom {@link Renderer} and presentation provider for given item property.
* @param <V> Property value type
* @param <P> Presentation value type
* @param property Item property to set the renderer for
* @param presentationProvider Presentation provider
* @param renderer Renderer to use
* @return this
*/
<V, P> GridItemListingBuilder<T> render(String property, ValueProvider<V, P> presentationProvider,
Renderer<? super P> renderer);
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:12,代码来源:ItemListingBuilder.java
注:本文中的com.vaadin.data.ValueProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论