/** * Creates a binder using a custom {@link PropertySet} implementation for * finding and resolving property names for * {@link #bindInstanceFields(Object)}, {@link #bind(HasValue, String)} and * {@link BindingBuilder#bind(String)}. * <p> * This functionality is provided as static method instead of as a public * constructor in order to make it possible to use a custom property set * without creating a subclass while still leaving the public constructors * focused on the common use cases. * * @see Binder#Binder() * @see Binder#Binder(Class) * * @param propertySet * the property set implementation to use, not <code>null</code>. * @return a new binder using the provided property set, not * <code>null</code> */ public static <BEAN> Binder<BEAN> withPropertySet( PropertySet<BEAN> propertySet) { return new Binder<>(propertySet); }
/** * onstructs the entity edit form for the data entity * @param beanType The class of the data entity * @param idIsEditable Whether the id is editable */ public AbstractEntityEditForm( final Class<T> beanType, final boolean idIsEditable) { this.binder = new Binder<>(beanType); if (idIsEditable) { this.binder.forField(idField) //.withConverter(new StringToLongConverter("Unable to convert id")) .asRequired("The id field is required.") .bind("id"); } else { this.binder.forField(idField) //.withConverter(new StringToLongConverter("Unable to convert id")) .bind("id"); } this.binder.addStatusChangeListener(this::onBinderStatusChange); setSpacing(true); setMargin(false); setSizeFull(); Responsive.makeResponsive(this); idField.setReadOnly(!idIsEditable); idField.setWidth(100.0f, Unit.PERCENTAGE); }
public NewEntryForm (GLTransaction transaction, TransactionsHelper helper, EntryGrid entryGrid) { super(); try { this.transaction = transaction.clone(); } catch (CloneNotSupportedException e) { // Log error and ignore. Clone should be supported. QI.getQI().getLog().error(e); } this.journal = transaction.getJournal(); this.helper = helper; this.app = QI.getQI(); this.entryGrid = entryGrid; setStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); setSpacing(true); setWidthUndefined(); GLEntry entry = new GLEntry(); binder = new Binder (GLEntry.class); createAndBindFields(binder); binder.setBean(entry); binder.setReadOnly(true); addEntryBtn = new Button(app.getMessage("addEntry")); addEntryBtn.addClickListener(addEntryClickListener(binder)); addEntryBtn.setEnabled(false); addEntryBtn.setStyleName(ValoTheme.BUTTON_FRIENDLY); addComponent(addEntryBtn); setComponentAlignment(addEntryBtn, Alignment.BOTTOM_CENTER); }
panelContent.setExpandRatio(form, 1f); passwordBinder = new Binder<>(); passwordBinder.setReadOnly(true); binderIsReadOnly=true;