Updating a formData class [message #1854522] |
Tue, 23 August 2022 16:46  |
Eclipse User |
|
|
|
Hi there everyone,
1) I created an abstract class for addresses and I added it to a group box in a form. Unfortunately, the address box's contents do NOT appear in the formData class. I even tried adding the @FormData annotation to the address box and its contents as follows to no avail:
@FormData
public AddressBox getAddressBox() {
return getFieldByClass(AddressBox.class);
}
@FormData
public StreetField getStreetField() {
// return getFieldByClass(AddressBox.class).getFieldByClass(StreetField.class);
return getAddressBox().getFieldByClass(StreetField.class);
}
@FormData
public CityField getCityField() {
return getAddressBox().getLocationBox().getFieldByClass(CityField.class);
}
@FormData
public PostalCodeField getPostalCodeField() {
return getAddressBox().getLocationBox().getFieldByClass(PostalCodeField.class);
}
@FormData
public CountryField getCountryField() {
return getAddressBox().getFieldByClass(CountryField.class);
}
How do I regenerate this existing formData class in order to show my address box fields?
2) In addition, I have another form that I already created but during the form's creation, I did NOT check the boxes for; Create FormData, Create Service and Create Permission. I realised my omission an now I want to add FormData, Service and Permissions classes for managing the form. Is it possible to do this without starting the form creation process all over again?
I've done some searching and I saw this StackOverflow post: https://stackoverflow.com/questions/25994014/extends-form-data-in-scout-eclipse that has a recommendation to ("Update all formData classes" in the scout explorer). However, I've not been able to locate this command in the Eclipse IDE.
Thanks for your assistance.
Cheers,
JD
|
|
|
Re: Updating a formData class [message #1854532 is a reply to message #1854522] |
Wed, 24 August 2022 07:05   |
Eclipse User |
|
|
|
(1) I understand you have an public abstract class AbstractAddressBox extends AbstractGroupBox which you include in one or more other classes (forms) - a template group box.
Does your template group box have its own data class? If not, you could create one by adding the following annotation to the AbstractAddressBox (you might have to create AbstractAddressBoxData in your shared project manually before adding the annotation):
@FormData(value = AbstractAddressBoxData.class, // <1>
sdkCommand = SdkCommand.CREATE,
defaultSubtypeSdkCommand = DefaultSubtypeSdkCommand.CREATE)
public abstract class AbstractAddressBox extends AbstractGroupBox {
After it has its own data class, try re-creating the @FormData for the form and check if the template field is available in the ...FormData.java file.
Some documentation for template fields is available at https://eclipsescout.github.io/11.0/one-day-tutorial.html#sec-contacts_form_templatefields_more
(2) Unfortunately I do not know if you can manually trigger the creation process after the form has already been created; however if you created the SomeForm w/o the corresponding classes you could create a Some2Form with all checkboxes checked and afterwards compare the classes with your SomeForm (maybe search/replace Some2 to Some).
You could also easily create the FormData class for your form by adding the @FormData annotation, it should be created automatically then.
[Updated on: Wed, 24 August 2022 07:09] by Moderator Report message to a moderator
|
|
|
Re: Updating a formData class [message #1854565 is a reply to message #1854532] |
Thu, 25 August 2022 18:23  |
Eclipse User |
|
|
|
Hi there Matthias,
Thank you so much for your reply and your advice. It worked perfectly. It is invaluable for me because I have a lot of abstract classes for reuse in my forms.
Cheers,
JD
|
|
|
Powered by
FUDForum. Page generated in 0.03988 seconds