[richfaces-svn-commits] JBoss Rich Faces SVN: r18670 - in trunk: examples/output-demo/src/main/webapp/qunit and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Aug 16 11:48:03 EDT 2010


Author: Alex.Kolonitsky
Date: 2010-08-16 11:48:02 -0400 (Mon, 16 Aug 2010)
New Revision: 18670

Added:
   trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
   trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
Modified:
   trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
   trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml
   trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
   trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
Log:
RF-8790

Modified: trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml	2010-08-16 15:47:11 UTC (rev 18669)
+++ trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml	2010-08-16 15:48:02 UTC (rev 18670)
@@ -48,5 +48,9 @@
             <from-outcome>qunit/accordion</from-outcome>
             <to-view-id>/qunit/accordion.xhtml</to-view-id>
         </navigation-case>
+        <navigation-case>
+            <from-outcome>qunit/accordionHeaders</from-outcome>
+            <to-view-id>/qunit/accordionHeaders.xhtml</to-view-id>
+        </navigation-case>
     </navigation-rule>
 </faces-config>

Modified: trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml	2010-08-16 15:47:11 UTC (rev 18669)
+++ trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml	2010-08-16 15:48:02 UTC (rev 18670)
@@ -12,15 +12,6 @@
         <h:outputScript name="qunit/qunit.js" />
         <h:outputScript name="qunit/richfaces-qunit.js" />
 
-        <!--<h:outputScript name="richfaces-event.js" />-->
-        <!--<h:outputScript name="richfaces-base-component.js" />-->
-        <!--<h:outputScript name="richfaces.js" />-->
-        <!--<h:outputScript name="TogglePanel.js" />-->
-        <!--<h:outputScript name="TogglePanelItem.js" />-->
-        <!--<h:outputScript name="TogglePanelTitledItem.js" />-->
-        <!--<h:outputScript name="AccordionItem.js" />-->
-        <!--<h:outputScript name="Accordion.js" />-->
-
         <h:outputStylesheet name="qunit/qunit.css" />
     </ui:define>
 
@@ -31,50 +22,13 @@
         <p>Page</p>
 
         <h:form id="f" style="border:blue solid thin;">
-            <pn:accordion id="panel" style="padding: 0px; height: 400px; width: 500px;" switchType="ajax">
+            <pn:accordion id="panel">
                 <pn:accordionItem header="label 1">content 1</pn:accordionItem>
                 <pn:accordionItem header="label 2">content 2</pn:accordionItem>
                 <pn:accordionItem header="label 3">content 3</pn:accordionItem>
             </pn:accordion>
         </h:form>
 
-<!--        <h:form id="f" style="border:blue solid thin;">
-            <div id="f:panel" style="padding: 0px; height: 400px; width: 500px;" class="rich-panelbar rich-panelbar-b">
-                <input type="hidden" id="f:panel-value" />
-                <div id="f:name1" class="rich-panelbar rich-panelbar-interior ">
-                    <div id="f:name1-header" class="rich-panelbar-header">label 1</div>
-                    <div id="f:name1-content" style="display: block; width: 100%; overflow: auto;"
-                         class="rich-panelbar-content-exterior">
-                        content 1
-                    </div>
-                </div>
-                <div id="f:name2" class="rich-panelbar rich-panelbar-interior ">
-                    <div id="f:name2-header" class="rich-panelbar-header">label 2</div>
-                    <div id="f:name2-content" style="display: none; width: 100%; overflow: auto;"
-                         class="rich-panelbar-content-exterior">
-                        content 2
-                    </div>
-                </div>
-                <div id="f:name3" class="rich-panelbar rich-panelbar-interior ">
-                    <div id="f:name3-header" class="rich-panelbar-header  ">label 3</div>
-                    <div id="f:name3-content" style="display: none; width: 100%; overflow: auto;"
-                         class="rich-panelbar-content-exterior">
-                        content 3
-                    </div>
-                </div>
-                <script type="text/javascript">
-                    new RichFaces.ui.Accordion("f:panel",{
-                        "items":[
-                            new RichFaces.ui.AccordionItem("f:name1",{"togglePanelId":"f:panel","switchMode":"client","name":"name1"} ),
-                            new RichFaces.ui.AccordionItem("f:name2",{"togglePanelId":"f:panel","switchMode":"client","name":"name2"} ),
-                            new RichFaces.ui.AccordionItem("f:name3",{"togglePanelId":"f:panel","switchMode":"client","name":"name3"} )] ,
-                        "ajax":{"status":"null","incId":"1"} ,
-                        "activeItem":"name1",
-                        "isKeepHeight": false} )
-                </script>
-            </div>
-        </h:form>-->
-
         <p>Result</p>
         <div>
             <ol id="qunit-tests"></ol>

