[richfaces-svn-commits] JBoss Rich Faces SVN: r18773 - in trunk: core/impl/src/test/java/org/richfaces/component/util and 8 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Aug 18 13:24:08 EDT 2010


Author: Alex.Kolonitsky
Date: 2010-08-18 13:24:07 -0400 (Wed, 18 Aug 2010)
New Revision: 18773

Added:
   trunk/ui/common/api/src/main/java/org/richfaces/component/SwitchType.java
   trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java
   trunk/ui/common/ui/src/test/java/org/
   trunk/ui/common/ui/src/test/java/org/richfaces/
   trunk/ui/common/ui/src/test/java/org/richfaces/renderkit/
   trunk/ui/common/ui/src/test/java/org/richfaces/renderkit/util/
   trunk/ui/common/ui/src/test/java/org/richfaces/renderkit/util/FormUtilTest.java
Removed:
   trunk/core/impl/src/main/java/org/richfaces/component/util/FormUtil.java
   trunk/core/impl/src/test/java/org/richfaces/component/util/FormUtilTest.java
   trunk/ui/output/api/src/main/java/org/richfaces/component/SwitchType.java
Log:
RF-9010 TogglePanel improve diagnostic of "form not found" case

Deleted: trunk/core/impl/src/main/java/org/richfaces/component/util/FormUtil.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/component/util/FormUtil.java	2010-08-18 17:16:46 UTC (rev 18772)
+++ trunk/core/impl/src/main/java/org/richfaces/component/util/FormUtil.java	2010-08-18 17:24:07 UTC (rev 18773)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- *  JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007  Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- */
-
-package org.richfaces.component.util;
-
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.richfaces.component.EnclosingFormRequiredException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.context.FacesContext;
-
-/**
- * @author Filip Antonov - mailto:fantonov at exadel.com
- *         created 08.02.2007
- */
-public final class FormUtil {
-    private FormUtil() {
-    }
-
-    public static void throwEnclFormReqExceptionIfNeed(FacesContext context, UIComponent component)
-        throws EnclosingFormRequiredException {
-
-        UIForm form = RendererUtils.getInstance().getNestingForm(context, component);
-
-        // TODO nick -> nick - switchType checking can be harmful here
-        String switchType = (String) component.getAttributes().get("switchType");
-        boolean isSwitchTypeClient = (switchType == null) ? false : switchType.equalsIgnoreCase("client");
-
-        if ((form == null) && !isSwitchTypeClient) {
-            throw new EnclosingFormRequiredException(component.getClass().toString() + " (id=\"" + component.getId()
-                + "\") did not find parent form.");
-        }
-    }
-}

Deleted: trunk/core/impl/src/test/java/org/richfaces/component/util/FormUtilTest.java
===================================================================
--- trunk/core/impl/src/test/java/org/richfaces/component/util/FormUtilTest.java	2010-08-18 17:16:46 UTC (rev 18772)
+++ trunk/core/impl/src/test/java/org/richfaces/component/util/FormUtilTest.java	2010-08-18 17:24:07 UTC (rev 18773)
@@ -1,83 +0,0 @@
-/**
- * License Agreement.
- *
- *  JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007  Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- */
-
-
-
-package org.richfaces.component.util;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.UIViewRoot;
-
-import org.jboss.test.faces.AbstractFacesTest;
-import org.richfaces.component.EnclosingFormRequiredException;
-
-/**
- * @author Nick Belaevski - nbelaevski at exadel.com
- * created 11.04.2007
- *
- */
-public class FormUtilTest extends AbstractFacesTest {
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        setupFacesRequest();
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testThrowEnclFormReqExceptionIfNeed() throws Exception {
-        UIViewRoot viewRoot = facesContext.getViewRoot();
-        UIComponent form = application.createComponent(UIForm.COMPONENT_TYPE);
-
-        viewRoot.getChildren().add(form);
-
-        UIComponent testComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
-
-        form.getChildren().add(testComponent);
-        FormUtil.throwEnclFormReqExceptionIfNeed(facesContext, testComponent);
-    }
-
-    public void testThrowEnclFormReqExceptionIfNeedNoForm() throws Exception {
-        UIViewRoot viewRoot = facesContext.getViewRoot();
-        UIComponent testComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
-
-        viewRoot.getChildren().add(testComponent);
-
-        try {
-            FormUtil.throwEnclFormReqExceptionIfNeed(facesContext, testComponent);
-            fail();
-        } catch (EnclosingFormRequiredException e) {}
-    }
-
-    public void testThrowEnclFormReqExceptionIfNeedClient() throws Exception {
-        UIViewRoot viewRoot = facesContext.getViewRoot();
-        UIComponent testComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
-
-        testComponent.getAttributes().put("switchType", "CLIENT");
-        viewRoot.getChildren().add(testComponent);
-        FormUtil.throwEnclFormReqExceptionIfNeed(facesContext, testComponent);
-    }
-}

