java - how to bind field to foreign key in bean vaadin -
I have my sister as this
public class registration entity {Private long account Number; Private string first name; Private string middlename; Personal string last name; // Business Unit is another table, the professionalism of personal business; } components are like this
first name = new textfield ("first name"); FirstName.setRequired (true); FirstName.setWidth (COMMON_FIELD_WIDTH); LastName = New TextField ("Last Name"); LastName.setRequired (true); LastName.setWidth (COMMON_FIELD_WIDTH); Business = new basic selection ("business:"); Occupation.setRequired (true); Occupation.setImmediate (true); Occupation.setWidth (COMMON_FIELD_WIDTH); Occupation.setNullSelectionItemId ("- Select--"); Occupation.addItem ("static"); As long as the first name and last name are assumed, this can be bound in such a way
fieldgroup.bind (first name, "first name "); But how can I force business resident to occupationEntity ?????
"itemprop =" text "> You can use BeanFieldGroup and Custom FieldGroupFieldFactory for this matter: Binder = New Beanfield Group & lt; Registration Entity & gt; (RegistrationInternet.class); Binder.setFieldFactory (New FieldGroupFieldFactory () {Private DefaultFieldGroupFieldFactory defaultFactory = New DefaultFieldGroupFieldFactory (); @Override Public & lt; t createField (Class TYPE; datatype, class fieldType) { If ("OccupationEntity" T field is expanded gt. Equals (dataType.getName ()) {Binimum Container & quot; Occupation Entity> Capture Entity Container = New Bean Content Container & lt; Business Components & gt; ProfessionalAxA Category); ProfessionalismAncientContactor.Ad All (All Entity); Field Field = New Combat Box ("Business:", Occupational Antennor); (Explained) Area) .setItemCaptionPropertyId (- Insert Title Bean property here--), ((Combobox area) .setNullSelectionAllowed (false); FieldType.cast (region) return;} return defaultFactory.createField (datatype, fieldType);}}); Binder.setItemDataSource (item);
Comments
Post a Comment