Added: trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml	                        (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml	2010-08-16 15:48:02 UTC (rev 18670)
@@ -0,0 +1,58 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+    <ui:define name="scripts">
+        <h:outputScript name="qunit/qunit.js" />
+        <h:outputScript name="qunit/richfaces-qunit.js" />
+
+        <h:outputStylesheet name="qunit/qunit.css" />
+    </ui:define>
+
+    <ui:define name="title">Accordion Example</ui:define>
+    <ui:define name="body_head">Accordion Example</ui:define>
+
+    <ui:define name="body">
+        <p>Page</p>
+
+        <h:form id="f" style="border:blue solid thin;">
+            <pn:accordion id="panel" style="padding: 0px; height: 400px; width: 500px;" switchType="client">
+                <pn:accordionItem header="label 1">
+                    <f:facet name="headerInactive">headerInactive 1</f:facet>
+                    <f:facet name="headerActive">headerActive 1</f:facet>
+                    <f:facet name="headerDisable">headerDisable 1</f:facet>
+                    content 1
+                </pn:accordionItem>
+                <pn:accordionItem header="label 2" disabled="true">
+                    <f:facet name="headerInactive">headerInactive 2</f:facet>
+                    <f:facet name="headerActive">headerActive 2</f:facet>
+                    <f:facet name="headerDisable">headerDisable 2</f:facet>
+                    content 2
+                </pn:accordionItem>
+                <pn:accordionItem header="label 3">
+                    <f:facet name="headerInactive">headerInactive 3</f:facet>
+                    <f:facet name="headerActive">headerActive 3</f:facet>
+                    <f:facet name="headerDisable">headerDisable 3</f:facet>
+                    content 3
+                </pn:accordionItem>
+            </pn:accordion>
+        </h:form>
+
+        <p>Result</p>
+        <div>
+            <ol id="qunit-tests"></ol>
+
+            <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+        </div>
+        <h:outputScript name="tests/richfaces-accordion-headers-qunit.js" />
+    </ui:define>
+</ui:composition>
+</body>
+</html>
+

Added: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js	                        (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js	2010-08-16 15:48:02 UTC (rev 18670)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+RichFaces.QUnit.run(function() {
+    module("richfaces-accordion");
+
+    var ACCORDION_ID = "f:panel";
+
+    test("RichFaces.ui.Accordion change headers", function () {
+        var c = RichFaces.$(ACCORDION_ID);
+
+        ok(c instanceof RichFaces.ui.Accordion, "inctance of RichFaces.ui.Accordion");
+        equals(c.id, ACCORDION_ID, "id");
+
+        equals(c.getItems().length, 3, "getItems().length");
+
+        var items = c.getItems();
+        ok( items[0].__header("active"  ).is(":visible"), "1 item: active visible");
+        ok(!items[0].__header("inactive").is(":visible"), "1 item: inactive unvisible");
+        ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+
+        ok(!items[1].__header("active"  ).is(":visible"), "2 item: active unvisible");
+        ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
+        ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+
+        ok(!items[2].__header("active"  ).is(":visible"), "3 item: active unvisible");
+        ok( items[2].__header("inactive").is(":visible"), "3 item: inactive visible");
+        ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+
+        c.switchToItem(items[2].getName());
+        ok(!items[0].__header("active"  ).is(":visible"), "1 item: active unvisible");
+        ok( items[0].__header("inactive").is(":visible"), "1 item: inactive visible");
+        ok(!items[0].__header("disable" ).is(":visible"), "1 item: disabled unvisible");
+
+        ok(!items[1].__header("active"  ).is(":visible"), "2 item: active unvisible");
+        ok(!items[1].__header("inactive").is(":visible"), "2 item: inactive unvisible");
+        ok( items[1].__header("disable" ).is(":visible"), "2 item: disabled visible");
+
+        ok( items[2].__header("active"  ).is(":visible"), "3 item: active visible");
+        ok(!items[2].__header("inactive").is(":visible"), "3 item: inactive unvisible");
+        ok(!items[2].__header("disable" ).is(":visible"), "3 item: disabled unvisible");
+
+        c.switchToItem(items[0].getName());
+    });
+});

Modified: trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/templates/template.xhtml	2010-08-16 15:47:11 UTC (rev 18669)
+++ trunk/examples/output-demo/src/main/webapp/templates/template.xhtml	2010-08-16 15:48:02 UTC (rev 18670)
@@ -52,6 +52,7 @@
                             <li><h:commandLink value="togglePanel" action="qunit/togglePanel" /></li>
                             <li><h:commandLink value="togglePanelItem" action="qunit/togglePanelItem" /></li>
                             <li><h:commandLink value="accordion" action="qunit/accordion" /></li>
+                            <li><h:commandLink value="accordionHeaders" action="qunit/accordionHeaders" /></li>
                         </ul>
                     </h:form>
                 </td>

Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java	2010-08-16 15:47:11 UTC (rev 18669)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java	2010-08-16 15:48:02 UTC (rev 18670)
@@ -138,7 +138,7 @@
         writer.writeAttribute("class", "rf-aci-h-" + state + " " + attributeAsString(component, name), name);
 
 
-        UIComponent headerFacet = component.getFacet("header");
+        UIComponent headerFacet = component.getFacet("header" + capitalize(state));
         if (headerFacet != null && headerFacet.isRendered()) {
             headerFacet.encodeAll(facesContext);
         } else {



More information about the richfaces-svn-commits mailing list