You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/04/30 21:25:16 UTC

svn commit: r398408 - in /myfaces/tobago/trunk: contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/ core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/renderkit/ core/src/main/java/org/ap...

Author: bommel
Date: Sun Apr 30 12:25:15 2006
New Revision: 398408

URL: http://svn.apache.org/viewcvs?rev=398408&view=rev
Log:
fixed checkstyle errors

Modified:
    myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/LoadBundleHandler.java
    myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIMenuSelectOne.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectBooleanTag.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectOneTag.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/XmlUtils.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java

Modified: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/LoadBundleHandler.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/LoadBundleHandler.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/LoadBundleHandler.java (original)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/LoadBundleHandler.java Sun Apr 30 12:25:15 2006
@@ -50,7 +50,7 @@
   }
 
   public void apply(FaceletContext faceletContext, UIComponent parent)
-      throws IOException, FacesException, FaceletException, ELException {
+      throws IOException, FacesException, ELException {
     String name = basename.getValue(faceletContext);
     BundleMapWrapper map = new BundleMapWrapper(name);
     FacesContext facesContext = faceletContext.getFacesContext();

Modified: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java (original)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java Sun Apr 30 12:25:15 2006
@@ -1,5 +1,21 @@
 package org.apache.myfaces.tobago.facelets;
 
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed 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 com.sun.facelets.tag.TagHandler;
 import com.sun.facelets.tag.TagAttribute;
 import com.sun.facelets.tag.TagConfig;
@@ -51,7 +67,7 @@
   }
 
   public void apply(FaceletContext faceletContext, UIComponent parent)
-      throws IOException, FacesException, FaceletException, ELException {
+      throws IOException, FacesException, ELException {
     if (parent instanceof TabChangeSource) {
       // only process if parent was just created
       if (parent.getParent() == null) {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIMenuSelectOne.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIMenuSelectOne.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIMenuSelectOne.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIMenuSelectOne.java Sun Apr 30 12:25:15 2006
@@ -1,19 +1,19 @@
 package org.apache.myfaces.tobago.component;
 
 /*
- * Copyright 2002-2005 The Apache Software Foundation.
- * 
- *    Licensed 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.
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
+ * Licensed 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;

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java Sun Apr 30 12:25:15 2006
@@ -63,16 +63,13 @@
   }
 
   // the following is copied from myfaces shared RendererUtils
-  public Object getConvertedValue(FacesContext facesContext, UIComponent component, Object submittedValue) throws ConverterException {
+  public Object getConvertedValue(FacesContext facesContext, UIComponent component, Object submittedValue)
+      throws ConverterException {
 
-    if (submittedValue == null)
-    {
+    if (submittedValue == null) {
       return null;
-    }
-    else
-    {
-      if (!(submittedValue instanceof String[]))
-      {
+    } else {
+      if (!(submittedValue instanceof String[])) {
         throw new ConverterException("Submitted value of type String[] for component : "
             + component.getClientId(facesContext) + "expected");
       }
@@ -81,144 +78,125 @@
   }
 
   private Object getConvertedUISelectManyValue(FacesContext facesContext,
-                                               UISelectMany component,
-                                               String[] submittedValue)
-            throws ConverterException
-    {
-        // Attention!
-        // This code is duplicated in jsfapi component package.
-        // If you change something here please do the same in the other class!
-
-        if (submittedValue == null) throw new NullPointerException("submittedValue");
-
-        ValueBinding vb = component.getValueBinding("value");
-        Class valueType = null;
-        Class arrayComponentType = null;
-        if (vb != null)
-        {
-            valueType = vb.getType(facesContext);
-            if (valueType != null && valueType.isArray())
-            {
-                arrayComponentType = valueType.getComponentType();
-            }
-        }
+      UISelectMany component,
+      String[] submittedValue)
+      throws ConverterException {
+    // Attention!
+    // This code is duplicated in jsfapi component package.
+    // If you change something here please do the same in the other class!
 
-        Converter converter = component.getConverter();
-        if (converter == null)
-        {
-            if (valueType == null)
-            {
-                // No converter, and no idea of expected type
-                // --> return the submitted String array
-                return submittedValue;
-            }
-
-            if (List.class.isAssignableFrom(valueType))
-            {
-                // expected type is a List
-                // --> according to javadoc of UISelectMany we assume that the element type
-                //     is java.lang.String, and copy the String array to a new List
-                int len = submittedValue.length;
-                List lst = new ArrayList(len);
-                for (int i = 0; i < len; i++)
-                {
-                    lst.add(submittedValue[i]);
-                }
-                return lst;
-            }
-
-            if (arrayComponentType == null)
-            {
-                throw new IllegalArgumentException("ValueBinding for UISelectMany must be of type List or Array");
-            }
-
-            if (String.class.equals(arrayComponentType)) return submittedValue; //No conversion needed for String type
-            if (Object.class.equals(arrayComponentType)) return submittedValue; //No conversion for Object class
-
-            try
-            {
-                converter = facesContext.getApplication().createConverter(arrayComponentType);
-            }
-            catch (FacesException e)
-            {
-                LOG.error("No Converter for type " + arrayComponentType.getName() + " found", e);
-                return submittedValue;
-            }
-        }
+    if (submittedValue == null) {
+      throw new NullPointerException("submittedValue");
+    }
 
-        // Now, we have a converter...
-        // We determine the type of the component array after converting one of it's elements
-        if (vb != null)
-        {
-            valueType = vb.getType(facesContext);
-            if (valueType != null && valueType.isArray())
-            {
-                if (submittedValue.length > 0)
-                {
-                    arrayComponentType = converter.getAsObject(facesContext, component, submittedValue[0]).getClass();
-                }
-            }
-        }
+    ValueBinding vb = component.getValueBinding("value");
+    Class valueType = null;
+    Class arrayComponentType = null;
+    if (vb != null) {
+      valueType = vb.getType(facesContext);
+      if (valueType != null && valueType.isArray()) {
+        arrayComponentType = valueType.getComponentType();
+      }
+    }
 
-        if (valueType == null)
-        {
-            // ...but have no idea of expected type
-            // --> so let's convert it to an Object array
-            int len = submittedValue.length;
-            Object [] convertedValues = (Object []) Array.newInstance(
-                    arrayComponentType==null?Object.class:arrayComponentType,len);
-            for (int i = 0; i < len; i++)
-            {
-                convertedValues[i]
-                    = converter.getAsObject(facesContext, component, submittedValue[i]);
-            }
-            return convertedValues;
-        }
+    Converter converter = component.getConverter();
+    if (converter == null) {
+      if (valueType == null) {
+        // No converter, and no idea of expected type
+        // --> return the submitted String array
+        return submittedValue;
+      }
 
-        if (List.class.isAssignableFrom(valueType))
-        {
-            // Curious case: According to specs we should assume, that the element type
-            // of this List is java.lang.String. But there is a Converter set for this
-            // component. Because the user must know what he is doing, we will convert the values.
-            int len = submittedValue.length;
-            List lst = new ArrayList(len);
-            for (int i = 0; i < len; i++)
-            {
-                lst.add(converter.getAsObject(facesContext, component, submittedValue[i]));
-            }
-            return lst;
+      if (List.class.isAssignableFrom(valueType)) {
+        // expected type is a List
+        // --> according to javadoc of UISelectMany we assume that the element type
+        //     is java.lang.String, and copy the String array to a new List
+        int len = submittedValue.length;
+        List lst = new ArrayList(len);
+        for (int i = 0; i < len; i++) {
+          lst.add(submittedValue[i]);
         }
+        return lst;
+      }
 
-        if (arrayComponentType == null)
-        {
-            throw new IllegalArgumentException("ValueBinding for UISelectMany must be of type List or Array");
-        }
+      if (arrayComponentType == null) {
+        throw new IllegalArgumentException("ValueBinding for UISelectMany must be of type List or Array");
+      }
 
-        if (arrayComponentType.isPrimitive())
-        {
-            //primitive array
-            int len = submittedValue.length;
-            Object convertedValues = Array.newInstance(arrayComponentType, len);
-            for (int i = 0; i < len; i++)
-            {
-                Array.set(convertedValues, i,
-                          converter.getAsObject(facesContext, component, submittedValue[i]));
-            }
-            return convertedValues;
-        }
-        else
-        {
-            //Object array
-            int len = submittedValue.length;
-            ArrayList convertedValues = new ArrayList(len);
-            for (int i = 0; i < len; i++)
-            {
-                convertedValues.add(i, converter.getAsObject(facesContext, component, submittedValue[i]));
-            }
-            return convertedValues.toArray((Object[]) Array.newInstance(arrayComponentType, len));
+      if (String.class.equals(arrayComponentType)) {
+        return submittedValue; //No conversion needed for String type
+      }
+      if (Object.class.equals(arrayComponentType)) {
+        return submittedValue; //No conversion for Object class
+      }
+
+      try {
+        converter = facesContext.getApplication().createConverter(arrayComponentType);
+      } catch (FacesException e) {
+        LOG.error("No Converter for type " + arrayComponentType.getName() + " found", e);
+        return submittedValue;
+      }
+    }
+
+    // Now, we have a converter...
+    // We determine the type of the component array after converting one of it's elements
+    if (vb != null) {
+      valueType = vb.getType(facesContext);
+      if (valueType != null && valueType.isArray()) {
+        if (submittedValue.length > 0) {
+          arrayComponentType = converter.getAsObject(facesContext, component, submittedValue[0]).getClass();
         }
+      }
+    }
+
+    if (valueType == null) {
+      // ...but have no idea of expected type
+      // --> so let's convert it to an Object array
+      int len = submittedValue.length;
+      Object [] convertedValues = (Object []) Array.newInstance(
+          arrayComponentType == null ? Object.class : arrayComponentType, len);
+      for (int i = 0; i < len; i++) {
+        convertedValues[i]
+            = converter.getAsObject(facesContext, component, submittedValue[i]);
+      }
+      return convertedValues;
+    }
+
+    if (List.class.isAssignableFrom(valueType)) {
+      // Curious case: According to specs we should assume, that the element type
+      // of this List is java.lang.String. But there is a Converter set for this
+      // component. Because the user must know what he is doing, we will convert the values.
+      int len = submittedValue.length;
+      List lst = new ArrayList(len);
+      for (int i = 0; i < len; i++) {
+        lst.add(converter.getAsObject(facesContext, component, submittedValue[i]));
+      }
+      return lst;
+    }
+
+    if (arrayComponentType == null) {
+      throw new IllegalArgumentException("ValueBinding for UISelectMany must be of type List or Array");
     }
 
+    if (arrayComponentType.isPrimitive()) {
+      //primitive array
+      int len = submittedValue.length;
+      Object convertedValues = Array.newInstance(arrayComponentType, len);
+      for (int i = 0; i < len; i++) {
+        Array.set(convertedValues, i,
+            converter.getAsObject(facesContext, component, submittedValue[i]));
+      }
+      return convertedValues;
+    } else {
+      //Object array
+      int len = submittedValue.length;
+      ArrayList convertedValues = new ArrayList(len);
+      for (int i = 0; i < len; i++) {
+        convertedValues.add(i, converter.getAsObject(facesContext, component, submittedValue[i]));
+      }
+      return convertedValues.toArray((Object[]) Array.newInstance(arrayComponentType, len));
+    }
+  }
 }
 
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectBooleanTag.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectBooleanTag.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectBooleanTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectBooleanTag.java Sun Apr 30 12:25:15 2006
@@ -1,10 +1,5 @@
 package org.apache.myfaces.tobago.taglib.component;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.servlet.jsp.JspException;
-
 /*
  * Copyright 2002-2005 The Apache Software Foundation.
  *
@@ -20,6 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.jsp.JspException;
 
 @Deprecated
 public class MenuSelectBooleanTag extends SelectBooleanCommandTag

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectOneTag.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectOneTag.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectOneTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectOneTag.java Sun Apr 30 12:25:15 2006
@@ -1,10 +1,5 @@
 package org.apache.myfaces.tobago.taglib.component;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.servlet.jsp.JspException;
-
 /*
  * Copyright 2002-2005 The Apache Software Foundation.
  *
@@ -20,6 +15,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.jsp.JspException;
 
 /*
   * Created 14.09.2004 at 12:03:45.

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/XmlUtils.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/XmlUtils.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/XmlUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/XmlUtils.java Sun Apr 30 12:25:15 2006
@@ -1,21 +1,5 @@
 package org.apache.myfaces.tobago.util;
 
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.Properties;
-
 /*
  * Copyright 2002-2005 The Apache Software Foundation.
  *
@@ -32,6 +16,22 @@
  * limitations under the License.
  */
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.Properties;
+
 public class XmlUtils {
 
   public static String escape(String s) {
@@ -116,8 +116,8 @@
   static void importProperties(Properties properties, Element propertiesElement) {
     NodeList entries = propertiesElement.getChildNodes();
     int numEntries = entries.getLength();
-    int start = numEntries > 0 &&
-        entries.item(0).getNodeName().equals("comment") ? 1 : 0;
+    int start = numEntries > 0
+        && entries.item(0).getNodeName().equals("comment") ? 1 : 0;
     for (int i = start; i < numEntries; i++) {
       Node child = entries.item(i);
       if (child instanceof Element) {

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java?rev=398408&r1=398407&r2=398408&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java Sun Apr 30 12:25:15 2006
@@ -131,7 +131,7 @@
       if (o instanceof UIMenu) {
         writer.startElement("span");
         writer.writeAttribute("style", "position: relative; background: " + bac + ";", null);
-        writeMenuEntry(facesContext, writer, (UIMenu)o);
+        writeMenuEntry(facesContext, writer, (UIMenu) o);
         writer.endElement("span");
         bac = "lime";
       }
@@ -242,7 +242,8 @@
     return "new Tobago.Menu.Item('" + removeLFs(stringWriter.toString()) + "', null)";
   }
 
-  private void writeMenuEntry(FacesContext facesContext, TobagoResponseWriter writer, UIPanel uiPanel) throws IOException {
+  private void writeMenuEntry(FacesContext facesContext, TobagoResponseWriter writer,
+      UIPanel uiPanel) throws IOException {
     final boolean disabled
         = ComponentUtil.getBooleanAttribute(uiPanel, ATTR_DISABLED);
     final boolean topMenu = (uiPanel.getParent().getRendererType() != null)