alejandro-du / crudui

Automatically generate CRUD-like Vaadin views for any Java Bean
https://vaadin.com/directory#!addon/crud-ui-add-on
Apache License 2.0
86 stars 54 forks source link

setFieldCaptions add - Error creating Field for property #124

Closed Tyvain closed 1 year ago

Tyvain commented 1 year ago

Hello,

Changing add caption generate a runtime exception:

var formFactory = new DefaultCrudFormFactory<>(DroitsInscriptionLibelleEntity.class);
        formFactory.setFieldCaptions(CrudOperation.ADD, "Ajouter");
        crud.setCrudFormFactory(formFactory);
java.lang.RuntimeException: Error creating Field for property nc.unc.toolbox.tools.scolarix.droitsinscription.DroitsInscriptionLibelleEntity.code
    at org.vaadin.crudui.form.AbstractAutoGeneratedCrudFormFactory.buildFields(AbstractAutoGeneratedCrudFormFactory.java:190) ~[crudui-7.1.0.jar:7.1.0]
    at org.vaadin.crudui.form.impl.form.factory.DefaultCrudFormFactory.buildNewForm(DefaultCrudFormFactory.java:45) ~[crudui-7.1.0.jar:7.1.0]
    at org.vaadin.crudui.crud.impl.AbstractGridCrud.showForm(AbstractGridCrud.java:235) ~[crudui-7.1.0.jar:7.1.0]
    at org.vaadin.crudui.crud.impl.AbstractGridCrud.addButtonClicked(AbstractGridCrud.java:175) ~[crudui-7.1.0.jar:7.1.0]
    at org.vaadin.crudui.crud.impl.AbstractGridCrud.lambda$initLayout$9b1b5227$2(AbstractGridCrud.java:78) ~[crudui-7.1.0.jar:7.1.0]
    at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:206) ~[flow-server-23.1.2
alejandro-du commented 1 year ago

I can't reproduce the issue. The setFieldCaptions method sets the captions for the fields not for the form, if that's what you thought. So you have to specify the captions for all the visible fields in the DroitsInscriptionLibelleEntity class. If you want to set the form title in a widow-based CRUD layout, use the WindowBasedCrudLayout::setWindowCaption method instead.