cuba-platform / documentation

CUBA Platform Documentation
https://www.cuba-platform.com
Creative Commons Attribution 4.0 International
26 stars 45 forks source link

Add examples of using @Install handlers #606

Closed knstvk closed 4 years ago

knstvk commented 4 years ago

Environment

Description of the bug or enhancement

For methods like setOptionImageProvider() (i.e. setters of providers) add examples of using them with @Install (by generating this code in Studio "Handlers" tab):

@Inject
private Image imageResource;

@Install(to = "fooLookupField", subject = "optionImageProvider")
private Resource fooLookupFieldOptionImageProvider(Foo foo) {
    String iconName = Boolean.TRUE.equals(foo.getStatus()) ? "icons/active.svg" : "icons/inactive.svg";
    return imageResource.createResource(ThemeResource.class).setPath(iconName);
}
knstvk commented 4 years ago

Duplicate of #474