Skip to content

Inherited Form Fields #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lbispham opened this issue Mar 12, 2018 · 3 comments
Closed

Inherited Form Fields #78

lbispham opened this issue Mar 12, 2018 · 3 comments

Comments

@lbispham
Copy link

Description

I have form fields that are reused across multiple forms. I want to put them into a base class and have the individual forms inherit some of their fields from their parent class.

Steps to Reproduce

Simplified example:

public class GeneralSettings implements Serializable {

@Tab(title = "General Settings", index = 0)
@CheckBox(title = "Enabled")
private boolean enabled;

public boolean getEnabled() {
    return enabled;
}

}

public class MoreSettings extends GeneralSettings {

@Tab(title = "More Settings", index = 1)
private int maximum;

public int getMaximum() {
    return maximum;
}

}

To run:
UiForm uiForm = UiFormSchemaGenerator.get().generate(MoreSettings.class);

Expected behavior: [What you expect to happen]

I expect the schema to contain two properties and the form to contain two nodes: enabled and maximum

Actual behavior: [What actually happens]

The generated schema contains both fields, but the form contains only the field declared in MoreSettings, not the field declared in its parent.

Versions

1.0.0

Additional Information

I see a call to getDeclaredFields() inside UiFormSchemaGenerator.generate() so maybe this behavior is intentional. Please let me know.

Thanks!

@SaifJerbi
Copy link
Member

Hi @lbispham,
Thanks for using SF-JAVA-UI Library.
I'm working on this issue, it will be fixed in 1.0.1 ASAP

@SaifJerbi SaifJerbi self-assigned this Mar 12, 2018
@SaifJerbi SaifJerbi added the bug label Mar 12, 2018
@SaifJerbi SaifJerbi added this to the 1.0.1 milestone Mar 12, 2018
@lbispham
Copy link
Author

Thank you for creating this library! It is exactly what I needed.

SaifJerbi pushed a commit that referenced this issue Mar 12, 2018
expected behavior : The form definition contains the inherited fields
fix #78
@SaifJerbi
Copy link
Member

SaifJerbi commented Mar 12, 2018

Hi @lbispham
The issue was fixed and already delivered in the version 1.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants