[ 
http://jira.magnolia-cms.com/browse/MGNLUI-262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Federico Grilli updated MGNLUI-262:
-----------------------------------

    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.

{code}
@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";
    }
{code}

  was:
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 at our disposal 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.

{code}
@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";
    }
{code}


> Hardcoded captions for apps
> ---------------------------
>
>                 Key: MGNLUI-262
>                 URL: http://jira.magnolia-cms.com/browse/MGNLUI-262
>             Project: Magnolia UI
>          Issue Type: Improvement
>      Security Level: Public
>          Components: content app
>            Reporter: Federico Grilli
>            Priority: Major
>             Fix For: 5.0
>
>
> 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.
> {code}
> @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";
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to