Dynamically generated TabPanel
------------------------------

                 Key: RF-7962
                 URL: https://jira.jboss.org/jira/browse/RF-7962
             Project: RichFaces
          Issue Type: Bug
          Components: component
    Affects Versions: 3.3.2.GA
         Environment: JBoss AS 5.1.0.GA, JDK6
            Reporter: Lukas Fryc
            Assignee: Ilya Shaikovsky


When generates rich:tabPanel dynamically using c:forEach, the model doesn't 
accept removing and adding again the rich:tab with the same id.

Maven sample attached (dyntabpanel.tar.gz).

Reproducing:
1. open application /dyntabpanel
2. let inputText as "2"
3. click Remove (the tab with "2" disappers)
4. click Add (EXCEPTION)

[code]
package org.richfaces.samples.dyntabpanel;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class Bean {
        List<String> tabs = new LinkedList<String>(Arrays.asList(new String[] 
{"1", "2", "3"}));
        String number = "2";
        
        public String getNumber() {
                return number;
        }
        
        public void setNumber(String number) {
                this.number = number;
        }
        
        public String[] getNumberArray() {
                return tabs.toArray(new String[tabs.size()]);
        }
        
        public void remove() {
                if (tabs.contains(number)) {
                        tabs.remove(number);
                }
        }
        
        public void add() {
                if (!tabs.contains(number)) {
                        tabs.add(number);
                }
        }
}
[/code]

[code]
<!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:c="http://java.sun.com/jstl/core";
        xmlns:f="http://java.sun.com/jsf/core";
        xmlns:h="http://java.sun.com/jsf/html";
        xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns:a4j="http://richfaces.org/a4j";
        xmlns:rich="http://richfaces.org/rich";>
<head>
<title></title>
</head>
<body>

<f:view>
        <ui:debug />
        
        <h:form>
                <h:inputText value="#{bean.number}" />
                <a4j:commandButton value="Add" action="#{bean.add}" 
reRender="numbers" />
                <a4j:commandButton value="Remove" action="#{bean.remove}" 
reRender="numbers" />
        </h:form>
        
        <rich:tabPanel switchType="ajax" id="numbers">
                <c:forEach items="#{bean.numberArray}" var="number">
                        <rich:tab id="tab#{number}" label="#{number}" />
                </c:forEach>
        </rich:tabPanel>
</f:view>

</body>
</html>
[/cpde]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to