/** * @see com.vaadin.ui.DefaultFieldFactory#createField(com.vaadin.data.Container, java.lang.Object, java.lang.Object, com.vaadin.ui.Component) */ @Override public Field<?> createField(Container container, Object itemId, Object propertyId, Component uiContext) { Field<?> result = null; if (PROPERTY_ALLOWED.equals(propertyId) || PROPERTY_DENIED.equals(propertyId)) { result = super.createField(container, itemId, propertyId, uiContext); result.setCaption(""); } return result; } };
/** * Post process created {@link Field} for additional setup * @param <F> Field type * @param field Field to process * @param property Property * @return processed field */ @SuppressWarnings("unchecked") protected <F> Field<F> postProcessField(Field field, Property<? extends T> property) { // caption field.setCaption(LocalizationContext.translate(property, true)); return field; }
@Override public Field createField(Item item, Object propertyId, Component uiContext) { Class<?> type = item.getItemProperty(propertyId).getType(); Field field = createFieldByPropertyType(type); field.setCaption(createCaptionByPropertyId(propertyId)); return field; }
@Override public Field createField(Item item, Object propertyId, Component uiContext) { // Field f = super.createField(item, propertyId, uiContext); Field f = null; // if ("comment".equals(propertyId)) { // TextField tf = new TextField(); // tf.setRequired(true); // tf.setRequiredError(getMessage("processdata.comments.comment.comment.required")); // tf.setNullRepresentation(""); // tf.setInputPrompt(getMessage("processdata.comments.comment.comment.prompt")); // tf.setWidth(400, Sizeable.UNITS_PIXELS); // f = tf; // } else if ("body".equals(propertyId)) { RichTextArea rta = new RichTextArea(); rta.setRequired(true); rta.setNullRepresentation(""); rta.setRequiredError(getMessage("processdata.comments.comment.body.required")); rta.setWidth(400, Sizeable.UNITS_PIXELS); rta.focus(); f = rta; } if (f != null) f.setCaption(getMessage("processdata.comments.comment.form." + propertyId)); return f; } });
field.setCaption(this.buildCaption(jfield.getName(), !(field instanceof CheckBox)));
field.setCaption(this.buildCaption(jfield.getName(), !(field instanceof CheckBox)));
public HelpButton(Field<T> field) { Validate.notNull(field); this.field = field; CssLayout layout = new CssLayout(); setCompositionRoot(layout); Button btHelp = new Button(""); btHelp.setIcon(FontAwesome.QUESTION); btHelp.addStyleName(ChameleonTheme.BUTTON_BORDERLESS); btHelp.addStyleName("helpbutton"); btHelp.addClickListener((Button.ClickListener) this); setCaption(field.getCaption()); field.setCaption(null); layout.addComponent(field); layout.addComponent(btHelp); }
field.setCaption(createCaptionByPropertyId(property.getPropertyId())); } else { field.setCaption(property.getName());
field.setCaption(getLocalizedMessage(doc.humanNameKey())); field.setDescription(getParametrizedLocalizedMessage( "description.format", )); } else { field.setCaption(getLocalizedMessage((String) propertyId)); field.setDescription(getParametrizedLocalizedMessage( "description.short.format",
ret.setCaption(""); ret.setStyleName("readOnly"); ret.setEnabled(false);
f.setCaption(getMessage("processdata.comments.assignee.form." + propertyId)); f.setRequiredError(getMessage("processdata.comments.assignee.form." + propertyId + ".required"));
@Override public void selectionChanged(SelectionChangedEvent changeEvent) { if (parameter != null) { try { blockListenerOrValidators = true; setData(changeEvent.getSelectedBean()); setItemId(changeEvent.getSelectedItemId()); final BeanItem beanItem = new BeanItem(changeEvent.getSelectedBean(), parameter.getEditablePropertyName(), parameter.getNonEditablePropertyName()); // this is a hack, but we need to know if the selection changed beanItem.addItemProperty("selected", changeEvent.getSelectedItem().getItemProperty("selected")); captionLabel.setValue(String.format("<b>%s</b>", parameter.getCaption())); fieldGroup = new FieldGroup(); fieldGroup.setBuffered(false); fieldGroup.bind(selectedField, "selected"); fieldGroup.bind(editableField, parameter.getEditablePropertyName()); fieldGroup.bind(nonEditableField, parameter.getNonEditablePropertyName()); fieldGroup.setItemDataSource(beanItem); fieldGroup.getField(parameter.getNonEditablePropertyName()).setCaption(parameter.getNonEditablePropertyCaption()); fieldGroup.getField(parameter.getNonEditablePropertyName()).setReadOnly(true); fieldGroup.getField(parameter.getEditablePropertyName()).setCaption(parameter.getEditablePropertyCaption()); fieldGroup.getField(parameter.getEditablePropertyName()).setReadOnly(false); updateEnabledState(); UIHelper.validateField(editableField, true); } finally { blockListenerOrValidators = false; } } }
skipDefaultVMField.setCaption("Skip JVM MBeans"); skipDefaultVMField.setId(MetaConfigModel.SKIP_DEFAULT_VM); ((AbstractComponent) skipDefaultVMField).setDescription("Set to include/exclude default JavaVM MBeans"); skipNonNumberField.setCaption("Skip non-number values"); ((AbstractComponent) skipNonNumberField).setDescription("Set to include/exclude non-number values"); addComponent(skipNonNumberField);