Author: ppitonak(a)redhat.com
Date: 2011-12-08 08:02:30 -0500 (Thu, 08 Dec 2011)
New Revision: 23062
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/lazyLoading.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTabPanelBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/list.xhtml
Log:
added reproducer for a bug in tabPanel (RF_11782)
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTabPanelBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTabPanelBean.java 2011-12-08
11:13:40 UTC (rev 23061)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTabPanelBean.java 2011-12-08
13:02:30 UTC (rev 23062)
@@ -38,7 +38,7 @@
/**
* Managed bean for rich:tabPanel.
- *
+ *
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
@@ -49,7 +49,7 @@
private static final long serialVersionUID = -1L;
private static Logger logger;
private Attributes attributes;
-
+
private List<UITab> tabs = new ArrayList<UITab>();
private List<TabBean> tabBeans = new ArrayList<TabBean>();
@@ -74,47 +74,46 @@
attributes.setAttribute("bypassUpdates", null);
attributes.get("bypassUpdates").setType(Boolean.class);
}
-
+
public void createNewTab() {
-
+
UITab tab = new UITab();
int index = tabs.size() + 6; // there is already 5 tabs
-
+
tab.setHeader("tab" + index + " header");
tab.setId("tab" + index);
tab.setName("tab" + index);
tab.setRender("tab" + index);
-
+
tabs.add(tab);
}
-
+
public void generateNewTab() {
-
+
System.out.println(" ###### adding new tabBean... ");
-
+
int i = tabBeans.size();
String idBase = "tab" + (i + 6); // there is already 5 tabs
- tabBeans.add(new TabBean(idBase, idBase, idBase + " header",
- "Content of dynamicaly created " + idBase));
-
+ tabBeans.add(new TabBean(idBase, idBase, idBase + " header",
"Content of dynamicaly created " + idBase));
+
System.out.println(" Now is tabBeans list " + tabBeans.size() + "
long");
}
-
+
public void removeTab() throws Exception {
// setActiveTabId("TAB1");
-
- String tabIdToRemove = FacesContext.getCurrentInstance().getExternalContext()
- .getRequestParameterMap().get("removeTabId");
-
+
+ String tabIdToRemove =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()
+ .get("removeTabId");
+
TabBean currentTab = getTabById(tabIdToRemove);
-
+
if (currentTab != null) {
tabBeans.remove(currentTab);
} else {
throw new Exception("Tab Id parameter is null");
}
}
-
+
private TabBean getTabById(String tabId) {
System.out.println(" #tabId to remove: '" + tabId +
"'");
for (TabBean currentTab : tabBeans) {
@@ -140,21 +139,20 @@
public void setTabs(List<UITab> tabs) {
this.tabs = tabs;
}
-
+
public class TabBean {
private String tabId;
private String tabName;
private String tabHeader;
private String tabContentText;
private boolean closable;
-
- public TabBean(String tabId, String tabName, String tabHeader,
- String tabContentText){
+
+ public TabBean(String tabId, String tabName, String tabHeader, String
tabContentText) {
this.tabId = tabId;
this.tabName = tabName;
this.tabHeader = tabHeader;
this.tabContentText = tabContentText;
-
+
// default is closable
this.closable = true;
}
@@ -198,7 +196,7 @@
public void setClosable(boolean closable) {
this.closable = closable;
}
-
+
}
public List<TabBean> getTabBeans() {
@@ -208,4 +206,28 @@
public void setTabBeans(List<TabBean> tabBeans) {
this.tabBeans = tabBeans;
}
+
+ public List<String> getTestListA() {
+ logger.info("getTestListA");
+
+ List<String> listA = new ArrayList<String>(4);
+ listA.add("Hyundai i30");
+ listA.add("Renault Megane");
+ listA.add("Renault Clio");
+ listA.add("Toyota Auris");
+
+ return listA;
+ }
+
+ public List<String> getTestListB() {
+ logger.info("getTestListB");
+
+ List<String> listB = new ArrayList<String>(4);
+ listB.add("pineapple");
+ listB.add("banana");
+ listB.add("strawberry");
+ listB.add("blueberry");
+
+ return listB;
+ }
}
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/lazyLoading.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/lazyLoading.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/lazyLoading.xhtml 2011-12-08
13:02:30 UTC (rev 23062)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:rich="http://richfaces.org/rich">
+
+<!--
+JBoss, Home of Professional Open Source
+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.
+
+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.
+ -->
+
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="view">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:tabPanel id="tabpanel" switchType="ajax"
activeItem="#{richTabPanelBean.attributes['activeItem'].value}">
+
+ <rich:tab id="tab1" header="Tab 1">
+ Here is tab #1
+ </rich:tab>
+
+ <rich:tab id="tab2" header="Tab 2">
+ <rich:dataTable value="#{richTabPanelBean.testListA}"
var="item" rows="10">
+ <rich:column>
+ <f:facet name="header">
+ List A
+ </f:facet>
+ <h:outputText value="#{item}" />
+ </rich:column>
+ </rich:dataTable>
+ </rich:tab>
+ <rich:tab id="tab3" header="Tab 3">
+ <rich:dataTable value="#{richTabPanelBean.testListB}"
var="item" rows="10">
+ <rich:column>
+ <f:facet name="header">
+ List B
+ </f:facet>
+ <h:outputText value="#{item}" />
+ </rich:column>
+ </rich:dataTable>
+ </rich:tab>
+ </rich:tabPanel>
+
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/list.xhtml 2011-12-08
11:13:40 UTC (rev 23061)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richTabPanel/list.xhtml 2011-12-08
13:02:30 UTC (rev 23062)
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!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:ui="http://java.sun.com/jsf/facelets"
-
xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:h="http://java.sun.com/jsf/html">
- <!--
+<!--
JBoss, Home of Professional Open Source
Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
@@ -25,26 +26,31 @@
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-->
- <ui:composition template="/templates/list.xhtml">
+<ui:composition template="/templates/list.xhtml">
- <ui:define name="pageTitle">Rich Tab Panel</ui:define>
+ <ui:define name="pageTitle">Rich Tab Panel</ui:define>
- <ui:define name="links">
+ <ui:define name="links">
- <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
+ <metamer:testPageLink id="simple" outcome="simple"
value="Simple">
Simple page containing <b>rich:tabPanel</b> and input boxes
for all its attributes.
</metamer:testPageLink>
-
- <metamer:testPageLink id="addTab" outcome="addTab"
value="Add tab v1">
- Simple page containing <b>rich:tabPanel</b> and buttons for
create new tabs using binding
+
+ <metamer:testPageLink id="addTab" outcome="addTab"
value="Add Tab v1">
+ Simple page containing <b>rich:tabPanel</b> and buttons for
creating new tabs using binding.
</metamer:testPageLink>
-
- <metamer:testPageLink id="addTab2" outcome="addTab2"
value="Add tab v2">
- Simple page containing <b>rich:tabPanel</b> and buttons for
create new tabs
+
+ <metamer:testPageLink id="addTab2" outcome="addTab2"
value="Add Tab v2">
+ Simple page containing <b>rich:tabPanel</b> and buttons for
creating new tabs.
</metamer:testPageLink>
- </ui:define>
+ <metamer:testPageLink id="lazyLoading"
outcome="lazyLoading" value="Lazy Loading">
+ Simple page containing <b>rich:tabPanel</b> demonstrating
that ajax-switching tabs causes all tabs to load
+ (<h:outputLink id="jiraRF11782"
value="https://issues.jboss.org/browse/RF-11782">RF-11782<...>).
+ </metamer:testPageLink>
- </ui:composition>
+ </ui:define>
+</ui:composition>
+
</html>