You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2012/04/25 20:43:47 UTC

svn commit: r1330479 - in /myfaces/tobago/trunk: tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/ tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/

Author: lofwyr
Date: Wed Apr 25 18:43:47 2012
New Revision: 1330479

URL: http://svn.apache.org/viewvc?rev=1330479&view=rev
Log:
TOBAGO-1112: Rerendering of a view with date picker after a locale switch doesn't update popup title and button labels

Modified:
    myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java?rev=1330479&r1=1330478&r2=1330479&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java Wed Apr 25 18:43:47 2012
@@ -248,6 +248,10 @@ public class FacesUtils {
     }
   }
 
+  public static void setBindingOrExpression(UIComponent component, String name, String valueBindingOrExpression) {
+    setBindingOrExpression(component, name, createExpressionOrBinding(valueBindingOrExpression));
+  }
+
   public static void addBindingOrExpressionTabChangeListener(TabChangeSource source, String type,
       Object bindingOrExpression) {
     if (USE_BINDING) {

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=1330479&r1=1330478&r2=1330479&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Wed Apr 25 18:43:47 2012
@@ -30,7 +30,6 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UIPanel;
 import org.apache.myfaces.tobago.component.UIPopup;
 import org.apache.myfaces.tobago.component.UITime;
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.event.PopupActionListener;
 import org.apache.myfaces.tobago.internal.util.DateFormatUtils;
 import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
@@ -75,16 +74,14 @@ public class DatePickerRenderer extends 
     popup.setRendered(false);
     popup.onComponentPopulated(facesContext, parent);
 
-    FacesUtils.setBindingOrExpression(
-        popup, Attributes.LEFT, FacesUtils.createExpressionOrBinding("#{tobagoContext.actionPosition.right.pixel + 5}"));
-    FacesUtils.setBindingOrExpression(
-        popup, Attributes.TOP, FacesUtils.createExpressionOrBinding("#{tobagoContext.actionPosition.top.pixel}"));
+    FacesUtils.setBindingOrExpression(popup, Attributes.LEFT, "#{tobagoContext.actionPosition.right.pixel + 5}");
+    FacesUtils.setBindingOrExpression(popup, Attributes.TOP, "#{tobagoContext.actionPosition.top.pixel}");
 
     final UIBox box = (UIBox) CreateComponentUtils.createComponent(
         facesContext, UIBox.COMPONENT_TYPE, RendererTypes.BOX, "box");
     popup.getChildren().add(box);
     // TODO: set string resources in renderer
-    box.setLabel(ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "datePickerTitle"));
+    FacesUtils.setBindingOrExpression(box, Attributes.LABEL, "#{tobagoContext.resourceBundle.datePickerTitle}");
     final UIGridLayout layoutOfBox = (UIGridLayout) CreateComponentUtils.createComponent(
         facesContext, UIGridLayout.COMPONENT_TYPE, RendererTypes.GRID_LAYOUT, "layout");
     box.getFacets().put(Facets.LAYOUT, layoutOfBox);
@@ -137,14 +134,14 @@ public class DatePickerRenderer extends 
     final UIButton okButton = (UIButton) CreateComponentUtils.createComponent(
         facesContext, UIButton.COMPONENT_TYPE, RendererTypes.BUTTON, "ok");
     buttonPanel.getChildren().add(okButton);
-    okButton.setLabel(ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "datePickerOk"));
+    FacesUtils.setBindingOrExpression(okButton, Attributes.LABEL, "#{tobagoContext.resourceBundle.datePickerOk}");
     okButton.setOnclick("writeIntoField2(this);");
     okButton.getAttributes().put(Attributes.POPUP_CLOSE, "afterSubmit");
 
     final UIButton cancelButton = (UIButton) CreateComponentUtils.createComponent(
         facesContext, UIButton.COMPONENT_TYPE, RendererTypes.BUTTON, "cancel");
     buttonPanel.getChildren().add(cancelButton);
-    cancelButton.setLabel(ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "datePickerCancel"));
+    FacesUtils.setBindingOrExpression(okButton, Attributes.LABEL, "#{tobagoContext.resourceBundle.datePickerCancel}");
     cancelButton.setOnclick("writeIntoField2(this);");
     cancelButton.getAttributes().put(Attributes.POPUP_CLOSE, "immediate");