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 2010/05/25 16:32:09 UTC

svn commit: r948060 - in /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src: main/java/org/apache/myfaces/tobago/renderkit/html/util/ main/java/org/apache/myfaces/tobago/renderkit/util/ test/java/org/apache/myfaces/tobago/renderkit/util/

Author: lofwyr
Date: Tue May 25 14:32:09 2010
New Revision: 948060

URL: http://svn.apache.org/viewvc?rev=948060&view=rev
Log:
clean up

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java?rev=948060&r1=948059&r2=948060&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java Tue May 25 14:32:09 2010
@@ -18,8 +18,6 @@ package org.apache.myfaces.tobago.render
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UIPopup;
@@ -29,6 +27,8 @@ import org.apache.myfaces.tobago.event.P
 import org.apache.myfaces.tobago.internal.component.UICommandBase;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.util.VariableResolverUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.application.Application;
 import javax.faces.application.ViewHandler;
@@ -100,11 +100,11 @@ public class CommandRendererHelper {
           boolean popupAction = ComponentUtils.containsPopupActionListener(command);
           if (popupAction) {
             if (componentIds.length != 1) {
-              LOG.warn("more than one parially rendered component is not supported for popup! using first one: "
+              LOG.warn("more than one partially rendered component is not supported for popup! using first one: "
               + Arrays.toString(componentIds));
             }
             onclick = "Tobago.openPopupWithAction(this, '"
-                + HtmlRendererUtils.getComponentId(facesContext, command, componentIds[0]) + "', '" + clientId + "')";
+                + HtmlRendererUtils.getComponentId(facesContext, command, componentIds[0]) + "', '" + clientId + "');";
           } else {
             onclick = "Tobago.reloadComponent(this, '"
                 + HtmlRendererUtils.getComponentIds(facesContext, command, componentIds) + "','" + clientId + "', {});";

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtils.java?rev=948060&r1=948059&r2=948060&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtils.java Tue May 25 14:32:09 2010
@@ -83,12 +83,12 @@ public class JQueryUtils {
   }
 
   /**
-   * Creates a selector for an id like $('#id').
+   * Creates a selector for an id like jQuery('#id').
    * The id will be escaped if necessary.
    */
   public static String selectId(String id) {
     StringBuilder builder = new StringBuilder();
-    builder.append("$('#");
+    builder.append("jQuery('#");
     builder.append(escapeId(id));
     builder.append("')");
     return builder.toString();

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java?rev=948060&r1=948059&r2=948060&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java Tue May 25 14:32:09 2010
@@ -17,15 +17,15 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.config.Configurable;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
@@ -130,19 +130,6 @@ public class RenderUtils {
     }
   }
 
-  //TODO move to HtmlRendererUtils
-  public static String addMenuCheckToggle(String clientId, String onClick) {
-    if (onClick != null) {
-      onClick = " ; " + onClick;
-    } else {
-      onClick = "";
-    }
-
-    onClick = "menuCheckToggle('" + clientId + "')" + onClick;
-
-    return onClick;
-  }
-
   public static String getFormattedValue(
       FacesContext facesContext, UIComponent component) {
     Object value = null;
@@ -195,6 +182,9 @@ public class RenderUtils {
 
   private static Measure calculateStringWidth(
       FacesContext facesContext, Configurable component, String text, String type) {
+    if (text == null) {
+      return Measure.ZERO;
+    }
     int width = 0;
     int defaultCharWidth = 0;
     try {
@@ -234,11 +224,9 @@ public class RenderUtils {
 
     List<SelectItem> selectItems = getSelectItems(component);
 
-    String renderRange = (String)
-        component.getAttributes().get(Attributes.RENDER_RANGE_EXTERN);
+    String renderRange = (String) component.getAttributes().get(Attributes.RENDER_RANGE_EXTERN);
     if (renderRange == null) {
-      renderRange = (String)
-          component.getAttributes().get(Attributes.RENDER_RANGE);
+      renderRange = (String) component.getAttributes().get(Attributes.RENDER_RANGE);
     }
     if (renderRange == null) {
       return selectItems;
@@ -252,7 +240,7 @@ public class RenderUtils {
         items.add(selectItems.get(indice));
       }
     } else {
-      LOG.warn("No items found! rendering dummys instead!");
+      LOG.warn("No items found! rendering dummies instead!");
       for (int i = 0; i < indices.length; i++) {
         items.add(new SelectItem(Integer.toString(i), "Item " + i, ""));
       }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java?rev=948060&r1=948059&r2=948060&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java Tue May 25 14:32:09 2010
@@ -64,6 +64,6 @@ public class JQueryUtilsUnitTest {
 
   @Test
   public void selectId() {
-    Assert.assertEquals("$('#test\\\\:test')", JQueryUtils.selectId("test:test"));
+    Assert.assertEquals("jQuery('#test\\\\:test')", JQueryUtils.selectId("test:test"));
   }
 }