click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r758554 - in /incubator/click/trunk/click/framework: src/org/apache/click/util/ContainerUtils.java test/org/apache/click/util/ContainerUtilsTest.java
Date Thu, 26 Mar 2009 08:36:52 GMT
Author: sabob
Date: Thu Mar 26 08:36:46 2009
New Revision: 758554

URL: http://svn.apache.org/viewvc?rev=758554&view=rev
Log:
removed findByType method, not as useful as anticipated

Modified:
    incubator/click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java
    incubator/click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java

Modified: incubator/click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java?rev=758554&r1=758553&r2=758554&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java Thu
Mar 26 08:36:46 2009
@@ -319,35 +319,6 @@
                         return found;
                     }
                 }
-
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Find and return the first control of a given type in the specified
-     * container.
-     * <p/>
-     * Please note that this method does exact matching. If the given type is a
-     * superclass of a control, it won't count as a match.
-     *
-     * @param container the container that is searched for a control of a
-     * given type
-     * @param type the type of the control to find
-     * @return the control which type matched the given type
-     */
-    public static Control findControlByType(Container container, Class type) {
-        for (int i = 0; i < container.getControls().size(); i++) {
-            Control childControl = (Control) container.getControls().get(i);
-
-            if (childControl.getClass().equals(type)) {
-                return childControl;
-            } else {
-                if (childControl instanceof Container) {
-                    Container childContainer = (Container) childControl;
-                    return findControlByType(childContainer, type);
-                }
             }
         }
         return null;

Modified: incubator/click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java?rev=758554&r1=758553&r2=758554&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java
(original)
+++ incubator/click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java
Thu Mar 26 08:36:46 2009
@@ -71,34 +71,6 @@
     }
 
     /**
-     * Check that the first control of specified type if found in container.
-     */
-    public void testFindControlByType() {
-        MockContext.initContext();
-        // set up the form
-        Form form = new Form("sample");
-
-        Panel panel = new Panel("panel");
-
-        form.add(panel);
-
-        panel.add(new Label("label1"));
-
-        // TextField to find
-        Field field1 = new TextField("field1");
-        panel.add(field1);
-
-        panel.add(new Label("label2"));
-        panel.add(new TextField("field2"));
-
-        Field result = (Field) ContainerUtils.findControlByType(form,
-            TextField.class);
-
-        // Check that field1 was found
-        assertEquals(field1, result);
-    }
-
-    /**
      * Check that domain class with duplicate getter methods resolves to the
      * no-argument version.
      *



Mime
View raw message