Java Code Examples for com.vaadin.ui.Field#setCaption()

The following examples show how to use com.vaadin.ui.Field#setCaption() . 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: ConfigurableFieldFactory.java    From jdal with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
	
	BeanItem<?> beanItem = (BeanItem<?>) item;
	
	Field f = getField(propertyId, beanItem.getBean().getClass());

	if (f != null) {
		f.setCaption(createCaptionByPropertyId(propertyId));
	}
	else {
		// fail back to default
		f = super.createField(item, propertyId, uiContext);
	}
	
	applyFieldProcessors(f, propertyId);
	
	return f;
}
 
Example 2
Source File: AnnotationFieldFactory.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Field createField(Item item, Object propertyId, Component uiContext) {
	if (item instanceof BeanItem<?>) {
		BeanItem<?> bi = (BeanItem<?>) item;
		String name = (String) propertyId;
		Class<?> clazz = bi.getBean().getClass();
		java.lang.reflect.Field field = ReflectionUtils.findField(clazz, name);
		Annotation[] fa = new Annotation[] {};
		if (field != null) {
			fa = field.getAnnotations();
		}
		java.lang.reflect.Method method = BeanUtils.getPropertyDescriptor(clazz, name).getReadMethod();
		Annotation[] ma = method.getAnnotations();
		Annotation[] annotations = (Annotation[]) ArrayUtils.addAll(fa, ma);
		Field f = null;
		for (Annotation a : annotations) {
			f = findField(a, clazz, name);
			if (f != null) {
				f.setCaption(createCaptionByPropertyId(propertyId));
				applyFieldProcessors(f, propertyId);
				return f;
			}
		}
	}
	// fall back to default
	return super.createField(item, propertyId, uiContext);
}
 
Example 3
Source File: FieldWrapper.java    From sensorhub with Mozilla Public License 2.0 4 votes vote down vote up
public FieldWrapper(Field<T> innerField)
{
    this.innerField = innerField;
    this.setCaption(innerField.getCaption());
    innerField.setCaption(null);
}