ICEfaces
  1. ICEfaces
  2. ICE-2147

Seam LocaleSelector() part of framework does not work with ICEfaces

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.8RC1, 1.8
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      any Seam/ICEfaces combination
    • Affects:
      Compatibility/Configuration
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      We worked around this issue by extending the D2DSeamFaceletViewHandler class from IceFaces and overriding the calculateLocale method to call the LocaleSelector.calculateLocale method from Seam. We retrieve the LocaleSelector from the JSF SessionContext using the name "org.jboss.seam.international.localeSelector". We then configured our new class as the view handler in faces-config.xml and now the LocaleSelector works properly for us.
      Show
      We worked around this issue by extending the D2DSeamFaceletViewHandler class from IceFaces and overriding the calculateLocale method to call the LocaleSelector.calculateLocale method from Seam. We retrieve the LocaleSelector from the JSF SessionContext using the name "org.jboss.seam.international.localeSelector". We then configured our new class as the view handler in faces-config.xml and now the LocaleSelector works properly for us.

      Description

      org.jboss.seam.international.LocaleSelector has method with same name as D2DViewHandler for calculateLocale().

      When trying to use this part of seam framework with ICEfaces, our D2DViewhandler:calculateLocale() gets called and it does entirely something different from the seam version....so just doesn't work.

      See ICE-2145, which indicates that we should have components to do this as well as timezone selection.

        Activity

        Hide
        Judy Guglielmin added a comment -

        Actually it's the jsf view handler that also has the same method (seam calls it and it comes back to the LocaleSelector method with same name)...kind of confusing.

        Show
        Judy Guglielmin added a comment - Actually it's the jsf view handler that also has the same method (seam calls it and it comes back to the LocaleSelector method with same name)...kind of confusing.
        Hide
        Judy Guglielmin added a comment -

        It doesn't look like our D2DViewHandler supports dynamic loading of messages bundles. I could only get the window title to change languages dynamically (after a refresh, of course).

        Show
        Judy Guglielmin added a comment - It doesn't look like our D2DViewHandler supports dynamic loading of messages bundles. I could only get the window title to change languages dynamically (after a refresh, of course).
        Hide
        Mark Collette added a comment -

        Try this again after ICE-2485 is resolved.

        Show
        Mark Collette added a comment - Try this again after ICE-2485 is resolved.
        Hide
        Frank Worsley added a comment -

        Hello, we worked around this issue by extending the D2DSeamFaceletViewHandler class from IceFaces and overriding the calculateLocale method to call the LocaleSelector.calculateLocale method from Seam. We retrieve the LocaleSelector from the JSF SessionContext using the name "org.jboss.seam.international.localeSelector". We then configured our new class as the view handler in faces-config.xml and now the LocaleSelector works properly for us.

        Show
        Frank Worsley added a comment - Hello, we worked around this issue by extending the D2DSeamFaceletViewHandler class from IceFaces and overriding the calculateLocale method to call the LocaleSelector.calculateLocale method from Seam. We retrieve the LocaleSelector from the JSF SessionContext using the name "org.jboss.seam.international.localeSelector". We then configured our new class as the view handler in faces-config.xml and now the LocaleSelector works properly for us.
        Hide
        Raffaele Spazzoli added a comment -

        Hi Frank,
        can you attach the workaround for version 1.7?
        thanks
        Raffaele

        Show
        Raffaele Spazzoli added a comment - Hi Frank, can you attach the workaround for version 1.7? thanks Raffaele
        Hide
        Deryk Sinotte added a comment -

        Mircea,

        Please take a look at this and see if the suggested workaround makes sense.

        Show
        Deryk Sinotte added a comment - Mircea, Please take a look at this and see if the suggested workaround makes sense.
        Hide
        Peter Buchmann added a comment -

        Based on Frank Worsley's instruction, thats how I changed the calculateLocale() method.
        Any feedback to this hack is highly appreciated.
        Regards from a sunny Zurich, Switzerland
        Peter Buchmann

        --------------------------------------------------------------------------------------------------------------

        public class D2DSeamFaceletViewHandlerLocaleFix extends
        com.icesoft.faces.facelets.D2DSeamFaceletViewHandler {

        public D2DSeamFaceletViewHandlerLocaleFix(ViewHandler delegate)

        { super(delegate); }

        @Override
        public Locale calculateLocale(FacesContext context) {
        SeamApplication application = (SeamApplication)context.getApplication();
        ELContext elContext = context.getELContext();
        ValueExpression valueExpression = application.getExpressionFactory().createValueExpression(elContext, "#

        {org.jboss.seam.international.localeSelector}

        ", Object.class);
        Object obj = valueExpression.getValue(elContext);

        return ((LocaleSelector)obj).calculateLocale(context.getExternalContext().getRequestLocale());
        }

        }

        Show
        Peter Buchmann added a comment - Based on Frank Worsley's instruction, thats how I changed the calculateLocale() method. Any feedback to this hack is highly appreciated. Regards from a sunny Zurich, Switzerland Peter Buchmann -------------------------------------------------------------------------------------------------------------- public class D2DSeamFaceletViewHandlerLocaleFix extends com.icesoft.faces.facelets.D2DSeamFaceletViewHandler { public D2DSeamFaceletViewHandlerLocaleFix(ViewHandler delegate) { super(delegate); } @Override public Locale calculateLocale(FacesContext context) { SeamApplication application = (SeamApplication)context.getApplication(); ELContext elContext = context.getELContext(); ValueExpression valueExpression = application.getExpressionFactory().createValueExpression(elContext, "# {org.jboss.seam.international.localeSelector} ", Object.class); Object obj = valueExpression.getValue(elContext); return ((LocaleSelector)obj).calculateLocale(context.getExternalContext().getRequestLocale()); } }
        Hide
        Mircea Toma added a comment - - edited

        Delegate calculateLocale() call to SeamViewHandler. LocaleSelector assumes that SeamViewHandler is the configured ViewHandler (see LocaleSelector.java:155).

        Show
        Mircea Toma added a comment - - edited Delegate calculateLocale() call to SeamViewHandler. LocaleSelector assumes that SeamViewHandler is the configured ViewHandler (see LocaleSelector.java:155).

          People

          • Assignee:
            Unassigned
            Reporter:
            Judy Guglielmin
          • Votes:
            8 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: