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 2009/06/25 18:49:49 UTC

svn commit: r788424 - in /myfaces/tobago/branches/tobago-1.0.x: core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/util/ core/src/test/java/org/apache/myfaces/tobago/util/ sandbox/src/main/java/org/apac...

Author: lofwyr
Date: Thu Jun 25 16:49:49 2009
New Revision: 788424

URL: http://svn.apache.org/viewvc?rev=788424&view=rev
Log:
code style:
rename StringUtil to StringUtils

Added:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java
Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/test/java/org/apache/myfaces/tobago/util/StringUtilUnitTest.java
    myfaces/tobago/branches/tobago-1.0.x/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SimpleSheetRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?rev=788424&r1=788423&r2=788424&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Thu Jun 25 16:49:49 2009
@@ -33,8 +33,8 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ROW_RANGE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH_LIST_STRING;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
 import static org.apache.myfaces.tobago.TobagoConstants.FACET_RELOAD;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
 import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
 import org.apache.myfaces.tobago.ajax.api.AjaxPhaseListener;
 import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
@@ -50,7 +50,7 @@
 import org.apache.myfaces.tobago.renderkit.SheetRendererWorkaround;
 import org.apache.myfaces.tobago.util.LayoutInfo;
 import org.apache.myfaces.tobago.util.LayoutUtil;
-import org.apache.myfaces.tobago.util.StringUtil;
+import org.apache.myfaces.tobago.util.StringUtils;
 
 import javax.faces.component.UIColumn;
 import javax.faces.component.UIComponent;
@@ -292,7 +292,7 @@
     }
 
     if (widthListString != null) {
-      currentWidthList = StringUtil.parseIntegerList(widthListString);
+      currentWidthList = StringUtils.parseIntegerList(widthListString);
     }
     if (currentWidthList != null && currentWidthList.size() != rendererdColumns.size()) {
       currentWidthList = null;

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java?rev=788424&r1=788423&r2=788424&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java Thu Jun 25 16:49:49 2009
@@ -25,7 +25,7 @@
 import org.apache.myfaces.tobago.model.TreeState;
 import org.apache.myfaces.tobago.taglib.component.ToolBarTag;
 import org.apache.myfaces.tobago.util.MessageFactory;
-import org.apache.myfaces.tobago.util.StringUtil;
+import org.apache.myfaces.tobago.util.StringUtils;
 
 import javax.faces.application.FacesMessage;
 import javax.faces.component.ActionSource;
@@ -205,7 +205,7 @@
       command.getAttributes().put(
           TobagoConstants.ATTR_IMAGE, "image/tobago.tree." + commands[i].getCommand() + ".gif");
       String title = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
-          "tree" + StringUtil.firstToUpperCase(commands[i].getCommand()));
+          "tree" + StringUtils.firstToUpperCase(commands[i].getCommand()));
       command.getAttributes().put(TobagoConstants.ATTR_TIP, title);
 
     }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java?rev=788424&r1=788423&r2=788424&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java Thu Jun 25 16:49:49 2009
@@ -17,9 +17,9 @@
  * limitations under the License.
  */
 
+import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.lang.math.NumberUtils;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INLINE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_HEIGHT;
@@ -31,9 +31,9 @@
 import static org.apache.myfaces.tobago.TobagoConstants.FACET_LABEL;
 import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
 import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.LayoutTokens;
 import org.apache.myfaces.tobago.component.UICell;
 import org.apache.myfaces.tobago.component.UIForm;
-import org.apache.myfaces.tobago.component.LayoutTokens;
 import org.apache.myfaces.tobago.renderkit.LayoutInformationProvider;
 
 import javax.faces.component.UIComponent;
@@ -280,7 +280,7 @@
     return LayoutTokens.parseToken(columnToken) != null;
   }
 
-  // XXX perhaps move to StringUtil
+  // XXX perhaps move to StringUtils
   public static String stripNonNumericChars(String token) {
     if (token == null || token.length() == 0) {
       return token;

Added: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java?rev=788424&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java Thu Jun 25 16:49:49 2009
@@ -0,0 +1,53 @@
+package org.apache.myfaces.tobago.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+/**
+ * @deprecated Please use StringUtils
+ * @see StringUtils
+ */
+@Deprecated
+public class StringUtil {
+
+  private StringUtil() {
+  }
+
+  @Deprecated
+  public static String firstToUpperCase(String string) {
+    return StringUtils.firstToUpperCase(string);
+  }
+
+  @Deprecated
+  public static List<Integer> parseIntegerList(String integerList)
+      throws NumberFormatException {
+   return StringUtils.parseIntegerList(integerList);
+  }
+
+  @Deprecated
+  public static <T> String toString(List<T> list) {
+    return StringUtils.toString(list);
+  }
+
+  @Deprecated
+  public static String escapeAccessKeyIndicator(String label) {
+    return StringUtils.escapeAccessKeyIndicator(label);
+  }
+
+}

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/test/java/org/apache/myfaces/tobago/util/StringUtilUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/test/java/org/apache/myfaces/tobago/util/StringUtilUnitTest.java?rev=788424&r1=788423&r2=788424&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/test/java/org/apache/myfaces/tobago/util/StringUtilUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/test/java/org/apache/myfaces/tobago/util/StringUtilUnitTest.java Thu Jun 25 16:49:49 2009
@@ -22,13 +22,13 @@
 public class StringUtilUnitTest extends TestCase {
 
   public void test() {
-    assertNull(StringUtil.firstToUpperCase(null));
-    assertEquals("", StringUtil.firstToUpperCase(""));
-    assertEquals("1", StringUtil.firstToUpperCase("1"));
-    assertEquals("X", StringUtil.firstToUpperCase("x"));
-    assertEquals("Xxx", StringUtil.firstToUpperCase("xxx"));
-    assertEquals("XxxXxxx", StringUtil.firstToUpperCase("xxxXxxx"));
-    assertEquals("Xxx", StringUtil.firstToUpperCase("Xxx"));
-    assertEquals(" x ", StringUtil.firstToUpperCase(" x "));
+    assertNull(StringUtils.firstToUpperCase(null));
+    assertEquals("", StringUtils.firstToUpperCase(""));
+    assertEquals("1", StringUtils.firstToUpperCase("1"));
+    assertEquals("X", StringUtils.firstToUpperCase("x"));
+    assertEquals("Xxx", StringUtils.firstToUpperCase("xxx"));
+    assertEquals("XxxXxxx", StringUtils.firstToUpperCase("xxxXxxx"));
+    assertEquals("Xxx", StringUtils.firstToUpperCase("Xxx"));
+    assertEquals(" x ", StringUtils.firstToUpperCase(" x "));
   }
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SimpleSheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SimpleSheetRenderer.java?rev=788424&r1=788423&r2=788424&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SimpleSheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SimpleSheetRenderer.java Thu Jun 25 16:49:49 2009
@@ -19,18 +19,15 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.lang.StringUtils;
-
 import org.apache.myfaces.tobago.TobagoConstants;
-import org.apache.myfaces.tobago.util.StringUtil;
-import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.component.ComponentUtil;
-import org.apache.myfaces.tobago.component.UIData;
-import org.apache.myfaces.tobago.component.UIPage;
+import org.apache.myfaces.tobago.component.UIColumnEvent;
 import org.apache.myfaces.tobago.component.UIColumnSelector;
 import org.apache.myfaces.tobago.component.UICommand;
-import org.apache.myfaces.tobago.component.UIColumnEvent;
+import org.apache.myfaces.tobago.component.UIData;
+import org.apache.myfaces.tobago.component.UIPage;
 import org.apache.myfaces.tobago.component.UIReload;
+import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.context.ResourceManager;
 import org.apache.myfaces.tobago.context.ResourceManagerFactory;
 import org.apache.myfaces.tobago.model.SheetState;
@@ -39,10 +36,11 @@
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
 import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
+import org.apache.myfaces.tobago.util.StringUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
-import javax.faces.component.UIComponent;
 import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
@@ -172,7 +170,7 @@
     writer.writeIdAttribute(sheetId + WIDTHS_POSTFIX);
     writer.writeNameAttribute(sheetId + WIDTHS_POSTFIX);
     writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
-    writer.writeAttribute(HtmlAttributes.VALUE, StringUtil.toString(columnWidths), false);
+    writer.writeAttribute(HtmlAttributes.VALUE, StringUtils.toString(columnWidths), false);
     writer.endElement(HtmlConstants.INPUT);
 
     writer.startElement(HtmlConstants.INPUT, null);
@@ -193,7 +191,7 @@
       writer.writeIdAttribute(sheetId + SELECTED_POSTFIX);
       writer.writeNameAttribute(sheetId + SELECTED_POSTFIX);
       writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
-      writer.writeAttribute(HtmlAttributes.VALUE, StringUtil.toString(selectedRows), false);
+      writer.writeAttribute(HtmlAttributes.VALUE, StringUtils.toString(selectedRows), false);
       writer.endElement(HtmlConstants.INPUT);
     }
     ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
@@ -228,7 +226,7 @@
       String[] rowMarkups = (String[]) data.getAttributes().get("rowMarkup");
       String rowMarkup = "";
       if (rowMarkup != null) {
-        rowMarkup = " " + StringUtils.join(rowMarkups, " ");
+        rowMarkup = " " + org.apache.commons.lang.StringUtils.join(rowMarkups, " ");
       }
 
       writer.startElement(HtmlConstants.DIV, null);

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=788424&r1=788423&r2=788424&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Thu Jun 25 16:49:49 2009
@@ -17,14 +17,9 @@
  * limitations under the License.
  */
 
-/*
- * Created 07.02.2003 16:00:00.
- * $Id$
- */
-
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.TobagoConstants;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALIGN;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DIRECT_LINK_COUNT;
@@ -85,9 +80,8 @@
 import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
 import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import org.apache.myfaces.tobago.util.StringUtil;
+import org.apache.myfaces.tobago.util.StringUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import org.apache.myfaces.tobago.TobagoConstants;
 
 import javax.faces.application.Application;
 import javax.faces.component.UIColumn;
@@ -229,14 +223,14 @@
     SheetState state = data.getSheetState(facesContext);
     List<Integer> columnWidths = data.getWidthList();
 
-    String selectedRows = StringUtil.toString(getSelectedRows(data, state));
+    String selectedRows = StringUtils.toString(getSelectedRows(data, state));
     List<UIColumn> renderedColumnList = data.getRenderedColumns();
 
     writer.startElement(HtmlConstants.INPUT, null);
     writer.writeIdAttribute(sheetId + WIDTHS_POSTFIX);
     writer.writeNameAttribute(sheetId + WIDTHS_POSTFIX);
     writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
-    writer.writeAttribute(HtmlAttributes.VALUE, StringUtil.toString(columnWidths), false);
+    writer.writeAttribute(HtmlAttributes.VALUE, StringUtils.toString(columnWidths), false);
     writer.endElement(HtmlConstants.INPUT);
 
     writer.startElement(HtmlConstants.INPUT, null);
@@ -640,7 +634,7 @@
       }
       List<Integer> selectedRows;
       try {
-        selectedRows = StringUtil.parseIntegerList(selected);
+        selectedRows = StringUtils.parseIntegerList(selected);
       } catch (NumberFormatException e) {
         LOG.warn(selected, e);
         selectedRows = Collections.emptyList();
@@ -845,7 +839,7 @@
       String onclick = "Tobago.submitAction2(this, '" + sortCommand.getClientId(facesContext) + "', null, null)";
       writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, false);
 
-      if (StringUtils.isNotEmpty(tip)) {
+      if (org.apache.commons.lang.StringUtils.isNotEmpty(tip)) {
         tip +=  " - ";
       }
       tip += ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "sheetTipSorting");
@@ -1024,7 +1018,7 @@
         facet.getAttributes().put(ATTR_MENU_POPUP, Boolean.TRUE);
         facet.getAttributes().put(ATTR_MENU_POPUP_TYPE, "SheetSelector");
       }
-      if (StringUtils.isBlank((String) facet.getAttributes().get(ATTR_IMAGE))) {
+      if (org.apache.commons.lang.StringUtils.isBlank((String) facet.getAttributes().get(ATTR_IMAGE))) {
         facet.getAttributes().put(ATTR_IMAGE, "image/sheetSelectorMenu.gif");
       }