Details
-
Improvement
-
Resolution: Fixed
-
Major
-
5.0
-
None
Description
In many content apps, i.e. info.magnolia.ui.app.contacts.ContactsMainSubApp I am seeing overriding AbstractContentSubApp#getCaption() method and return an hardcoded string with (sub)app name. Since sub and app descriptors already provide us with this info, it would make coding an Content App even simpler and cleaner if we'd just used that caption in the default impl of AbstractContentSubApp#getCaption(). Something like the following. Notice that if the subAppDescriptor#getLabel() is blank we fallback to the appDescriptor()#getLabel(). If the latter is blank too we warn the user with a message.
@Override
public String getCaption() {
String label = subAppContext.getSubAppDescriptor().getLabel();
if(StringUtils.isNotBlank(label)) {
return label;
}
label = subAppContext.getAppContext().getAppDescriptor().getLabel();
return StringUtils.isNotBlank(label) ? label : "missing App label";
}
Checklists
Acceptance criteria