Author: Alex.Kolonitsky
Date: 2010-12-08 07:16:21 -0500 (Wed, 08 Dec 2010)
New Revision: 20453
Added:
trunk/examples/output-demo/src/main/java/org/richfaces/RF9851.java
trunk/examples/output-demo/src/main/webapp/examples/accordion/RF-9851.xhtml
Modified:
trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
Log:
RF-9851 accordion: wrong decode behavior
Added: trunk/examples/output-demo/src/main/java/org/richfaces/RF9851.java
===================================================================
--- trunk/examples/output-demo/src/main/java/org/richfaces/RF9851.java
(rev 0)
+++ trunk/examples/output-demo/src/main/java/org/richfaces/RF9851.java 2010-12-08 12:16:21
UTC (rev 20453)
@@ -0,0 +1,60 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+/**
+ * @author akolonitsky
+ * @since Dec 6, 2010
+ */
+@ManagedBean(name = "RF9851")
+@SessionScoped
+public class RF9851 {
+ private String name;
+ private String email;
+
+ public RF9851() {
+ System.out.println("RF9851.RF9851");
+ }
+
+ public String getName() {
+ System.out.println("RF9851.getName");
+ return name;
+ }
+
+ public void setName(String name) {
+ System.out.println("RF9851.setName name = " + name);
+ this.name = name;
+ }
+
+ public String getEmail() {
+ System.out.println("RF9851.getEmail");
+ return email;
+ }
+
+ public void setEmail(String email) {
+ System.out.println("RF9851.setEmail email = " + email);
+ this.email = email;
+ }
+}
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-12-08
11:55:26 UTC (rev 20452)
+++ trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-08
12:16:21 UTC (rev 20453)
@@ -62,6 +62,10 @@
<to-view-id>/examples/accordion/RF-9364.xhtml</to-view-id>
</navigation-case>
<navigation-case>
+ <from-outcome>RF-9851</from-outcome>
+ <to-view-id>/examples/accordion/RF-9851.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
<from-outcome>qunit/accordion</from-outcome>
<to-view-id>/qunit/accordion.xhtml</to-view-id>
</navigation-case>
Added: trunk/examples/output-demo/src/main/webapp/examples/accordion/RF-9851.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/accordion/RF-9851.xhtml
(rev 0)
+++ trunk/examples/output-demo/src/main/webapp/examples/accordion/RF-9851.xhtml 2010-12-08
12:16:21 UTC (rev 20453)
@@ -0,0 +1,54 @@
+<!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="title">Accordion Example</ui:define>
+ <ui:define name="body_head">Accordion Example</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <pre>
+ two critical issues there:
+ 1)
+ a) enter something into input at default item
+ b) switch to second
+ c) enter something to input there
+ d) click submit
+ RESULT - nothing being encoded for outputText's
+
+ 2)
+ a) enter something into input at default item
+ b) switch to second
+ c) enter something to input there
+ d) return to default tab(in order current item to be in sync with
server side current)
+ e) click submit
+ RESULT - only one typed message encoded.
+ </pre>
+
+ <h:form>
+ <pn:accordion switchType="ajax" id="acc">
+ <pn:accordionItem header="Overview:" id="i1">
+ <h:inputText value="#{RF9851.name}"/>
+ </pn:accordionItem>
+ <pn:accordionItem header="JSF 2 and RichFaces 4:"
id="i2">
+ <h:inputText value="#{RF9851.email}"/>
+
+ </pn:accordionItem>
+ </pn:accordion>
+ <h:commandButton/>
+ <h:outputText value="#{RF9851.name}"/>
+ <h:outputText value="#{RF9851.email}"/>
+ <h:messages/>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified: trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-12-08
11:55:26 UTC (rev 20452)
+++ trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-12-08
12:16:21 UTC (rev 20453)
@@ -80,6 +80,7 @@
<p>Bugs</p>
<ul>
<li><h:commandLink value="RF-9364"
action="RF-9364" /></li>
+ <li><h:commandLink value="RF-9851"
action="RF-9851" /></li>
</ul>
</li>
</ul>
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-12-08
11:55:26 UTC (rev 20452)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-12-08
12:16:21 UTC (rev 20453)
@@ -111,7 +111,6 @@
return (Boolean) getStateHelper().eval(PropertyKeys.valid, true);
}
-
public void setValid(boolean valid) {
getStateHelper().put(PropertyKeys.valid, valid);
}
@@ -129,12 +128,10 @@
getStateHelper().put(PropertyKeys.required, required);
}
-
public boolean isImmediate() {
return (Boolean) getStateHelper().eval(PropertyKeys.immediate, false);
}
-
public void setImmediate(boolean immediate) {
getStateHelper().put(PropertyKeys.immediate, immediate);
}
@@ -170,7 +167,7 @@
String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isActiveItem(kid, activeItem)) {
+ if (isActiveItem(kid, activeItem) || this.getSwitchType() ==
SwitchType.client) {
kid.processDecodes(context);
}
}
@@ -184,8 +181,6 @@
} finally {
popComponentFromEL(context);
}
-
- executeValidate(context);
}
/**
@@ -222,7 +217,7 @@
String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isActiveItem(kid, activeItem)) {
+ if (isActiveItem(kid, activeItem) || this.getSwitchType() ==
SwitchType.client) {
kid.processValidators(context);
}
}
@@ -262,13 +257,13 @@
String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isActiveItem(kid, activeItem)) {
+ if (isActiveItem(kid, activeItem) || this.getSwitchType() ==
SwitchType.client) {
kid.processUpdates(context);
}
}
-
+
popComponentFromEL(context);
-
+
try {
updateModel(context);
} catch (RuntimeException e) {
@@ -276,6 +271,7 @@
throw e;
}
+ executeValidate(context);
if (!isValid()) {
context.renderResponse();
}
@@ -310,7 +306,7 @@
if (ve == null) {
return;
}
-
+
Throwable caught = null;
FacesMessage message = null;
try {
@@ -327,7 +323,7 @@
}
if (messageStr == null) {
- message =
ServiceTracker.getService(MessageFactory.class).createMessage(context,
+ message =
ServiceTracker.getService(MessageFactory.class).createMessage(context,
FacesMessage.SEVERITY_ERROR,
FacesMessages.UIINPUT_UPDATE, MessageUtil.getLabel(context, this));
} else {
@@ -347,7 +343,7 @@
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
UpdateModelException toQueue = new UpdateModelException(message, caught);
ExceptionQueuedEventContext eventContext = new
ExceptionQueuedEventContext(context,
- toQueue, this, PhaseId.UPDATE_MODEL_VALUES);
+ toQueue, this, PhaseId.UPDATE_MODEL_VALUES);
context.getApplication().publishEvent(context, ExceptionQueuedEvent.class,
eventContext);
}
}
@@ -404,7 +400,6 @@
}
}
-
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
@@ -416,6 +411,7 @@
}
// -------------------------------------------------- Panel Items Managing
+
@Override
public String getFamily() {
return COMPONENT_FAMILY;
@@ -442,7 +438,7 @@
if (kid == null || value == null) {
return false;
}
-
+
return getChildName(kid).equals(value);
}
@@ -457,7 +453,7 @@
return ((AbstractTogglePanelItem) item).getName();
}
-
+
public AbstractTogglePanelItem getItemByIndex(final int index) {
List<AbstractTogglePanelItem> children = getRenderedItems();
if (isCycledSwitching()) {
@@ -523,14 +519,14 @@
if (name == null) {
throw new IllegalArgumentException("Name is required parameter.");
}
-
+
List<AbstractTogglePanelItem> items = getRenderedItems();
for (int ind = 0; ind < items.size(); ind++) {
if (name.equals(items.get(ind).getName())) {
return ind;
}
}
-
+
return Integer.MIN_VALUE;
}
@@ -583,7 +579,6 @@
public abstract MethodExpression getItemChangeListener();
-
// ------------------------------------------------ Event Processing Methods
public void addItemChangeListener(ItemChangeListener listener) {