JBoss Rich Faces SVN: r21423 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-02-03 11:13:39 -0500 (Thu, 03 Feb 2011)
New Revision: 21423
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java
Log:
* fixed sample for tab panel
* tests fixed and refactored
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/simple.xhtml 2011-02-03 15:23:20 UTC (rev 21422)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/simple.xhtml 2011-02-03 16:13:39 UTC (rev 21423)
@@ -71,11 +71,11 @@
style="#{richTabPanelBean.attributes['style'].value}"
styleClass="#{richTabPanelBean.attributes['styleClass'].value}"
switchType="#{richTabPanelBean.attributes['switchType'].value}"
+ tabActiveHeaderClass="#{richTabPanelBean.attributes['tabActiveHeaderClass'].value}"
tabContentClass="#{richTabPanelBean.attributes['tabContentClass'].value}"
+ tabDisabledHeaderClass="#{richTabPanelBean.attributes['tabDisabledHeaderClass'].value}"
tabHeaderClass="#{richTabPanelBean.attributes['tabHeaderClass'].value}"
- tabHeaderClassActive="#{richTabPanelBean.attributes['tabHeaderClassActive'].value}"
- tabHeaderClassDisabled="#{richTabPanelBean.attributes['tabHeaderClassDisabled'].value}"
- tabHeaderClassInactive="#{richTabPanelBean.attributes['tabHeaderClassInactive'].value}"
+ tabInactiveHeaderClass="#{richTabPanelBean.attributes['tabInactiveHeaderClass'].value}"
title="#{richTabPanelBean.attributes['title'].value}"
>
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-02-03 15:23:20 UTC (rev 21422)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-02-03 16:13:39 UTC (rev 21423)
@@ -297,7 +297,7 @@
JQueryLocator input = pjq("select[id$=itemDisabledLeftIconInput]");
JQueryLocator image = leftIcon.format(4).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-dis");
+ verifyStandardIcons(input, icon, image, "-hdr-dis");
}
@Test
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2011-02-03 15:23:20 UTC (rev 21422)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2011-02-03 16:13:39 UTC (rev 21423)
@@ -50,8 +50,8 @@
public class TestRichTab extends AbstractMetamerTest {
private JQueryLocator panel = pjq("div[id$=tabPanel]");
- private JQueryLocator[] itemContents = {pjq("div[id$=tab1] > div.rf-tb-cnt"), pjq("div[id$=tab2] > div.rf-tb-cnt"),
- pjq("div[id$=tab3] > div.rf-tb-cnt"), pjq("div[id$=tab4] > div.rf-tb-cnt"), pjq("div[id$=tab5] > div.rf-tb-cnt")};
+ private JQueryLocator[] itemContents = {pjq("div[id$=tab1] > div.rf-tab-cnt"), pjq("div[id$=tab2] > div.rf-tab-cnt"),
+ pjq("div[id$=tab3] > div.rf-tab-cnt"), pjq("div[id$=tab4] > div.rf-tab-cnt"), pjq("div[id$=tab5] > div.rf-tab-cnt")};
private JQueryLocator[] activeHeaders = {pjq("td[id$=tab1:header:active]"), pjq("td[id$=tab2:header:active]"),
pjq("td[id$=tab3:header:active]"), pjq("td[id$=tab4:header:active]"), pjq("td[id$=tab5:header:active]")};
private JQueryLocator[] inactiveHeaders = {pjq("td[id$=tab1:header:inactive]"), pjq("td[id$=tab2:header:inactive]"),
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java 2011-02-03 15:23:20 UTC (rev 21422)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTabPanel/TestRichTabPanel.java 2011-02-03 16:13:39 UTC (rev 21423)
@@ -55,8 +55,8 @@
private JQueryLocator panel = pjq("div[id$=tabPanel]");
private JQueryLocator[] items = {pjq("div[id$=tab1]"), pjq("div[id$=tab2]"), pjq("div[id$=tab3]"), pjq("div[id$=tab4]"),
pjq("div[id$=tab5]")};
- private JQueryLocator[] itemContents = {pjq("div[id$=tab1] > div.rf-tb-cnt"), pjq("div[id$=tab2] > div.rf-tb-cnt"),
- pjq("div[id$=tab3] > div.rf-tb-cnt"), pjq("div[id$=tab4] > div.rf-tb-cnt"), pjq("div[id$=tab5] > div.rf-tb-cnt")};
+ private JQueryLocator[] itemContents = {pjq("div[id$=tab1] > div.rf-tab-cnt"), pjq("div[id$=tab2] > div.rf-tab-cnt"),
+ pjq("div[id$=tab3] > div.rf-tab-cnt"), pjq("div[id$=tab4] > div.rf-tab-cnt"), pjq("div[id$=tab5] > div.rf-tab-cnt")};
private JQueryLocator[] activeHeaders = {pjq("td[id$=tab1:header:active]"), pjq("td[id$=tab2:header:active]"),
pjq("td[id$=tab3:header:active]"), pjq("td[id$=tab4:header:active]"), pjq("td[id$=tab5:header:active]")};
private JQueryLocator[] inactiveHeaders = {pjq("td[id$=tab1:header:inactive]"), pjq("td[id$=tab2:header:inactive]"),
14 years, 7 months
JBoss Rich Faces SVN: r21422 - in trunk/ui/output/ui/src/test: resources/org/richfaces/renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2011-02-03 10:23:20 -0500 (Thu, 03 Feb 2011)
New Revision: 21422
Modified:
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml
Log:
RF-10298: test for PanelMenu, @itemClass, @itemDisabledClass, is added
Modified: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java 2011-02-03 14:52:35 UTC (rev 21421)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/PanelMenuRendererTest.java 2011-02-03 15:23:20 UTC (rev 21422)
@@ -23,17 +23,16 @@
package org.richfaces.renderkit.html;
-import java.io.IOException;
-
-import org.junit.Ignore;
import org.junit.Test;
import org.xml.sax.SAXException;
+import java.io.IOException;
+
/**
* @author akolonitsky
* @since 2010-10-25
*/
-@Ignore
+
public class PanelMenuRendererTest extends RendererTestBase {
@Test
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml 2011-02-03 14:52:35 UTC (rev 21421)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xhtml 2011-02-03 15:23:20 UTC (rev 21422)
@@ -22,7 +22,8 @@
-->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!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:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:h="http://java.sun.com/jsf/html"
@@ -31,13 +32,23 @@
xmlns:pn="http://richfaces.org/output"
xmlns:rich="http://richfaces.org/rich">
- <h:head>
- <title>Richfaces PanelMenu Test</title>
- </h:head>
+<h:head>
+ <title>Richfaces PanelMenu Test</title>
+</h:head>
<h:body>
<h:form id="f" style="border:blue solid thin;">
- <pn:panelMenu id="panelMenu"></pn:panelMenu>
+ <pn:panelMenu id="panelMenu" itemClass="my-item-class" itemDisabledClass="my-item-disabled-class">
+ <pn:panelMenuGroup>
+ <pn:panelMenuItem id="item">
+ My Item
+ </pn:panelMenuItem>
+ <pn:panelMenuItem id="item_disabled" disabled="true">
+ My Disabled Item
+ </pn:panelMenuItem>
+ </pn:panelMenuGroup>
+
+ </pn:panelMenu>
</h:form>
</h:body>
</html>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml 2011-02-03 14:52:35 UTC (rev 21421)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/panelMenu.xmlunit.xml 2011-02-03 15:23:20 UTC (rev 21422)
@@ -1,7 +1,75 @@
<div id="f:panelMenu" class="rf-pm">
<input id="f:panelMenu-value" name="f:panelMenu-value" type="hidden"/>
<script type="text/javascript">
- // Text
+ //<![CDATA[
+//]]>
</script>
+ <div id="f:j_idt7" class="rf-pm-top-gr">
+ <input id="f:j_idt7:expanded" name="f:j_idt7:expanded" type="hidden" value="false"/>
+ <div id="f:j_idt7:hdr" class="rf-pm-top-gr-hdr rf-pm-hdr-colps">
+ <table class="rf-pm-top-gr-gr">
+ <tbody>
+ <tr>
+ <td class="rf-pm-top-gr-ico">
+ <div class="rf-pm-ico-colps rf-ico-transparent-hdr">
+ </div>
+ <div class="rf-pm-ico-exp rf-ico-transparent-hdr">
+ </div>
+ </td>
+ <td class="rf-pm-top-gr-lbl"/>
+ <td class="rf-pm-top-gr-exp-ico">
+ <div class="rf-pm-ico-colps rf-ico-transparent-hdr">
+ </div>
+ <div class="rf-pm-ico-exp rf-ico-transparent-hdr">
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div id="f:j_idt7:cnt" class="rf-pm-top-gr-cnt rf-pm-colps">
+ <script type="text/javascript">
+ //<![CDATA[
+//]]>
+ </script>
+ <div id="f:item" class="rf-pm-itm my-item-class">
+ <table class="rf-pm-itm-gr">
+ <tbody>
+ <tr>
+ <td class="rf-pm-itm-ico rf-ico-transparent"/>
+ <td class="rf-pm-itm-lbl">
-</div>
+ My Item
+
+ </td>
+ <td class="rf-pm-itm-exp-ico rf-ico-transparent"/>
+ </tr>
+ </tbody>
+ </table>
+ <script type="text/javascript">
+ //<![CDATA[
+//]]>
+ </script>
+ </div>
+ <div id="f:item_disabled" class="rf-pm-itm my-item-class rf-pm-itm-dis my-item-disabled-class">
+ <table class="rf-pm-itm-gr">
+ <tbody>
+ <tr>
+ <td class="rf-pm-itm-ico rf-ico-transparent-dis"/>
+ <td class="rf-pm-itm-lbl">
+
+ My Disabled Item
+
+ </td>
+ <td class="rf-pm-itm-exp-ico rf-ico-transparent-dis"/>
+ </tr>
+ </tbody>
+ </table>
+ <script type="text/javascript">
+ //<![CDATA[
+//]]>
+ </script>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
14 years, 7 months
JBoss Rich Faces SVN: r21421 - in trunk/ui/output/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2011-02-03 09:52:35 -0500 (Thu, 03 Feb 2011)
New Revision: 21421
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
Log:
RF-10322: hoverClass attribute is removed and :hover pseudo-class is used in CSS
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2011-02-03 14:44:32 UTC (rev 21420)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2011-02-03 14:52:35 UTC (rev 21421)
@@ -138,9 +138,6 @@
getStateHelper().put(Properties.disabledClass, disabledClass);
}
- @Attribute
- public abstract String getHoverClass();
-
@Attribute(generate = false)
public String getLeftIcon() {
return (String) getStateHelper().eval(Properties.leftIcon,
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2011-02-03 14:44:32 UTC (rev 21420)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.ecss 2011-02-03 14:52:35 UTC (rev 21421)
@@ -61,12 +61,11 @@
margin: 0px 3px;
}
-.rf-pm-itm-hov {
+.rf-pm-itm:hover {
background-color: '#{richSkin.additionalBackgroundColor}';
}
.rf-pm-itm-sel {
- background-color: '#{richSkin.additionalBackgroundColor}';
font-style:italic;
}
@@ -76,14 +75,12 @@
border-top-color: '#{richSkin.panelBorderColor}';
}
-.rf-pm-gr-hov {
+.rf-pm-gr-hdr:hover {
background: '#{richSkin.additionalBackgroundColor}';
-
color: white; /*TODO skin?*/
}
.rf-pm-gr-sel {
- background: '#{richSkin.additionalBackgroundColor}';
font-style:italic;
}
@@ -166,12 +163,12 @@
margin: 0px 3px;
}
-.rf-pm-top-itm-hov {
+.rf-pm-top-itm:hover {
+ color: '#{richSkin.headerTextColor}';
background-color:#ffd700;
}
.rf-pm-top-itm-sel {
- background: '#{richSkin.additionalBackgroundColor}';
font-style:italic;
}
@@ -183,15 +180,11 @@
padding: 1px;
}
-.rf-pm-top-gr-hov {
- background-color: green;
- color: white; /*TODO skin?*/
+.rf-pm-top-gr-hdr:hover {
+ background-color: '#{richSkin.additionalBackgroundColor}';
}
.rf-pm-top-gr-sel {
- background-color: blue;
- color: #f5f5f5;
-
font-style:italic;
}
@@ -230,6 +223,10 @@
cursor: default;
}
+.rf-pm-itm.rf-pm-itm-dis:hover{
+ background-color: inherit;
+}
+
.rf-pm-top-gr-cnt {
}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-02-03 14:44:32 UTC (rev 21420)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-02-03 14:52:35 UTC (rev 21421)
@@ -29,7 +29,6 @@
disabled : false,
selectable: true,
unselectable: false,
- highlight: true,
mode: "client",
stylePrefix: "rf-pm-itm",
itemStep: 20
@@ -139,22 +138,13 @@
// todo move it
this.selectionClass = this.options.stylePrefix + "-sel";
- this.hoverClass = this.options.stylePrefix + "-hov";
-
+
if (panelMenu.__isActiveItem(this)) {
rootElt.ready($.proxy(this.__restoreSelection, this));
}
if (!this.options.disabled) {
var item = this;
- if (this.options.highlight) {
- this.__item().bind("mouseenter", function() {
- item.highlight(true);
- });
- this.__item().bind("mouseleave", function() {
- item.highlight(false);
- });
- }
if (this.options.selectable) {
this.__header().bind("click", function() {
@@ -180,13 +170,6 @@
},
/***************************** Public Methods ****************************************************************/
- highlight : function (highlight) {
- if (highlight && !this.selected()) {
- this.__header().addClass(this.hoverClass);
- } else {
- this.__header().removeClass(this.hoverClass);
- }
- },
selected : function () {
return this.__header().hasClass(this.selectionClass);
14 years, 7 months
JBoss Rich Faces SVN: r21420 - in modules/tests/metamer/trunk: application/src/main/webapp/components/a4jJSFunction and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-02-03 09:44:32 -0500 (Thu, 03 Feb 2011)
New Revision: 21420
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java
Log:
* tests for jsFunction fixed, added 4 new tests
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java 2011-02-03 14:15:48 UTC (rev 21419)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java 2011-02-03 14:44:32 UTC (rev 21420)
@@ -27,7 +27,7 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
import javax.faces.event.ActionEvent;
import org.richfaces.component.UIFunction;
@@ -42,8 +42,8 @@
* @version $Revision$
*/
@ManagedBean(name = "a4jJSFunctionBean")
-// cannot be view-scoped (see https://jira.jboss.org/browse/RF-9287)
-@SessionScoped
+// should not be view-scoped (see https://jira.jboss.org/browse/RF-9287)
+@ViewScoped
public class A4JJSFunctionBean implements Serializable {
private static final long serialVersionUID = 48333649809L;
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/list.xhtml 2011-02-03 14:15:48 UTC (rev 21419)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/list.xhtml 2011-02-03 14:44:32 UTC (rev 21420)
@@ -5,7 +5,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml 2011-02-03 14:15:48 UTC (rev 21419)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml 2011-02-03 14:44:32 UTC (rev 21420)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java 2011-02-03 14:15:48 UTC (rev 21419)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jJSFunction/TestJSFunctionSimple.java 2011-02-03 14:44:32 UTC (rev 21420)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -27,8 +27,10 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotSame;
+import static org.testng.Assert.fail;
import java.net.URL;
+
import javax.faces.event.PhaseId;
import org.jboss.test.selenium.dom.Event;
@@ -51,8 +53,6 @@
private JQueryLocator time2 = pjq("span[id$=time2]");
private JQueryLocator year = pjq("span[id$=year]");
private JQueryLocator ajaxRenderedTime = pjq("span[id$=autoTime]");
- private String[] phasesNames = {"RESTORE_VIEW 1", "APPLY_REQUEST_VALUES 2", "PROCESS_VALIDATIONS 3",
- "UPDATE_MODEL_VALUES 4", "INVOKE_APPLICATION 5", "RENDER_RESPONSE 6"};
@Override
public URL getTestUrl() {
@@ -82,13 +82,12 @@
@Test
public void testAction() {
+ selenium.click(pjq("input[name$=actionInput][value=increaseYearAction]"));
+ selenium.waitForPageToLoad();
+
int yearValue = Integer.parseInt(selenium.getText(year));
String time1Value = selenium.getText(time1);
- JQueryLocator incYearActionOption = pjq("input[id$=actionInput:1]");
- selenium.click(incYearActionOption);
- selenium.waitForPageToLoad();
-
guardXhr(selenium).click(link);
String newTime1Value = waitGui.failWith("Page was not updated").waitForChangeAndReturn(time1Value,
retrieveText.locator(time1));
@@ -100,6 +99,8 @@
retrieveText.locator(time1));
assertNotSame(time1Value, newTime1Value, "Time1 did not change");
assertEquals(Integer.parseInt(selenium.getText(year)), yearValue + 2, "Action was not called");
+
+ phaseInfo.assertListener(PhaseId.INVOKE_APPLICATION, "action invoked");
}
@Test
@@ -107,8 +108,7 @@
int yearValue = Integer.parseInt(selenium.getText(year));
String time1Value = selenium.getText(time1);
- JQueryLocator incYearActionListenerOption = pjq("input[id$=actionListenerInput:1]");
- selenium.click(incYearActionListenerOption);
+ selenium.click(pjq("input[name$=actionListenerInput][value=increaseYearActionListener]"));
selenium.waitForPageToLoad();
guardXhr(selenium).click(link);
@@ -122,38 +122,76 @@
retrieveText.locator(time1));
assertNotSame(time1Value, newTime1Value, "Time1 did not change");
assertEquals(Integer.parseInt(selenium.getText(year)), yearValue + 2, "Action was not called");
+
+ phaseInfo.assertListener(PhaseId.INVOKE_APPLICATION, "action listener invoked");
}
@Test
public void testBypassUpdates() {
- String time1Value = selenium.getText(time1);
+ selenium.click(pjq("input[name$=actionInput][value=decreaseYearAction]"));
+ selenium.waitForPageToLoad();
- JQueryLocator input = pjq("input[type=radio][name$=bypassUpdatesInput][value=true]");
- selenium.click(input);
+ selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
+ String time1Value = selenium.getText(time1);
guardXhr(selenium).click(link);
waitGui.failWith("Page was not updated").waitForChange(time1Value, retrieveText.locator(time1));
- JQueryLocator[] phases = {jq("div#phasesPanel li"), jq("div#phasesPanel li:eq(0)"),
- jq("div#phasesPanel li:eq(1)"), jq("div#phasesPanel li:eq(2)"), jq("div#phasesPanel li:eq(3)")};
-
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertListener(PhaseId.PROCESS_VALIDATIONS, "action invoked");
}
@Test
+ public void testData() {
+ selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces 4");
+ selenium.waitForPageToLoad();
+
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String data = selenium.getEval(new JavaScript("window.data"));
+ assertEquals(data, "RichFaces 4", "Data sent with ajax request");
+ }
+
+ @Test
+ public void testExecute() {
+ selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
+ for (int i = 0; i < 6; i++) {
+ if ("* executeChecker".equals(selenium.getText(logItems.format(i)))) {
+ return;
+ }
+ }
+
+ fail("Attribute execute does not work");
+ }
+
+ @Test
public void testImmediate() {
- String time1Value = selenium.getText(time1);
+ selenium.click(pjq("input[name$=actionListenerInput][value=decreaseYearActionListener]"));
+ selenium.waitForPageToLoad();
- JQueryLocator input = pjq("input[type=radio][name$=immediateInput][value=true]");
- selenium.click(input);
+ selenium.click(pjq("input[name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(link);
- waitGui.failWith("Page was not updated").waitForChange(time1Value, retrieveText.locator(time1));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "action listener invoked");
}
@Test
@@ -186,6 +224,14 @@
}
@Test
+ public void testName() {
+ selenium.type(pjq("input[id$=nameInput]"), "metamer");
+ selenium.waitForPageToLoad();
+
+ testSimpleClick();
+ }
+
+ @Test
public void testEvents() {
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
@@ -257,4 +303,14 @@
assertEquals(newYearValue, yearValue, "Year should not change");
assertEquals(newAjaxRenderedTimeValue, ajaxRenderedTimeValue, "Ajax rendered time should not change");
}
+
+ @Test
+ public void testStatus() {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).click(link);
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
}
14 years, 7 months
JBoss Rich Faces SVN: r21419 - in trunk/examples/input-demo/src/main: webapp/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-03 09:15:48 -0500 (Thu, 03 Feb 2011)
New Revision: 21419
Modified:
trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
Log:
https://issues.jboss.org/browse/RF-10388
https://issues.jboss.org/browse/RF-10425
Modified: trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
===================================================================
--- trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2011-02-03 14:15:25 UTC (rev 21418)
+++ trunk/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2011-02-03 14:15:48 UTC (rev 21419)
@@ -22,7 +22,6 @@
package org.richfaces.demo;
import java.io.Serializable;
-import java.util.Arrays;
import java.util.Locale;
import javax.faces.bean.ManagedBean;
@@ -31,7 +30,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.richfaces.component.UIAutocomplete;
+import org.richfaces.component.AutocompleteMode;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
@@ -75,13 +74,13 @@
return value;
}
- private String mode = "lazyClient";
+ private AutocompleteMode mode = AutocompleteMode.lazyClient;
- public String getMode() {
+ public AutocompleteMode getMode() {
return mode;
}
- public void setMode(String mode) {
+ public void setMode(AutocompleteMode mode) {
this.mode = mode;
}
@@ -98,8 +97,14 @@
if (str.charAt(0)=='i') {
str = str.substring(1);
}*/
- String v = mode.equals("lazyClient") || mode.equals("client") ? "" : value;
- return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(v.toLowerCase()));
+
+ AutocompleteMode mode = (AutocompleteMode) component.getAttributes().get("mode");
+ boolean isClient = mode == AutocompleteMode.client || mode == AutocompleteMode.lazyClient;
+ String v = isClient ? "" : value;
+ return Collections2.filter(countriesBean.getCountries(), new CountryNamePredicate(v.toLowerCase(Locale.US)));
}
+ public Object getModes() {
+ return AutocompleteMode.values();
+ }
}
Modified: trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-02-03 14:15:25 UTC (rev 21418)
+++ trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-02-03 14:15:48 UTC (rev 21419)
@@ -25,10 +25,7 @@
<h:form id="form">
<h:selectOneMenu value="#{autoCompleteBean.mode}" onchange="submit()">
- <f:selectItem itemValue="lazyClient"/>
- <f:selectItem itemValue="client"/>
- <f:selectItem itemValue="cachedAjax"/>
- <f:selectItem itemValue="ajax"/>
+ <f:selectItems value="#{autoCompleteBean.modes}" />
</h:selectOneMenu><br/>
<div style="height: 300px; width: 300px; overflow: auto; float:left;">Text
block text block text block text block text block text block text
14 years, 7 months
JBoss Rich Faces SVN: r21418 - in trunk/ui: input/api/src/main/java/org/richfaces/component and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-02-03 09:15:25 -0500 (Thu, 03 Feb 2011)
New Revision: 21418
Added:
trunk/ui/input/api/src/main/java/org/richfaces/component/AutocompleteMode.java
Modified:
trunk/ui/common/ui/src/main/java/org/richfaces/component/util/InputUtils.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
trunk/ui/input/ui/src/main/templates/autocomplete.template.xml
Log:
https://issues.jboss.org/browse/RF-10388
https://issues.jboss.org/browse/RF-10425
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/util/InputUtils.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/util/InputUtils.java 2011-02-03 13:43:02 UTC (rev 21417)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/util/InputUtils.java 2011-02-03 14:15:25 UTC (rev 21418)
@@ -21,7 +21,7 @@
package org.richfaces.component.util;
-import org.ajax4jsf.Messages;
+import java.io.Serializable;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
@@ -29,8 +29,9 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import java.io.Serializable;
+import org.ajax4jsf.Messages;
+
/**
* @author Maksim Kaszynski
* @author Manfred Geiler
@@ -59,6 +60,15 @@
return isTrue(component.getAttributes().get("readonly"));
}
+ public static Converter getConverterForType(FacesContext context, Class<?> type) {
+ //see getConvertedValue
+ if (type == null || Object.class.equals(type)) {
+ return null;
+ }
+
+ return context.getApplication().createConverter(type);
+ }
+
public static Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
throws ConverterException {
String newValue = (String) submittedValue;
@@ -72,6 +82,7 @@
if ((converter == null) && (valueExpression != null)) {
Class converterType = valueExpression.getType(context.getELContext());
+ //see getConverterForType
if ((converterType == null) || (converterType == Object.class)) {
return newValue;
} else {
Added: trunk/ui/input/api/src/main/java/org/richfaces/component/AutocompleteMode.java
===================================================================
--- trunk/ui/input/api/src/main/java/org/richfaces/component/AutocompleteMode.java (rev 0)
+++ trunk/ui/input/api/src/main/java/org/richfaces/component/AutocompleteMode.java 2011-02-03 14:15:25 UTC (rev 21418)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, 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.
+ */
+package org.richfaces.component;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public enum AutocompleteMode {
+
+ client, lazyClient, ajax, cachedAjax;
+
+ public static final AutocompleteMode DEFAULT = cachedAjax;
+
+}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2011-02-03 13:43:02 UTC (rev 21417)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2011-02-03 14:15:25 UTC (rev 21418)
@@ -24,8 +24,6 @@
import java.io.IOException;
import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-import javax.faces.application.Application;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.visit.VisitCallback;
@@ -34,7 +32,6 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
-import org.richfaces.application.ServiceTracker;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
@@ -44,7 +41,6 @@
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.el.GenericsIntrospectionService;
import org.richfaces.renderkit.MetaComponentRenderer;
/**
@@ -87,7 +83,7 @@
public abstract String getSelectedItemClass();
@Attribute
- public abstract String getMode();
+ public abstract AutocompleteMode getMode();
@Attribute
public abstract String getLayout();
@@ -197,39 +193,6 @@
@Attribute
public abstract String getClientFilterFunction();
- @Override
- public Converter getConverter() {
- Converter converter = super.getConverter();
- if (converter == null) {
- converter = getConverterForValue(FacesContext.getCurrentInstance());
- }
-
- return converter;
- }
-
- private Converter getConverterForType(FacesContext context, Class<?> type) {
-
- if (!Object.class.equals(type) && type != null) {
- Application application = context.getApplication();
- return application.createConverter(type);
- }
-
- return null;
- }
-
- public Converter getConverterForValue(FacesContext context) {
- Converter converter = null;
- ValueExpression expression = this.getValueExpression("value");
-
- if (expression != null) {
- Class<?> containerClass = ServiceTracker.getService(context, GenericsIntrospectionService.class).getContainerClass(context, expression);
-
- converter = getConverterForType(context, containerClass);
- }
-
- return converter;
- }
-
public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
if (ITEMS_META_COMPONENT_ID.equals(metaComponentId)) {
return getClientId(facesContext) + MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-02-03 13:43:02 UTC (rev 21417)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2011-02-03 14:15:25 UTC (rev 21418)
@@ -32,6 +32,7 @@
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
import javax.el.MethodNotFoundException;
+import javax.el.ValueExpression;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
@@ -39,6 +40,8 @@
import javax.faces.context.PartialResponseWriter;
import javax.faces.context.PartialViewContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -48,11 +51,14 @@
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
+import org.richfaces.application.ServiceTracker;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
+import org.richfaces.component.AutocompleteMode;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.util.InputUtils;
import org.richfaces.context.ExtendedPartialViewContext;
+import org.richfaces.el.GenericsIntrospectionService;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -193,8 +199,8 @@
protected void encodeItemsContainer(FacesContext facesContext, UIComponent component) throws IOException {
AutocompleteEncodeStrategy strategy = getStrategy(component);
- Object mode = component.getAttributes().get("mode");
- if (mode != null && mode.equals("client")) {
+ AutocompleteMode mode = (AutocompleteMode) component.getAttributes().get("mode");
+ if (mode != null && mode == AutocompleteMode.client) {
List<Object> fetchValues = new ArrayList<Object>();
this.encodeItems(facesContext, component, fetchValues);
this.encodeFetchValues(facesContext, component, fetchValues);
@@ -264,16 +270,11 @@
return;
}
Map<String, String> requestParameters = context.getExternalContext().getRequestParameterMap();
- Object value = requestParameters.get(component.getClientId(context) + "Value");
+ String value = requestParameters.get(component.getClientId(context) + "Value");
if (value != null) {
- if (autocomplete.getConverter() != null) {
- value = autocomplete.getConverter().getAsObject(context, component, value.toString());
- }
autocomplete.setSubmittedValue(value);
}
- super.doDecode(context, component);
-
if (requestParameters.get(component.getClientId(context) + ".ajax") != null) {
PartialViewContext pvc = context.getPartialViewContext();
pvc.getRenderIds().add(
@@ -318,4 +319,28 @@
}
return value;
}
+
+ private Converter getConverterForValue(FacesContext context, UIComponent component) {
+ Converter converter = null;
+ ValueExpression expression = component.getValueExpression("value");
+
+ if (expression != null) {
+ Class<?> containerClass = ServiceTracker.getService(context, GenericsIntrospectionService.class).getContainerClass(context, expression);
+
+ converter = InputUtils.getConverterForType(context, containerClass);
+ }
+
+ return converter;
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object val) throws ConverterException {
+ String s = (String) val;
+ Converter converter = getConverterForValue(context, component);
+ if (converter != null) {
+ return converter.getAsObject(context, component, s);
+ } else {
+ return s;
+ }
+ }
}
Modified: trunk/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-02-03 13:43:02 UTC (rev 21417)
+++ trunk/ui/input/ui/src/main/templates/autocomplete.template.xml 2011-02-03 14:15:25 UTC (rev 21418)
@@ -11,6 +11,8 @@
<cdk:renderer-type>org.richfaces.AutocompleteRenderer
</cdk:renderer-type>
<cdk:renders-children>true</cdk:renders-children>
+
+ <cdk:import package="org.richfaces.component" names="AutocompleteMode.*" static="true" />
</cc:interface>
<cc:implementation>
@@ -78,9 +80,9 @@
<cdk:scriptOption attributes="onbegin oncomplete onerror onbeforedomupdate onchange onselectitem onfocus onblur" wrapper="eventHandler"/>
<cdk:scriptOption name="minChars" value="#{getMinCharsOrDefault(component)}" />
<cdk:scriptOption name="filterFunction" value="#{getClientFilterFunction(component)}" />
- <cdk:scriptOption name="isCachedAjax" value="#{'ajax'==mode ? false : true}" defaultValue="true" />
- <cdk:scriptOption name="ajaxMode" value="#{'client'==mode||'lazyClient'==mode ? false : true}" defaultValue="true" />
- <cdk:scriptOption name="lazyClientMode" value="#{'lazyClient'==mode ? true : false}" defaultValue="false" />
+ <cdk:scriptOption name="isCachedAjax" value="#{ajax == mode ? false : true}" defaultValue="true" />
+ <cdk:scriptOption name="ajaxMode" value="#{client == mode || lazyClient == mode ? false : true}" defaultValue="true" />
+ <cdk:scriptOption name="lazyClientMode" value="#{lazyClient == mode ? true : false}" defaultValue="false" />
</cdk:scriptObject>
new RichFaces.ui.Autocomplete("#{clientId}",
"#{clientId}Input", #{toScriptArgs(options)}
14 years, 7 months
JBoss Rich Faces SVN: r21417 - management/design-4x/dropDownMenu-new.
by richfaces-svn-commits@lists.jboss.org
Author: Ochikvina
Date: 2011-02-03 08:43:02 -0500 (Thu, 03 Feb 2011)
New Revision: 21417
Modified:
management/design-4x/dropDownMenu-new/dropDownMenu_new.html
Log:
RF-10424 - added disabled state.
Modified: management/design-4x/dropDownMenu-new/dropDownMenu_new.html
===================================================================
--- management/design-4x/dropDownMenu-new/dropDownMenu_new.html 2011-02-03 13:38:41 UTC (rev 21416)
+++ management/design-4x/dropDownMenu-new/dropDownMenu_new.html 2011-02-03 13:43:02 UTC (rev 21417)
@@ -22,27 +22,31 @@
}
/*--- RF DropDownMenu styles ---*/
- .rf-ddm-lbl, .rf-ddm-lbl-dis {
+ .rf-ddm{
font-family:Arial, Verdana, sans-serif;
font-size:11px;
position:relative;
}
- .rf-ddm-lbl-unsel {
+ .rf-ddm-unsel {
border:0 solid transparent;
padding:3px 6px;
}
- .rf-ddm-lbl, .rf-ddm-lbl-dis {
+ .rf-ddm{
height:auto;
padding:2px 5px;
white-space:nowrap;
width:auto;
}
+ .rf-ddm-dis{
+ color:#8DB7F3; /*tabDisabledTextColor*/
+ cursor:default;
+ }
.rf-ddm-pos{
top:20px;
left:0;
position:absolute;
}
- .rf-ddm-lbl-dec {
+ .rf-ddm-lbl {
font-weight:bold;
}
.rf-ddm-lst {
@@ -81,7 +85,7 @@
.rf-ddm-itm-dis {
border : 1px solid transparent;
cursor : default;
- color : #839eca; /*tabDisabledTextColor*/
+ color : #8DB7F3; /*tabDisabledTextColor*/
}
.rf-ddm-itm-ic {
display:inline-block;
@@ -125,8 +129,8 @@
<body>
<h1>DropDownMenu</h1>
- <div class="rf-ddm-lbl rf-ddm-lbl-unsel">
- <div class="rf-ddm-lbl-dec">
+ <div class="rf-ddm rf-ddm-unsel">
+ <div class="rf-ddm-lbl">
<img width="16" height="16" class="icon" src="images/copy.gif" alt="Menu icon"/> File
</div>
<div class="rf-ddm-pos">
@@ -219,5 +223,12 @@
</div>
</div>
</div>
+
+ <h1 style="margin-top:200px;">DropDownMenu disabled</h1>
+ <div class="rf-ddm rf-ddm-dis">
+ <div class="rf-ddm-lbl">
+ <img width="16" height="16" class="icon" src="images/copy.gif" alt="Menu icon"/> File
+ </div>
+ </div>
</body>
</html>
14 years, 7 months
JBoss Rich Faces SVN: r21416 - in trunk/ui/output/ui/src/main/java/org/richfaces: renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-02-03 08:38:41 -0500 (Thu, 03 Feb 2011)
New Revision: 21416
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java
Log:
RF-10409 ProgressBar: using defaults(min and max) breaks component look and feel
-type of attribute was changed from int to Object.
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java 2011-02-03 13:30:51 UTC (rev 21415)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java 2011-02-03 13:38:41 UTC (rev 21416)
@@ -127,13 +127,13 @@
public abstract SwitchType getMode();
@Attribute
- public abstract int getMaxValue();
+ public abstract Object getMaxValue();
@Attribute
- public abstract int getMinValue();
+ public abstract Object getMinValue();
@Attribute
- public abstract int getValue();
+ public abstract Object getValue();
@Attribute(hidden = true)
public abstract String getResource();
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2011-02-03 13:30:51 UTC (rev 21415)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2011-02-03 13:38:41 UTC (rev 21416)
@@ -123,7 +123,7 @@
} else {
Number minValue = NumberUtils.getNumber(getMinValueOrDefault(component));
Number maxValue = NumberUtils.getNumber(getMaxValueOrDefault(component));
- Number value = NumberUtils.getNumber(((AbstractProgressBar) component).getValue());
+ Number value = NumberUtils.getNumber(getValueOrDefault(component));
if (value.doubleValue() < minValue.doubleValue()) {
result = ProgressBarState.initialState;
@@ -195,22 +195,30 @@
return isAjaxMode(component) ? PARTIAL_ENCODER : FULL_ENCODER;
}
- protected int getMaxValueOrDefault(UIComponent component) {
- int maxValue = ((AbstractProgressBar) component).getMaxValue();
- if (maxValue == Integer.MIN_VALUE) {
+ protected Object getMaxValueOrDefault(UIComponent component) {
+ Object maxValue = ((AbstractProgressBar) component).getMaxValue();
+ if (maxValue == null) {
maxValue = DEFAULT_MAX_VALUE;
}
return maxValue;
}
- protected int getMinValueOrDefault(UIComponent component) {
- int maxValue = ((AbstractProgressBar) component).getMinValue();
- if (maxValue == Integer.MIN_VALUE) {
+ protected Object getMinValueOrDefault(UIComponent component) {
+ Object maxValue = ((AbstractProgressBar) component).getMinValue();
+ if (maxValue == null) {
maxValue = DEFAULT_MIN_VALUE;
}
return maxValue;
}
+ protected Object getValueOrDefault(UIComponent component) {
+ Object value = ((AbstractProgressBar) component).getValue();
+ if (value == null) {
+ value = Integer.MIN_VALUE;
+ }
+ return value;
+ }
+
protected SwitchType getModeOrDefault(UIComponent component) {
SwitchType mode = ((AbstractProgressBar) component).getMode();
if (mode == null) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java 2011-02-03 13:30:51 UTC (rev 21415)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java 2011-02-03 13:38:41 UTC (rev 21416)
@@ -83,7 +83,7 @@
}
protected String getWidth(UIComponent component) {
- Number value = NumberUtils.getNumber(((AbstractProgressBar) component).getValue());
+ Number value = NumberUtils.getNumber(getValueOrDefault(component));
Number minValue = NumberUtils.getNumber(getMinValueOrDefault(component));
Number maxValue = NumberUtils.getNumber(getMaxValueOrDefault(component));
Number percent = calculatePercent(value, minValue, maxValue);
@@ -175,19 +175,27 @@
encodeStateFacet(context, component, ProgressBarState.finishState, currentState);
}
- protected int getMaxValueOrDefault(UIComponent component) {
- int maxValue = ((AbstractProgressBar) component).getMaxValue();
- if (maxValue == Integer.MIN_VALUE) {
+ protected Object getMaxValueOrDefault(UIComponent component) {
+ Object maxValue = ((AbstractProgressBar) component).getMaxValue();
+ if (maxValue == null) {
maxValue = DEFAULT_MAX_VALUE;
}
return maxValue;
}
- protected int getMinValueOrDefault(UIComponent component) {
- int maxValue = ((AbstractProgressBar) component).getMinValue();
- if (maxValue == Integer.MIN_VALUE) {
+ protected Object getMinValueOrDefault(UIComponent component) {
+ Object maxValue = ((AbstractProgressBar) component).getMinValue();
+ if (maxValue == null) {
maxValue = DEFAULT_MIN_VALUE;
}
return maxValue;
}
+
+ protected Object getValueOrDefault(UIComponent component) {
+ Object value = ((AbstractProgressBar) component).getValue();
+ if (value == null) {
+ value = Integer.MIN_VALUE;
+ }
+ return value;
+ }
}
14 years, 7 months
JBoss Rich Faces SVN: r21415 - in trunk: ui/output/ui/src/main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2011-02-03 08:30:51 -0500 (Thu, 03 Feb 2011)
New Revision: 21415
Added:
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TabPanelRendererTest.java
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItemDisabled.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xmlunit.xml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xmlunit.xml
Modified:
trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordionItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml
trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml
Log:
RF-10297: Classes attributes for Tab, TabPanel, Accordion, and AccordionItem were fixed. Class itemRightInactiveIcon is also fixed.
Modified: trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml 2011-02-03 12:58:29 UTC (rev 21414)
+++ trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -17,7 +17,8 @@
<h:form id="f" style="border:blue solid thin;">
<h:panelGroup>
<pn:accordion width="500px" height="300px" itemChangeListener="#{togglePanelBean.itemChangeActionListener}" switchType="ajax"
- itemRightIconActive="triangleDown" itemInactiveRightIcon="triangleUp" itemDisabledRightIcon="disc" itemDisabledLeftIcon="disc" >
+ itemActiveRightIcon="triangleDown" itemInactiveRightIcon="triangleUp" itemDisabledRightIcon="disc" itemDisabledLeftIcon="disc"
+ itemActiveHeaderClass="ac-active-header">
<pn:accordionItem header="label 1" >Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here.</pn:accordionItem>
<pn:accordionItem header="label 2" >content 2</pn:accordionItem>
<pn:accordionItem header="label 3" onenter="alert('hello, world!')" >content 3</pn:accordionItem>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java 2011-02-03 12:58:29 UTC (rev 21414)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java 2011-02-03 13:30:51 UTC (rev 21415)
@@ -71,7 +71,7 @@
public abstract String getItemActiveRightIcon();
@Attribute
- public abstract String getItemRightInactiveIcon();
+ public abstract String getItemInactiveRightIcon();
@Attribute
public abstract String getItemDisabledRightIcon();
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordionItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordionItem.java 2011-02-03 12:58:29 UTC (rev 21414)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordionItem.java 2011-02-03 13:30:51 UTC (rev 21415)
@@ -106,12 +106,12 @@
getStateHelper().put(Properties.rightDisabledIcon, rightDisabledIcon);
}
- @Attribute(defaultValue = "getAccordion().getItemRightInactiveIcon()", generate = false)
+ @Attribute(defaultValue = "getAccordion().getItemInactiveRightIcon()", generate = false)
public String getRightInactiveIcon() {
- return (String) getStateHelper().eval(Properties.rightInactiveIcon, getAccordion().getItemRightInactiveIcon());
+ return (String) getStateHelper().eval(Properties.rightInactiveIcon, getAccordion().getItemInactiveRightIcon());
}
- public void setRightInactiveIcon(String rightInactiveIcon) {
+ public void setInactiveRightIcon(String rightInactiveIcon) {
getStateHelper().put(Properties.rightInactiveIcon, rightInactiveIcon);
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2011-02-03 12:58:29 UTC (rev 21414)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2011-02-03 13:30:51 UTC (rev 21415)
@@ -56,7 +56,10 @@
}
public String headerClass() {
- return "headerClass" + capitalize(this.toString());
+ return new StringBuilder("header")
+ .append(capitalize(this.toString()))
+ .append("Class")
+ .toString();
}
}
Modified: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java 2011-02-03 12:58:29 UTC (rev 21414)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/AccordionRendererTest.java 2011-02-03 13:30:51 UTC (rev 21415)
@@ -5,10 +5,16 @@
import java.io.IOException;
-public class AccordionRendererTest extends RendererTestBase {
+public class AccordionRendererTest extends RendererTestBase {
@Test
+ public void testAccordion() throws IOException, SAXException {
+ doTest("accordion", "f:accordion");
+ }
+
+ @Test
public void testAccordionItem() throws IOException, SAXException {
doTest("accordionItem", "f:item");
+ doTest("accordionItem", "accordionItemDisabled", "f:item2");
}
}
Added: trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TabPanelRendererTest.java
===================================================================
--- trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TabPanelRendererTest.java (rev 0)
+++ trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TabPanelRendererTest.java 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,19 @@
+package org.richfaces.renderkit.html;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+public class TabPanelRendererTest extends RendererTestBase {
+
+ @Test
+ public void testTabPanel() throws IOException, SAXException {
+ doTest("tabPanel", "f:tabPanel");
+ }
+
+ @Test
+ public void testTab() throws IOException, SAXException {
+ doTest("tab", "f:tabPanel");
+ }
+}
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xhtml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ 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.
+-->
+
+
+<!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:fn="http://java.sun.com/jsp/jstl/functions"
+ 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"
+ >
+
+<h:head>
+ <title>Richfaces Accordion Test</title>
+</h:head>
+
+<h:body>
+ <h:form id="f">
+ <pn:accordion id="accordion"
+ itemActiveHeaderClass="my-ac-active-header-class"
+ itemInactiveHeaderClass="my-ac-inactive-header-class"
+ itemDisabledHeaderClass="my-ac-disabled-header-class">
+ <pn:accordionItem id="item"/>
+ <pn:accordionItem id="item2" disabled="true"/>
+ </pn:accordion>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordion.xmlunit.xml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,55 @@
+<div id="f:accordion" class="rf-ac">
+ <input type="hidden" value="item" id="f:accordion-value" name="f:accordion-value"/>
+ <script type="text/javascript">
+ //<![CDATA[
+new RichFaces.ui.Accordion("f:accordion",{"ajax":{"incId":"1"} ,"activeItem":"item","isKeepHeight":false,"cycledSwitching":false} )
+//]]>
+ </script>
+ <div id="f:item" class="rf-ac-itm">
+ <div class="rf-ac-itm-hdr rf-ac-itm-hdr-act" id="f:item:header">
+ <table class="rf-ac-itm-gr">
+ <tbody>
+ <tr>
+ <td class="rf-ac-itm-lbl">
+ <div class="rf-ac-itm-lbl-act my-ac-active-header-class">
+ item
+ </div>
+ <div class="rf-ac-itm-lbl-inact my-ac-inactive-header-class">
+ item
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="rf-ac-itm-cnt" id="f:item:content">
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+new RichFaces.ui.AccordionItem("f:item",{"index":0,"togglePanelId":"f:accordion","switchMode":"ajax","name":"item","disabled":false} )
+//]]>
+ </script>
+ </div>
+ <div id="f:item2" class="rf-ac-itm">
+ <div class="rf-ac-itm-hdr rf-ac-itm-hdr-dis" id="f:item2:header">
+ <table class="rf-ac-itm-gr">
+ <tbody>
+ <tr>
+ <td class="rf-ac-itm-lbl">
+ <div class="rf-ac-itm-lbl-dis my-ac-disabled-header-class">
+ item2
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="rf-ac-itm-cnt" id="f:item2:content" style="display: none">
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+new RichFaces.ui.AccordionItem("f:item2",{"index":1,"togglePanelId":"f:accordion","switchMode":"ajax","name":"item2","disabled":true} )
+//]]>
+ </script>
+ </div>
+</div>
\ No newline at end of file
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml 2011-02-03 12:58:29 UTC (rev 21414)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xhtml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -22,7 +22,8 @@
-->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!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:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:h="http://java.sun.com/jsf/html"
@@ -31,14 +32,15 @@
xmlns:pn="http://richfaces.org/output"
>
- <h:head>
- <title>Richfaces MenuItem Test</title>
- </h:head>
+<h:head>
+ <title>Richfaces MenuItem Test</title>
+</h:head>
<h:body>
<h:form id="f">
- <pn:accordion>
- <pn:accordionItem id="item"></pn:accordionItem>
+ <pn:accordion id="accordion">
+ <pn:accordionItem id="item" headerActiveClass="my-ac-it-active-header-class" headerInactiveClass="my-ac-it-inactive-header-class"/>
+ <pn:accordionItem id="item2" disabled="true" headerDisabledClass="my-ac-it-disabled-header-class"/>
</pn:accordion>
</h:form>
</h:body>
Modified: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml 2011-02-03 12:58:29 UTC (rev 21414)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItem.xmlunit.xml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -4,8 +4,8 @@
<tbody>
<tr>
<td class="rf-ac-itm-lbl">
- <div class="rf-ac-itm-lbl-act">item</div>
- <div class="rf-ac-itm-lbl-inact">item</div>
+ <div class="rf-ac-itm-lbl-act my-ac-it-active-header-class">item</div>
+ <div class="rf-ac-itm-lbl-inact my-ac-it-inactive-header-class">item</div>
</td>
</tr>
</tbody>
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItemDisabled.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItemDisabled.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/accordionItemDisabled.xmlunit.xml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,22 @@
+<div id="f:item2" class="rf-ac-itm">
+ <div class="rf-ac-itm-hdr rf-ac-itm-hdr-dis" id="f:item2:header">
+ <table class="rf-ac-itm-gr">
+ <tbody>
+ <tr>
+ <td class="rf-ac-itm-lbl">
+ <div class="rf-ac-itm-lbl-dis my-ac-it-disabled-header-class">
+ item2
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="rf-ac-itm-cnt" id="f:item2:content" style="display: none">
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+new RichFaces.ui.AccordionItem("f:item2",{"index":1,"togglePanelId":"f:accordion","switchMode":"ajax","name":"item2","disabled":true} )
+//]]>
+ </script>
+</div>
\ No newline at end of file
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xhtml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ 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.
+-->
+
+
+<!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:pn="http://richfaces.org/output">
+
+<h:head>
+ <title>Richfaces Tab Test</title>
+</h:head>
+
+<h:body>
+ <h:form id="f">
+ <pn:tabPanel id="tabPanel">
+ <pn:tab id="tab" headerActiveClass="my-tab-active-header-class" headerInactiveClass="my-tab-inactive-header-class" />
+ <pn:tab id="tab2" disabled="true" headerDisabledClass="my-tab-disabled-header-class"/>
+ </pn:tabPanel>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tab.xmlunit.xml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,82 @@
+<div id="f:tabPanel" class="rf-tbp" style="width: 100%;">
+ <input type="hidden" value="tab" id="f:tabPanel-value" name="f:tabPanel-value"/>
+ <script type="text/javascript">
+//<![CDATA[
+//]]>
+ </script>
+ <div class="rf-tab-hdr-tabline-vis">
+ <table class="rf-tab-hdr-tabs" cellspacing="0">
+ <tbody>
+ <tr>
+ <td style="padding-left: 5px;" class="rf-tab-hdr-spcr">
+ <br/>
+ </td>
+ <td id="f:tab:header:inactive" class="rf-tab-hdr rf-tab-hdr-inact my-tab-inactive-header-class" style="display : none">
+ <span class="rf-tab-lbl">
+ tab
+ </span>
+ </td>
+ <td id="f:tab:header:active" class="rf-tab-hdr rf-tab-hdr-act my-tab-active-header-class" style="">
+ <span class="rf-tab-lbl">
+ tab
+ </span>
+ </td>
+ <td id="f:tab:header:disabled" class="rf-tab-hdr rf-tab-hdr-dis" style="display : none">
+ <span class="rf-tab-lbl">
+ tab
+ </span>
+ </td>
+ <td style="" class="rf-tab-hdr-spcr rf-tab-hortab-tabspcr-wdh">
+ <br/>
+ </td>
+ <td id="f:tab2:header:inactive" class="rf-tab-hdr rf-tab-hdr-inact" style="display : none">
+ <span class="rf-tab-lbl">
+ tab2
+ </span>
+ </td>
+ <td id="f:tab2:header:active" class="rf-tab-hdr rf-tab-hdr-act" style="display : none">
+ <span class="rf-tab-lbl">
+ tab2
+ </span>
+ </td>
+ <td id="f:tab2:header:disabled" class="rf-tab-hdr rf-tab-hdr-dis my-tab-disabled-header-class" style="">
+ <span class="rf-tab-lbl">
+ tab2
+ </span>
+ </td>
+ <td style="" class="rf-tab-hdr-spcr rf-tab-hortab-tabspcr-wdh">
+ <br/>
+ </td>
+ <td style="padding-right: 5px; width: 100%;" class="rf-tab-hdr-spcr">
+ <br/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <div class="rf-tab-hdr-scrl-lft rf-tab-hdn">
+ «
+ </div>
+ <div class="rf-tab-hdr-tablst rf-tab-hdn">
+ ↓
+ </div>
+ <div class="rf-tab-hdr-scrl-rgh rf-tab-hdn">
+ »
+ </div>
+ </div>
+ <div class="rf-tab-hdr-brd">
+ </div>
+ <div id="f:tab" class="rf-tab">
+ <div class="rf-tab-cnt" id="f:tab:content">
+ </div>
+ <script type="text/javascript">
+//<![CDATA[
+//]]>
+ </script>
+ </div>
+ <div id="f:tab2" style="display:none;">
+ <script type="text/javascript">
+//<![CDATA[
+//]]>
+ </script>
+ </div>
+</div>
\ No newline at end of file
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xhtml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xhtml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,48 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ 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.
+-->
+
+
+<!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:pn="http://richfaces.org/output">
+
+<h:head>
+ <title>Richfaces Tab Panel Test</title>
+</h:head>
+
+<h:body>
+ <h:form id="f">
+ <pn:tabPanel id="tabPanel"
+ tabActiveHeaderClass="my-tp-active-header-class"
+ tabInactiveHeaderClass="my-tp-inactive-header-class"
+ tabDisabledHeaderClass="my-tp-disabled-header-class">
+ <pn:tab id="tab"/>
+ <pn:tab id="tab2" disabled="true"/>
+ </pn:tabPanel>
+ </h:form>
+</h:body>
+</html>
+
+
Added: trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xmlunit.xml
===================================================================
--- trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xmlunit.xml (rev 0)
+++ trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tabPanel.xmlunit.xml 2011-02-03 13:30:51 UTC (rev 21415)
@@ -0,0 +1,90 @@
+<div id="f:tabPanel" class="rf-tbp" style="width: 100%;">
+ <input type="hidden" value="tab" id="f:tabPanel-value" name="f:tabPanel-value"/>
+ <script type="text/javascript">
+ //<![CDATA[
+new RichFaces.ui.TabPanel("f:tabPanel",{"ajax":{"incId":"1"} ,"activeItem":"tab","isKeepHeight":false,"cycledSwitching":false} )
+//]]>
+ </script>
+ <div class="rf-tab-hdr-tabline-vis">
+ <table class="rf-tab-hdr-tabs" cellspacing="0">
+ <tbody>
+ <tr>
+ <td style="padding-left: 5px;" class="rf-tab-hdr-spcr">
+ <br/>
+ </td>
+ <td id="f:tab:header:inactive" class="rf-tab-hdr rf-tab-hdr-inact my-tp-inactive-header-class"
+ style="display : none">
+ <span class="rf-tab-lbl">
+ tab
+ </span>
+ </td>
+ <td id="f:tab:header:active" class="rf-tab-hdr rf-tab-hdr-act my-tp-active-header-class" style="">
+ <span class="rf-tab-lbl">
+ tab
+ </span>
+ </td>
+ <td id="f:tab:header:disabled" class="rf-tab-hdr rf-tab-hdr-dis my-tp-disabled-header-class"
+ style="display : none">
+ <span class="rf-tab-lbl">
+ tab
+ </span>
+ </td>
+ <td style="" class="rf-tab-hdr-spcr rf-tab-hortab-tabspcr-wdh">
+ <br/>
+ </td>
+ <td id="f:tab2:header:inactive" class="rf-tab-hdr rf-tab-hdr-inact my-tp-inactive-header-class"
+ style="display : none">
+ <span class="rf-tab-lbl">
+ tab2
+ </span>
+ </td>
+ <td id="f:tab2:header:active" class="rf-tab-hdr rf-tab-hdr-act my-tp-active-header-class"
+ style="display : none">
+ <span class="rf-tab-lbl">
+ tab2
+ </span>
+ </td>
+ <td id="f:tab2:header:disabled" class="rf-tab-hdr rf-tab-hdr-dis my-tp-disabled-header-class"
+ style="">
+ <span class="rf-tab-lbl">
+ tab2
+ </span>
+ </td>
+ <td style="" class="rf-tab-hdr-spcr rf-tab-hortab-tabspcr-wdh">
+ <br/>
+ </td>
+ <td style="padding-right: 5px; width: 100%;" class="rf-tab-hdr-spcr">
+ <br/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <div class="rf-tab-hdr-scrl-lft rf-tab-hdn">
+ «
+ </div>
+ <div class="rf-tab-hdr-tablst rf-tab-hdn">
+ ↓
+ </div>
+ <div class="rf-tab-hdr-scrl-rgh rf-tab-hdn">
+ »
+ </div>
+ </div>
+ <div class="rf-tab-hdr-brd">
+ </div>
+ <div id="f:tab" class="rf-tab">
+ <div class="rf-tab-cnt" id="f:tab:content">
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+new RichFaces.ui.Tab("f:tab",{"index":0,"leave":null,"togglePanelId":"f:tabPanel","switchMode":"ajax","name":"tab","enter":null,"disabled":false} )
+//]]>
+ </script>
+ </div>
+ <div id="f:tab2" style="display:none;">
+ <script type="text/javascript">
+ //<![CDATA[
+new RichFaces.ui.Tab("f:tab2",{"index":1,"leave":null,"togglePanelId":"f:tabPanel","switchMode":"ajax","name":"tab2","enter":null,"disabled":true} )
+//]]>
+ </script>
+ </div>
+</div>
\ No newline at end of file
14 years, 7 months
JBoss Rich Faces SVN: r21414 - in trunk/ui/output/ui/src/main/java/org/richfaces: renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-02-03 07:58:29 -0500 (Thu, 03 Feb 2011)
New Revision: 21414
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java
Log:
RF-10409 ProgressBar: using defaults(min and max) breaks component look and feel
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java 2011-02-03 11:33:22 UTC (rev 21413)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractProgressBar.java 2011-02-03 12:58:29 UTC (rev 21414)
@@ -133,7 +133,7 @@
public abstract int getMinValue();
@Attribute
- public abstract Object getValue();
+ public abstract int getValue();
@Attribute(hidden = true)
public abstract String getResource();
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2011-02-03 11:33:22 UTC (rev 21413)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2011-02-03 12:58:29 UTC (rev 21414)
@@ -121,9 +121,9 @@
if (isResourceMode(component)) {
result = ProgressBarState.initialState;
} else {
- Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue"));
- Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue"));
- Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
+ Number minValue = NumberUtils.getNumber(getMinValueOrDefault(component));
+ Number maxValue = NumberUtils.getNumber(getMaxValueOrDefault(component));
+ Number value = NumberUtils.getNumber(((AbstractProgressBar) component).getValue());
if (value.doubleValue() < minValue.doubleValue()) {
result = ProgressBarState.initialState;
@@ -197,7 +197,7 @@
protected int getMaxValueOrDefault(UIComponent component) {
int maxValue = ((AbstractProgressBar) component).getMaxValue();
- if (maxValue == 0) {
+ if (maxValue == Integer.MIN_VALUE) {
maxValue = DEFAULT_MAX_VALUE;
}
return maxValue;
@@ -205,7 +205,7 @@
protected int getMinValueOrDefault(UIComponent component) {
int maxValue = ((AbstractProgressBar) component).getMinValue();
- if (maxValue == 0) {
+ if (maxValue == Integer.MIN_VALUE) {
maxValue = DEFAULT_MIN_VALUE;
}
return maxValue;
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java 2011-02-03 11:33:22 UTC (rev 21413)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarStateEncoder.java 2011-02-03 12:58:29 UTC (rev 21414)
@@ -27,6 +27,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import org.richfaces.component.AbstractProgressBar;
import org.richfaces.component.NumberUtils;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.renderkit.HtmlConstants;
@@ -37,6 +38,10 @@
*/
class ProgressBarStateEncoder {
+ private static final int DEFAULT_MIN_VALUE = 0;
+
+ private static final int DEFAULT_MAX_VALUE = 100;
+
private boolean renderContentAsPlaceHolders;
public ProgressBarStateEncoder(boolean renderContentAsPlaceHolders) {
@@ -78,9 +83,9 @@
}
protected String getWidth(UIComponent component) {
- Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
- Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue") == null ? 0 : component.getAttributes().get("minValue"));
- Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue") == null ? 100 : component.getAttributes().get("maxValue"));
+ Number value = NumberUtils.getNumber(((AbstractProgressBar) component).getValue());
+ Number minValue = NumberUtils.getNumber(getMinValueOrDefault(component));
+ Number maxValue = NumberUtils.getNumber(getMaxValueOrDefault(component));
Number percent = calculatePercent(value, minValue, maxValue);
return String.valueOf(percent.intValue());
@@ -169,4 +174,20 @@
throws IOException {
encodeStateFacet(context, component, ProgressBarState.finishState, currentState);
}
+
+ protected int getMaxValueOrDefault(UIComponent component) {
+ int maxValue = ((AbstractProgressBar) component).getMaxValue();
+ if (maxValue == Integer.MIN_VALUE) {
+ maxValue = DEFAULT_MAX_VALUE;
+ }
+ return maxValue;
+ }
+
+ protected int getMinValueOrDefault(UIComponent component) {
+ int maxValue = ((AbstractProgressBar) component).getMinValue();
+ if (maxValue == Integer.MIN_VALUE) {
+ maxValue = DEFAULT_MIN_VALUE;
+ }
+ return maxValue;
+ }
}
14 years, 7 months