Copied: trunk/ui/common/api/src/main/java/org/richfaces/component/SwitchType.java (from rev 18768, trunk/ui/output/api/src/main/java/org/richfaces/component/SwitchType.java)
===================================================================
--- trunk/ui/common/api/src/main/java/org/richfaces/component/SwitchType.java	                        (rev 0)
+++ trunk/ui/common/api/src/main/java/org/richfaces/component/SwitchType.java	2010-08-18 17:24:07 UTC (rev 18773)
@@ -0,0 +1,24 @@
+package org.richfaces.component;
+
+/**
+ * @author akolonitsky
+ * @since Jun 15, 2010
+ */
+public enum SwitchType {
+    /**
+     * value for tab change method for - client-side tabs.
+     */
+    client,
+
+    /**
+     * value for tab change method - server-side tabs
+     */
+    server,
+
+    /**
+     * value for tab change method - ajax tabs
+     */
+    ajax;
+
+    public static final SwitchType DEFAULT = SwitchType.ajax;
+}

Copied: trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java (from rev 18768, trunk/core/impl/src/main/java/org/richfaces/component/util/FormUtil.java)
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java	                        (rev 0)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/FormUtil.java	2010-08-18 17:24:07 UTC (rev 18773)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.util;
+
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.component.EnclosingFormRequiredException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Filip Antonov - mailto:fantonov at exadel.com
+ *         created 08.02.2007
+ */
+public final class FormUtil {
+    private FormUtil() {
+    }
+
+    public static void throwEnclFormReqExceptionIfNeed(FacesContext context, UIComponent component)
+        throws EnclosingFormRequiredException {
+
+        UIForm form = RendererUtils.getInstance().getNestingForm(context, component);
+
+        // TODO nick -> nick - switchType checking can be harmful here
+        String switchType = (String) component.getAttributes().get("switchType");
+        boolean isSwitchTypeClient = (switchType == null) ? false : switchType.equalsIgnoreCase("client");
+
+        if ((form == null) && !isSwitchTypeClient) {
+            throw new EnclosingFormRequiredException(component.getClass().toString() + " (id=\"" + component.getId()
+                + "\") did not find parent form.");
+        }
+    }
+}

Copied: trunk/ui/common/ui/src/test/java/org/richfaces/renderkit/util/FormUtilTest.java (from rev 18768, trunk/core/impl/src/test/java/org/richfaces/component/util/FormUtilTest.java)
===================================================================
--- trunk/ui/common/ui/src/test/java/org/richfaces/renderkit/util/FormUtilTest.java	                        (rev 0)
+++ trunk/ui/common/ui/src/test/java/org/richfaces/renderkit/util/FormUtilTest.java	2010-08-18 17:24:07 UTC (rev 18773)
@@ -0,0 +1,81 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.util;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+
+import org.jboss.test.faces.AbstractFacesTest;
+import org.richfaces.component.EnclosingFormRequiredException;
+
+/**
+ * @author Nick Belaevski - nbelaevski at exadel.com
+ * created 11.04.2007
+ *
+ */
+public class FormUtilTest extends AbstractFacesTest {
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        setupFacesRequest();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testThrowEnclFormReqExceptionIfNeed() throws Exception {
+        UIViewRoot viewRoot = facesContext.getViewRoot();
+        UIComponent form = application.createComponent(UIForm.COMPONENT_TYPE);
+
+        viewRoot.getChildren().add(form);
+
+        UIComponent testComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
+
+        form.getChildren().add(testComponent);
+        FormUtil.throwEnclFormReqExceptionIfNeed(facesContext, testComponent);
+    }
+
+    public void testThrowEnclFormReqExceptionIfNeedNoForm() throws Exception {
+        UIViewRoot viewRoot = facesContext.getViewRoot();
+        UIComponent testComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
+
+        viewRoot.getChildren().add(testComponent);
+
+        try {
+            FormUtil.throwEnclFormReqExceptionIfNeed(facesContext, testComponent);
+            fail();
+        } catch (EnclosingFormRequiredException e) {}
+    }
+
+    public void testThrowEnclFormReqExceptionIfNeedClient() throws Exception {
+        UIViewRoot viewRoot = facesContext.getViewRoot();
+        UIComponent testComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
+
+        testComponent.getAttributes().put("switchType", "CLIENT");
+        viewRoot.getChildren().add(testComponent);
+        FormUtil.throwEnclFormReqExceptionIfNeed(facesContext, testComponent);
+    }
+}

Deleted: trunk/ui/output/api/src/main/java/org/richfaces/component/SwitchType.java
===================================================================
--- trunk/ui/output/api/src/main/java/org/richfaces/component/SwitchType.java	2010-08-18 17:16:46 UTC (rev 18772)
+++ trunk/ui/output/api/src/main/java/org/richfaces/component/SwitchType.java	2010-08-18 17:24:07 UTC (rev 18773)
@@ -1,24 +0,0 @@
-package org.richfaces.component;
-
-/**
- * @author akolonitsky
- * @since Jun 15, 2010
- */
-public enum SwitchType {
-    /**
-     * value for tab change method for - client-side tabs.
-     */
-    client,
-
-    /**
-     * value for tab change method - server-side tabs
-     */
-    server,
-
-    /**
-     * value for tab change method - ajax tabs
-     */
-    ajax;
-
-    public static final SwitchType DEFAULT = SwitchType.ajax;
-}



More information about the richfaces-svn-commits mailing list