shale-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Mitev (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SHALE-269) Convenient programmatic access to localized messages
Date Wed, 13 Sep 2006 07:39:31 GMT
    [ http://issues.apache.org/struts/browse/SHALE-269?page=comments#action_38200 ] 
            
Adrian Mitev commented on SHALE-269:
------------------------------------

A good idea too is to add method for error message using the component id instead of the component
object. Thisway the developer won't need to have a binding to the component only to add an
error message. Also method for finding component in the root will be useful:

public static UIComponent findComponentInRoot(String id) {
   return getFacesContext().getViewRoot().findComponent(id);
}

Methods for navigation:

public void gotoView(String viewName) {
    if (viewName!= null) {
      UIViewRoot view = getApplication().getViewHandler().createView(getFacesContext(),viewName);
      getFacesContext().setViewRoot(view );
    }
}

public void navigate(String fromView,String outcome) {
  getApplication().getNavigationHandler().handleNavigation(getFacesContext(),fromView, outcome);
}


> Convenient programmatic access to localized messages
> ----------------------------------------------------
>
>                 Key: SHALE-269
>                 URL: http://issues.apache.org/struts/browse/SHALE-269
>             Project: Shale
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 1.0.3
>            Reporter: Craig McClanahan
>            Priority: Minor
>
> From the Shale User Mailing List (Adrian Mitev 	<amittev@gmail.com>):
> ==========
> Hi! It is a good idea to add method like addMessageFromBundle that
> does something like this:
> public void addMessageFromBundle(UIComponent component,String
> bundleMessageKey) {
>        ResourceBundle bundle = null;
>        try {
>            bundle = ResourceBundle.getBundle(getFacesContext()
>                    .getApplication().getMessageBundle());
>            String message = bundle.getString(bundleMessageKey);
>            error(componeng,message);
>        } catch (MissingResourceException e) {
>            e.printStackTrace();
>        }
>    }
> ==========
> We might also look at ways to provide for parameter replacement in such messages.
> Seam also has a cute utility that lets you build messages out of EL expressions for parameter
replacement.

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

        

Mime
View raw message