[richfaces-issues] [JBoss JIRA] (RF-11803) render of 'c:' and 'fn:' is one click behind

Milo van der Zee (Updated) (JIRA) jira-events at lists.jboss.org
Thu Dec 8 05:07:40 EST 2011


     [ https://issues.jboss.org/browse/RF-11803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milo van der Zee updated RF-11803:
----------------------------------

    Description: 
'c:' and 'fn:' is rendered differently from previous versions.
When clicking the inc and dec buttons in the example you can see that the field contents are updates each click but the number of fields is not (comma at the end when pressing 'dec'. Pressing 'render' then fixes the output.
When using a function to render it works fine. Even though the function does not do much.

MAG,
Milo

{code:title="testje4.xhtml"}
<!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:a4j="http://richfaces.org/a4j"
  xmlns:rich="http://richfaces.org/rich"
  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
  xmlns:c="http://java.sun.com/jsp/jstl/core"
>

<h:head>
</h:head>

<h:body>
	<h:form>
		<a4j:jsFunction name="render" render="panel,counter" bypassUpdates="true" immediate="true" execute="@none"/>
		
		<a4j:outputPanel id="counter">
			Counter: #{testBean.counter}<br/>
		</a4j:outputPanel>
		
		<hr/>
		<a4j:outputPanel id="panel">
			<c:forEach id="fieldsDefinitions" items="#{testBean.fieldsList}" var="field" varStatus="status">
				<c:set var="fields" value="#{fields}#{field}#{status.last?'':','}"/>
			</c:forEach>
			<c:set var="fieldsArray" value="#{fn:split(fields, ',')}"/>
			<a4j:repeat id="repeat" value="#{fieldsArray}" var="field" rowKeyVar="status">
				#{status+1}: '#{field}', '#{fields}'<br/>
			</a4j:repeat>
		</a4j:outputPanel>
		<hr/>
		
		Direct render:
		<a4j:commandButton value="dec" actionListener="#{testBean.decCounter()}" render="counter, panel"/>
		<a4j:commandButton value="inc" actionListener="#{testBean.incCounter()}" render="counter, panel"/>
		<br/>
		With function to render: 
		<a4j:commandButton value="dec" actionListener="#{testBean.decCounter()}" oncomplete="render();"/>
		<a4j:commandButton value="inc" actionListener="#{testBean.incCounter()}" oncomplete="render();"/>
		<br/>
		Manual render:
		<a4j:commandButton value="render" render="counter, panel"/>
	</h:form>
</h:body>

</html>
{code}

{code:title="testBean.java"}
package com.vetmanager.base.test;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import edu.emory.mathcs.backport.java.util.Arrays;

@ManagedBean
@SessionScoped
public class TestBean {
	private int counter = 5;

	public List<Integer> getTable() {
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < counter; i++) {
			Double number = Double.valueOf(Math.random() * 1000);
			list.add(Integer.valueOf(number.intValue()));
		}

		return list;
	}

	public String getFieldsString() {
		StringBuilder builder = new StringBuilder();
		boolean firstField = true;
		for (int i = 0; i < counter; i++) {
			if (!firstField) builder.append(',');
			firstField = false;

			char[] fill = new char[i + 1];
			Arrays.fill(fill, Character.forDigit(counter, 10));
			String fieldName = new String(fill);

			builder.append(fieldName);
		}
		return builder.toString();
	}

	@SuppressWarnings("unchecked")
	public List<String> getFieldsList() {
		String string = getFieldsString();
		List<String> list = Arrays.asList(string.split(","));
		return list;
	}

	public void decCounter() {
		counter--;
		if (counter < 1) counter = 1;
	}

	public void incCounter() {
		counter++;
		if (counter > 9) counter = 9;
	}

	public int getCounter() {
		return counter;
	}

	public void setCounter(int counter) {
		this.counter = counter;
	}

}
{code}

  was:
'c:' and 'fn:' is rendered differently from previous versions.
When clicking the inc and dec buttons in the example you can see that the field contents are updates each click but the number of fields is not (comma at the end when pressing 'dec'. Pressing 'render' then fixes the output.
When using a function to render it works fine. Even though the function does not do much.

MAG,
Milo

{code title="testje4.xhtml"}
<!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:a4j="http://richfaces.org/a4j"
  xmlns:rich="http://richfaces.org/rich"
  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
  xmlns:c="http://java.sun.com/jsp/jstl/core"
>

<h:head>
</h:head>

<h:body>
	<h:form>
		<a4j:jsFunction name="render" render="panel,counter" bypassUpdates="true" immediate="true" execute="@none"/>
		
		<a4j:outputPanel id="counter">
			Counter: #{testBean.counter}<br/>
		</a4j:outputPanel>
		
		<hr/>
		<a4j:outputPanel id="panel">
			<c:forEach id="fieldsDefinitions" items="#{testBean.fieldsList}" var="field" varStatus="status">
				<c:set var="fields" value="#{fields}#{field}#{status.last?'':','}"/>
			</c:forEach>
			<c:set var="fieldsArray" value="#{fn:split(fields, ',')}"/>
			<a4j:repeat id="repeat" value="#{fieldsArray}" var="field" rowKeyVar="status">
				#{status+1}: '#{field}', '#{fields}'<br/>
			</a4j:repeat>
		</a4j:outputPanel>
		<hr/>
		
		Direct render:
		<a4j:commandButton value="dec" actionListener="#{testBean.decCounter()}" render="counter, panel"/>
		<a4j:commandButton value="inc" actionListener="#{testBean.incCounter()}" render="counter, panel"/>
		<br/>
		With function to render: 
		<a4j:commandButton value="dec" actionListener="#{testBean.decCounter()}" oncomplete="render();"/>
		<a4j:commandButton value="inc" actionListener="#{testBean.incCounter()}" oncomplete="render();"/>
		<br/>
		Manual render:
		<a4j:commandButton value="render" render="counter, panel"/>
	</h:form>
</h:body>

</html>
{code}

{code title="testBean.java"}
package com.vetmanager.base.test;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import edu.emory.mathcs.backport.java.util.Arrays;

@ManagedBean
@SessionScoped
public class TestBean {
	private int counter = 5;

	public List<Integer> getTable() {
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < counter; i++) {
			Double number = Double.valueOf(Math.random() * 1000);
			list.add(Integer.valueOf(number.intValue()));
		}

		return list;
	}

	public String getFieldsString() {
		StringBuilder builder = new StringBuilder();
		boolean firstField = true;
		for (int i = 0; i < counter; i++) {
			if (!firstField) builder.append(',');
			firstField = false;

			char[] fill = new char[i + 1];
			Arrays.fill(fill, Character.forDigit(counter, 10));
			String fieldName = new String(fill);

			builder.append(fieldName);
		}
		return builder.toString();
	}

	@SuppressWarnings("unchecked")
	public List<String> getFieldsList() {
		String string = getFieldsString();
		List<String> list = Arrays.asList(string.split(","));
		return list;
	}

	public void decCounter() {
		counter--;
		if (counter < 1) counter = 1;
	}

	public void incCounter() {
		counter++;
		if (counter > 9) counter = 9;
	}

	public int getCounter() {
		return counter;
	}

	public void setCounter(int counter) {
		this.counter = counter;
	}

}
{code}


    
> render of 'c:' and 'fn:' is one click behind
> --------------------------------------------
>
>                 Key: RF-11803
>                 URL: https://issues.jboss.org/browse/RF-11803
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>         Environment: MyFaces 2.1.5, Tomcat 7.0.22, 4.1.0-20111204 from showcase
>            Reporter: Milo van der Zee
>            Priority: Minor
>              Labels: render
>
> 'c:' and 'fn:' is rendered differently from previous versions.
> When clicking the inc and dec buttons in the example you can see that the field contents are updates each click but the number of fields is not (comma at the end when pressing 'dec'. Pressing 'render' then fixes the output.
> When using a function to render it works fine. Even though the function does not do much.
> MAG,
> Milo
> {code:title="testje4.xhtml"}
> <!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:a4j="http://richfaces.org/a4j"
>   xmlns:rich="http://richfaces.org/rich"
>   xmlns:fn="http://java.sun.com/jsp/jstl/functions"
>   xmlns:c="http://java.sun.com/jsp/jstl/core"
> >
> <h:head>
> </h:head>
> <h:body>
> 	<h:form>
> 		<a4j:jsFunction name="render" render="panel,counter" bypassUpdates="true" immediate="true" execute="@none"/>
> 		
> 		<a4j:outputPanel id="counter">
> 			Counter: #{testBean.counter}<br/>
> 		</a4j:outputPanel>
> 		
> 		<hr/>
> 		<a4j:outputPanel id="panel">
> 			<c:forEach id="fieldsDefinitions" items="#{testBean.fieldsList}" var="field" varStatus="status">
> 				<c:set var="fields" value="#{fields}#{field}#{status.last?'':','}"/>
> 			</c:forEach>
> 			<c:set var="fieldsArray" value="#{fn:split(fields, ',')}"/>
> 			<a4j:repeat id="repeat" value="#{fieldsArray}" var="field" rowKeyVar="status">
> 				#{status+1}: '#{field}', '#{fields}'<br/>
> 			</a4j:repeat>
> 		</a4j:outputPanel>
> 		<hr/>
> 		
> 		Direct render:
> 		<a4j:commandButton value="dec" actionListener="#{testBean.decCounter()}" render="counter, panel"/>
> 		<a4j:commandButton value="inc" actionListener="#{testBean.incCounter()}" render="counter, panel"/>
> 		<br/>
> 		With function to render: 
> 		<a4j:commandButton value="dec" actionListener="#{testBean.decCounter()}" oncomplete="render();"/>
> 		<a4j:commandButton value="inc" actionListener="#{testBean.incCounter()}" oncomplete="render();"/>
> 		<br/>
> 		Manual render:
> 		<a4j:commandButton value="render" render="counter, panel"/>
> 	</h:form>
> </h:body>
> </html>
> {code}
> {code:title="testBean.java"}
> package com.vetmanager.base.test;
> import java.util.ArrayList;
> import java.util.List;
> import javax.faces.bean.ManagedBean;
> import javax.faces.bean.SessionScoped;
> import edu.emory.mathcs.backport.java.util.Arrays;
> @ManagedBean
> @SessionScoped
> public class TestBean {
> 	private int counter = 5;
> 	public List<Integer> getTable() {
> 		List<Integer> list = new ArrayList<Integer>();
> 		for (int i = 0; i < counter; i++) {
> 			Double number = Double.valueOf(Math.random() * 1000);
> 			list.add(Integer.valueOf(number.intValue()));
> 		}
> 		return list;
> 	}
> 	public String getFieldsString() {
> 		StringBuilder builder = new StringBuilder();
> 		boolean firstField = true;
> 		for (int i = 0; i < counter; i++) {
> 			if (!firstField) builder.append(',');
> 			firstField = false;
> 			char[] fill = new char[i + 1];
> 			Arrays.fill(fill, Character.forDigit(counter, 10));
> 			String fieldName = new String(fill);
> 			builder.append(fieldName);
> 		}
> 		return builder.toString();
> 	}
> 	@SuppressWarnings("unchecked")
> 	public List<String> getFieldsList() {
> 		String string = getFieldsString();
> 		List<String> list = Arrays.asList(string.split(","));
> 		return list;
> 	}
> 	public void decCounter() {
> 		counter--;
> 		if (counter < 1) counter = 1;
> 	}
> 	public void incCounter() {
> 		counter++;
> 		if (counter > 9) counter = 9;
> 	}
> 	public int getCounter() {
> 		return counter;
> 	}
> 	public void setCounter(int counter) {
> 		this.counter = counter;
> 	}
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list