Author: Alex.Kolonitsky
Date: 2010-09-03 08:51:59 -0400 (Fri, 03 Sep 2010)
New Revision: 19110
Added:
branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml
branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java
Removed:
branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml
branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties
branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml
Modified:
branches/RF-7944/examples/core-demo/pom.xml
branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java
branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml
branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml
branches/RF-7944/examples/input-demo/pom.xml
branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml
branches/RF-7944/examples/iteration-demo/pom.xml
branches/RF-7944/examples/misc-demo/pom.xml
branches/RF-7944/examples/output-demo/pom.xml
branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java
branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml
branches/RF-7944/examples/repeater-demo/pom.xml
branches/RF-7944/examples/richfaces-showcase/pom.xml
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml
branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml
branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
branches/RF-7944/ui/parent/pom.xml
Log:
merge from trunk
Modified: branches/RF-7944/examples/core-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/core-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -39,22 +39,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -87,14 +71,6 @@
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
</dependencies>
<build>
Modified:
branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java
===================================================================
---
branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/core-demo/src/main/java/org/richfaces/demo/PhaseTracker.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -27,8 +27,8 @@
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
@@ -38,7 +38,7 @@
private static final long serialVersionUID = 6358081870120864332L;
- private Logger logger = LoggerFactory.getLogger(PhaseTracker.class);
+ private Logger logger = LogFactory.getLogger(PhaseTracker.class);
private ThreadLocal<Long> phaseTimer = new ThreadLocal<Long>();
Deleted: branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml
===================================================================
--- branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml 2010-09-03 12:00:31
UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/src/main/resources/log4j.xml 2010-09-03 12:51:59
UTC (rev 19110)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="console"
class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%c] %m%n"
/>
- </layout>
- </appender>
- <logger name="org.richfaces">
- <level value="info" />
- </logger>
- <logger name="org.richfaces.demo.PhaseTracker">
- <level value="debug" />
- </logger>
- <root>
- <priority value="info" />
- <appender-ref ref="console" />
- </root>
-
-</log4j:configuration>
\ No newline at end of file
Modified: branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml
===================================================================
--- branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml 2010-09-03 12:00:31 UTC
(rev 19109)
+++ branches/RF-7944/examples/core-demo/src/main/webapp/ajax.xhtml 2010-09-03 12:51:59 UTC
(rev 19110)
@@ -88,7 +88,7 @@
<a:ajax bypassUpdates="true" />
</h:commandLink>
- bypassUpdates="#{true}"
+ bypassUpdates="#{'#'}{true}"
<h:inputText>
<a:ajax bypassUpdates="#{true}" event="keyup" />
</h:inputText>
Modified: branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml
===================================================================
--- branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml 2010-09-03 12:00:31
UTC (rev 19109)
+++ branches/RF-7944/examples/core-demo/src/main/webapp/button.xhtml 2010-09-03 12:51:59
UTC (rev 19110)
@@ -23,11 +23,28 @@
<f:ajax event="action" execute="@form"
render=":out" listener="#{commandBean.listener}" />
</a4j:commandButton>
</h:form>
- <br />
+ <br />
<h:panelGroup id="out">
<h:outputText value="#{commandBean.name}" />
<h:outputText value="!" rendered="#{not empty
commandBean.name}" />
</h:panelGroup>
+ <br /><hr />
+ RF-9146: request grouping id not set:
+ <br />
+ <h:panelGroup id="out1">
+ <h:outputText value="#{commandBean.name}" />
+ </h:panelGroup>
+ <h:form>
+ <a4j:queue requestDelay="5000"/>
+ <a4j:commandButton value="Update 1" render="out1">
+ <a4j:param name="v1" value="Update 1"
assignTo="#{commandBean.name}" />
+ </a4j:commandButton>
+ <a4j:commandButton value="Update 2" render="out1">
+ <a4j:param name="v1" value="Update 2"
assignTo="#{commandBean.name}" />
+ </a4j:commandButton>
+ <hr />
+ <a4j:log level="debug" style="border: solid red 1px"
styleClass="log" mode="popup" />
+ </h:form>
</h:body>
</f:view>
</html>
\ No newline at end of file
Modified: branches/RF-7944/examples/input-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/input-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/input-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -83,8 +83,8 @@
<configuration>
<webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
<classifier>jee6</classifier>
-
<packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</packagingExcludes>
-
<warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</warSourceExcludes>
+
<packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</packagingExcludes>
+
<warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</warSourceExcludes>
</configuration>
</execution>
</executions>
@@ -131,38 +131,12 @@
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
-
<!-- Tests -->
<dependency>
<groupId>org.testng</groupId>
Modified:
branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java
===================================================================
---
branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/input-demo/src/main/java/org/richfaces/demo/AutoCompleteBean.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -22,6 +22,7 @@
package org.richfaces.demo;
import java.io.Serializable;
+import java.util.Arrays;
import java.util.Locale;
import javax.faces.bean.ManagedBean;
@@ -30,6 +31,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.richfaces.component.UIAutocomplete;
+
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
@@ -60,7 +63,17 @@
return input.getName().toLowerCase(Locale.US).startsWith(countryNamePrefix);
}
}
+
+ private String mode = "lazyClient";
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
@ManagedProperty(value = "#{countriesBean}")
private CountriesBean countriesBean;
@@ -69,7 +82,13 @@
}
public Object autocomplete(FacesContext facesContext, UIComponent component, String
value) {
- return Collections2.filter(countriesBean.getCountries(), new
CountryNamePredicate(value));
+ // for tests when value does not starts with prefix
+ /*String str = value;
+ 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()));
}
}
Modified: branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml
===================================================================
--- branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-03
12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/input-demo/src/main/webapp/autocomplete.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -13,11 +13,17 @@
<h:body style="margin: 30px;">
<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"/>
+ </h:selectOneMenu>
<div style="height: 300px; width: 300px; overflow: auto;">Text
block text block text block text block text block text block text
block text block
- <input:autocomplete autocompleteMethod="#{autoCompleteBean.autocomplete}"
var="country" fetchValue="#{country.name}">
+ <input:autocomplete clientFilter="if(subString.length>1)
if(value.indexOf(subString)!=-1) return true;"
mode="#{autoCompleteBean.mode}" minChars="2"
autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country"
fetchValue="#{country.name}" showButton="true">
#{country.name} #{country.iso} #{country.domain}
</input:autocomplete>
Modified: branches/RF-7944/examples/iteration-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/iteration-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/iteration-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -39,22 +39,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -71,14 +55,6 @@
<groupId>org.richfaces.ui.misc</groupId>
<artifactId>richfaces-ui-misc-ui</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
<!-- API implementation for runtime -->
Modified: branches/RF-7944/examples/misc-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/misc-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/misc-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -39,22 +39,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -96,15 +80,6 @@
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
<profiles>
Modified: branches/RF-7944/examples/output-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/output-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/output-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -87,8 +87,8 @@
<configuration>
<webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
<classifier>jee6</classifier>
-
<packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</packagingExcludes>
-
<warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/slf4j-*</warSourceExcludes>
+
<packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</packagingExcludes>
+
<warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</warSourceExcludes>
</configuration>
</execution>
</executions>
@@ -135,38 +135,12 @@
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
-
<!-- Tests -->
<dependency>
<groupId>org.testng</groupId>
Modified:
branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java
===================================================================
---
branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/output-demo/src/main/java/org/richfaces/TogglePanelBean.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,15 +1,15 @@
package org.richfaces;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-
import java.io.Serializable;
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
+
public class TogglePanelBean implements Serializable {
private static final long serialVersionUID = -2403138958014741653L;
- private static final Logger LOGGER = LoggerFactory.getLogger(TogglePanelBean.class);
+ private static final Logger LOGGER = LogFactory.getLogger(TogglePanelBean.class);
private String name;
Modified: branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -34,6 +34,10 @@
<from-outcome>accordion</from-outcome>
<to-view-id>/examples/accordion.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>collapsiblePanel</from-outcome>
+ <to-view-id>/examples/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
<!-- QUnit -->
<navigation-case>
@@ -52,5 +56,9 @@
<from-outcome>qunit/accordionHeaders</from-outcome>
<to-view-id>/qunit/accordionHeaders.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>qunit/collapsiblePanel</from-outcome>
+ <to-view-id>/qunit/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Copied:
branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
(from rev 19108,
trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml)
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
(rev 0)
+++
branches/RF-7944/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,35 @@
+<!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">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel
QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified:
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml
===================================================================
---
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/accordionHeaders.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -26,22 +26,43 @@
<pn:accordionItem header="label 1">
<f:facet name="headerInactive">headerInactive
1</f:facet>
<f:facet name="headerActive">headerActive
1</f:facet>
- <f:facet name="headerDisable">headerDisable
1</f:facet>
+ <f:facet name="header">headerDisable
1</f:facet>
content 1
</pn:accordionItem>
<pn:accordionItem header="label 2"
disabled="true">
<f:facet name="headerInactive">headerInactive
2</f:facet>
- <f:facet name="headerActive">headerActive
2</f:facet>
+ <f:facet name="header">headerActive
2</f:facet>
<f:facet name="headerDisable">headerDisable
2</f:facet>
content 2
</pn:accordionItem>
<pn:accordionItem header="label 3">
- <f:facet name="headerInactive">headerInactive
3</f:facet>
+ <f:facet name="header">headerInactive
3</f:facet>
<f:facet name="headerActive">headerActive
3</f:facet>
<f:facet name="headerDisable">headerDisable
3</f:facet>
content 3
</pn:accordionItem>
</pn:accordion>
+
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@first" event="click"/>
+ |< first
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@prev" event="click"/>
+ <- prev
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@next" event="click"/>
+ next ->
+ </h:outputLink>
+ |
+ <h:outputLink>
+ <pn:toggleControl targetPanel="panel"
targetItem="@last" event="click"/>
+ last >|
+ </h:outputLink>
+
</h:form>
<p>Result</p>
Copied: branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
(from rev 19108, trunk/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml)
===================================================================
--- branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml
(rev 0)
+++
branches/RF-7944/examples/output-demo/src/main/webapp/qunit/collapsiblePanel.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,51 @@
+<!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="scripts">
+ <h:outputScript name="qunit/qunit.js" />
+ <h:outputScript name="qunit/richfaces-qunit.js" />
+
+ <h:outputStylesheet name="qunit/qunit.css" />
+ </ui:define>
+
+ <ui:define name="title">Collapsible Panel QUnit</ui:define>
+ <ui:define name="body_head">Collapsible Panel
QUnit</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f">
+ <pn:collapsiblePanel id="panel"
switchType="client">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello!!!
+
+ </pn:collapsiblePanel>
+
+ </h:form>
+
+ <p>Result</p>
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid
#a0a0a0">Main Test Div</div>
+
+ </div>
+ <h:outputScript name="tests/richfaces-collapsible-panel-qunit.js"
/>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified:
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js
===================================================================
---
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-headers-qunit.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -25,6 +25,34 @@
var ACCORDION_ID = "f:panel";
+ function testFirst(items) {
+ ok(items[0].__header("act").is(":visible"), "1 item:
active visible");
+ ok(!items[0].__header("inact").is(":visible"), "1 item:
inactive unvisible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item:
disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item:
active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item:
inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item:
disabled unvisible");
+
+ ok(!items[2].__header("act").is(":visible"), "3 item:
active unvisible");
+ ok(items[2].__header("inact").is(":visible"), "3 item:
inactive visible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item:
disabled unvisible");
+ }
+
+ function testLast(items) {
+ ok(!items[0].__header("act").is(":visible"), "1 item:
active unvisible");
+ ok(items[0].__header("inact").is(":visible"), "1 item:
inactive visible");
+ ok(!items[0].__header("dis").is(":visible"), "1 item:
disabled unvisible");
+
+ ok(!items[1].__header("act").is(":visible"), "2 item:
active visible");
+ ok(!items[1].__header("inact").is(":visible"), "2 item:
inactive unvisible");
+ ok(items[1].__header("dis").is(":visible"), "2 item:
disabled unvisible");
+
+ ok(items[2].__header("act").is(":visible"), "3 item:
active visible");
+ ok(!items[2].__header("inact").is(":visible"), "3 item:
inactive unvisible");
+ ok(!items[2].__header("dis").is(":visible"), "3 item:
disabled unvisible");
+ }
+
test("RichFaces.ui.Accordion change headers", function () {
var c = RichFaces.$(ACCORDION_ID);
@@ -34,31 +62,38 @@
equals(c.getItems().length, 3, "getItems().length");
var items = c.getItems();
- ok( items[0].__header("active" ).is(":visible"), "1
item: active visible");
- ok(!items[0].__header("inactive").is(":visible"), "1
item: inactive unvisible");
- ok(!items[0].__header("disable" ).is(":visible"), "1
item: disabled unvisible");
+ testFirst(items);
- ok(!items[1].__header("active" ).is(":visible"), "2
item: active unvisible");
- ok(!items[1].__header("inactive").is(":visible"), "2
item: inactive unvisible");
- ok( items[1].__header("disable" ).is(":visible"), "2
item: disabled visible");
+ c.switchToItem(items[2].getName());
+ testLast(items);
- ok(!items[2].__header("active" ).is(":visible"), "3
item: active unvisible");
- ok( items[2].__header("inactive").is(":visible"), "3
item: inactive visible");
- ok(!items[2].__header("disable" ).is(":visible"), "3
item: disabled unvisible");
+ c.switchToItem("@first");
+ testFirst(items);
- c.switchToItem(items[2].getName());
- ok(!items[0].__header("active" ).is(":visible"), "1
item: active unvisible");
- ok( items[0].__header("inactive").is(":visible"), "1
item: inactive visible");
- ok(!items[0].__header("disable" ).is(":visible"), "1
item: disabled unvisible");
+ c.switchToItem("@last");
+ testLast(items);
- ok(!items[1].__header("active" ).is(":visible"), "2
item: active unvisible");
- ok(!items[1].__header("inactive").is(":visible"), "2
item: inactive unvisible");
- ok( items[1].__header("disable" ).is(":visible"), "2
item: disabled visible");
+ c.switchToItem("@prev");
+ testFirst(items);
- ok( items[2].__header("active" ).is(":visible"), "3
item: active visible");
- ok(!items[2].__header("inactive").is(":visible"), "3
item: inactive unvisible");
- ok(!items[2].__header("disable" ).is(":visible"), "3
item: disabled unvisible");
+ c.switchToItem("@next");
+ testLast(items);
+ });
+ test("RichFaces.ui.Accordion change disabled headers", function () {
+ var c = RichFaces.$(ACCORDION_ID);
+
+ ok(c instanceof RichFaces.ui.Accordion, "inctance of
RichFaces.ui.Accordion");
+ equals(c.id, ACCORDION_ID, "id");
+
+ equals(c.getItems().length, 3, "getItems().length");
+
+ var items = c.getItems();
+
c.switchToItem(items[0].getName());
+ testFirst(items);
+
+ c.switchToItem(items[1].getName());
+ testFirst(items);
});
});
Copied:
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
(from rev 19108,
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js)
===================================================================
---
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js
(rev 0)
+++
branches/RF-7944/examples/output-demo/src/main/webapp/resources/tests/richfaces-collapsible-panel-qunit.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-collapsible-panel");
+
+ var COLLAPSIBLE_PANEL_ID = "f:panel";
+
+ function handler (msg, returnValue) {
+ return function () {
+ ok(true, msg);
+
+ if (returnValue != undefined) {
+ return returnValue;
+ }
+ };
+ }
+
+ test("RichFaces.ui.CollapsiblePanel test constructor", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ ok(c instanceof RichFaces.ui.CollapsiblePanel, "inctance of
RichFaces.ui.CollapsiblePanel");
+ equals(c.id, COLLAPSIBLE_PANEL_ID, "id");
+ // TODO other params
+
+ });
+
+ test("RichFaces.ui.CollapsiblePanel test public api", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ var PUBLIC_API = ["switchPanel"];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + " present in component");
+ equals(typeof c[funcName], "function", funcName + "is
function");
+ }
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events", function () {
+ var componentId = COLLAPSIBLE_PANEL_ID;
+ var c = RichFaces.$(componentId);
+
+ expect(4);
+
+ var beforeswitchHandler = function (event, comp, data) {
+ ok(true, "beforeswitch handler invouked");
+
+ same(data.id, componentId, "component id");
+ same(data.isExpanded, "false", "panel collapsed");
+
+ return true;
+ };
+
+ var beforeswitchHandlerWrapper = RichFaces.Event.bindById(componentId,
"beforeswitch", beforeswitchHandler);
+
+ var switchHandler = handler("switch handler invouked", undefined);
+ var switchHandlerWrapper = RichFaces.Event.bindById(componentId,
"switch", switchHandler);
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(componentId, "beforeswitch",
beforeswitchHandlerWrapper);
+ RichFaces.Event.unbindById(componentId, "switch",
switchHandlerWrapper);
+
+ c.switchPanel();
+ });
+
+ test("RichFaces.ui.CollapsiblePanel.Events test cancelable", function () {
+ var c = RichFaces.$(COLLAPSIBLE_PANEL_ID);
+
+ expect(2);
+ var beforeswitch1 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID,
"beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return false;
+ });
+
+ var beforeswitch2 = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID,
"beforeswitch", function () {
+ ok(true, "beforeswitch handler invouked");
+
+ return true;
+ });
+
+ var switchHandler = RichFaces.Event.bindById(COLLAPSIBLE_PANEL_ID,
"switch", function () {
+ ok(false, "switch handler should't been invouked");
+ });
+
+ c.switchPanel();
+
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch",
beforeswitch1);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "beforeswitch",
beforeswitch2);
+ RichFaces.Event.unbindById(COLLAPSIBLE_PANEL_ID, "switch",
switchHandler);
+
+ c.switchPanel();
+ });
+});
Modified: branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
---
branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -11,9 +11,161 @@
<meta http-equiv="content-type" content="text/xhtml;
charset=UTF-8" />
+ <style type="text/css">
+ * {
+ font-family: verdana
+ }
+
+ .rftp_toptab {
+ display: table-cell;
+ border: 1px solid #A6A6A6;
+ padding: 0px 0px 3px 0px;
+ vertical-align: bottom;
+ background: url(tab_bg.gif) top repeat-x #DAE7F5;
+ }
+
+ .rftp_active_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ }
+
+ .rftp_active2_top {
+ border-bottom: 0px;
+ font-weight: bold;
+ padding: 3px 0px 0px 0px;
+ vertical-align: top;
+ background: url(acttab2_bg.gif) top repeat-x #FFFFFF;
+ }
+
+ .rftp_toptab_tabline_vis {
+ border: 1px solid #a6a6a6;
+ background: url(tabline_bg.gif) top repeat-x #EEF4FB;
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 23px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabline_dis {
+ border-bottom: 0px;
+ padding-top: 2px;
+ overflow: hidden;
+ height: 25px;
+ white-space: nowrap;
+ position: relative;
+ }
+
+ .rftp_toptab_tabs {
+ display: table;
+ border: 0px;
+ width: 100%;
+ height: 100%;
+ }
+
+ .rftp_toptab_spacer {
+ display: table-cell;
+ border-bottom: 1px solid #A6A6A6;
+ }
+
+ .rftp_horizonttab_tabspacer_width {
+ padding-left: 1px;
+ }
+
+ .rftp_icon {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 5px 0px 5px;
+ }
+
+ .rftp_close {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0px 3px 0px 15px;
+ }
+
+ .rftp_label {
+ display: table-cell;
+ vertical-align: middle;
+ font-family: verdana;
+ font-size: 11px;
+ }
+
+ .rftp_toptab_scroll_left {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ left: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_scroll_right {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 17px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 11px;
+ padding-top: 6px;
+ }
+
+ .rftp_toptab_tabslist {
+ background: url(acttab_bg.gif) top repeat-x #C9DBEF;
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ width: 15px;
+ height: 250px;
+ border: 1px solid #a6a6a6;
+ font-weight: bold;
+ text-align: center;
+ font-family: verdana;
+ font-size: 14px;
+ padding-top: 2px;
+ }
+
+ .rftp_toptab_border {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ height: 2px;
+ background: #C9DBEF;
+ }
+
+ .rftp_toptab_content {
+ border: 1px solid #A6A6A6;
+ border-top: 0px;
+ font-family: verdana;
+ font-size: 11px;
+ padding: 10px;
+ background: #ffffff;
+ }
+
+ .rftp_hidden {
+ display: none
+ }
+ </style>
+
</h:head>
<h:body>
+
+
<ui:insert name="scripts" ></ui:insert>
<table width="100%">
<thead>
@@ -46,6 +198,12 @@
<li><h:commandLink
value="accordion" action="accordion" /></li>
</ul>
</li>
+ <li>
+ <p>Collapsible Panel</p>
+ <ul>
+ <li><h:commandLink value="Collapsible
Panel" action="collapsiblePanel" /></li>
+ </ul>
+ </li>
</ul>
<p>QUnit</p>
<ul>
@@ -53,6 +211,7 @@
<li><h:commandLink value="togglePanelItem"
action="qunit/togglePanelItem" /></li>
<li><h:commandLink value="accordion"
action="qunit/accordion" /></li>
<li><h:commandLink
value="accordionHeaders" action="qunit/accordionHeaders"
/></li>
+ <li><h:commandLink
value="collapsiblePanel" action="qunit/collapsiblePanel"
/></li>
</ul>
</h:form>
</td>
Modified: branches/RF-7944/examples/repeater-demo/pom.xml
===================================================================
--- branches/RF-7944/examples/repeater-demo/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/repeater-demo/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -40,22 +40,6 @@
<dependencyManagement>
<dependencies>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
</dependencyManagement>
Modified: branches/RF-7944/examples/richfaces-showcase/pom.xml
===================================================================
--- branches/RF-7944/examples/richfaces-showcase/pom.xml 2010-09-03 12:00:31 UTC (rev
19109)
+++ branches/RF-7944/examples/richfaces-showcase/pom.xml 2010-09-03 12:51:59 UTC (rev
19110)
@@ -54,22 +54,6 @@
<artifactId>ehcache</artifactId>
</dependency>
- <!--
- simple logger binding: only messages of level INFO and
- higher are printed
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
- </dependency>
-
- <!-- Log4J dependency used in examples -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
<build>
Deleted: branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties
===================================================================
---
branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.properties 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,24 +0,0 @@
-# A default log4j configuration for log4j users.
-#
-# To use this configuration, deploy it into your application's WEB-INF/classes
-# directory. You are also encouraged to edit it as you like.
-
-# Configure the console as our one appender
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n
-
-# tighten logging on the DataNucleus Categories
-log4j.category.DataNucleus.JDO=WARN, A1
-log4j.category.DataNucleus.Persistence=WARN, A1
-log4j.category.DataNucleus.Cache=WARN, A1
-log4j.category.DataNucleus.MetaData=WARN, A1
-log4j.category.DataNucleus.General=WARN, A1
-log4j.category.DataNucleus.Utility=WARN, A1
-log4j.category.DataNucleus.Transaction=WARN, A1
-log4j.category.DataNucleus.Datastore=WARN, A1
-log4j.category.DataNucleus.ClassLoading=WARN, A1
-log4j.category.DataNucleus.Plugin=WARN, A1
-log4j.category.DataNucleus.ValueGeneration=WARN, A1
-log4j.category.DataNucleus.Enhancer=WARN, A1
-log4j.category.DataNucleus.SchemaTool=WARN, A1
Deleted: branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml
===================================================================
--- branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++ branches/RF-7944/examples/richfaces-showcase/src/main/resources/log4j.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="console"
class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%c] %m%n"
/>
- </layout>
- </appender>
- <root>
- <priority value="info" />
- <appender-ref ref="console" />
- </root>
-
-</log4j:configuration>
\ No newline at end of file
Modified:
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
===================================================================
---
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -9,7 +9,7 @@
.rf-ac{
width: 500px;
}
-.rf-aci-c {
+.rf-ac-itm-c {
height: 220px;
}
</style>
Modified:
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml
===================================================================
---
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/examples/richfaces-showcase/src/main/webapp/richfaces/togglePanel/samples/simple-sample.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -6,7 +6,7 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style>
-.rf-tgp-i {
+.rf-tgp-itm {
border: 1px solid #{richSkin.panelBorderColor};
padding:5px;
}
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event (from rev 19108,
trunk/ui/common/ui/src/main/java/org/richfaces/event)
Deleted:
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
===================================================================
---
trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03
08:56:24 UTC (rev 19108)
+++
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,197 +0,0 @@
-/*
- * 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.
- */
-
-package org.richfaces.event;
-
-import javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.MethodExpression;
-import javax.el.MethodNotFoundException;
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * <p><strong><span
- *
class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
- * is a {@link FacesListener} that wraps a {@link
- * MethodExpression}. When it receives a {@link FacesEvent}, it
- * executes a method on an object identified by the {@link
- * MethodExpression}.</p>
- *
- * @author akolonitsky
- * @version 1.0
- *
- */
-public abstract class MethodExpressionEventListener implements FacesListener, StateHolder
{
-
- private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
-
- private static final Object[] NO_PARAMS = new Object[0];
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
- protected MethodExpressionEventListener() {
- }
-
- /**
- * <p><span class="changed_modified_2_0">Construct</span>
a {@link
- * FacesListener} that contains a {@link
- * MethodExpression}.<span
- * class="changed_added_2_0">To accomodate method expression targets
- * that take no arguments instead of taking a {@link
- * FacesEvent} argument</span>, the implementation of this
- * class must take the argument <code>methodExpressionOneArg</code>,
- * extract its expression string, and create another
- * <code>MethodExpression</code> whose expected param types match
- * those of a zero argument method. The usage requirements for both
- * of these <code>MethodExpression</code> instances are described in
- * {@link #processEvent}.</span></p>
- *
- * @param methodExpressionOneArg a <code>MethodExpression</code>
- * that points to a method that returns <code>void</code> and takes
- * a single argument of type {@link FacesEvent}.
- */
- protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- this.methodExpressionZeroArg =
context.getApplication().getExpressionFactory().createMethodExpression(
- elContext, methodExpressionOneArg.getExpressionString(), Void.class,
EVENT_LISTENER_ZERO_ARG_SIG);
- }
-
- /**
- * <p>Construct a {@link FacesListener} that contains a {@link
MethodExpression}.</p>
- *
- * @param methodExprOneArg
- * @param methodExprZeroArg
- */
- protected MethodExpressionEventListener(MethodExpression methodExprOneArg,
MethodExpression methodExprZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExprOneArg;
- this.methodExpressionZeroArg = methodExprZeroArg;
- }
-
- // ------------------------------------------------------- Event Method
-
- /**
- * <p><span class="changed_modified_2_0">Call</span>
through to the
- * {@link MethodExpression} passed in our constructor. <span
- * class="changed_added_2_0">First, try to invoke the
- * <code>MethodExpression</code> passed to the constructor of this
- * instance, passing the argument {@link FacesEvent} as the
- * argument. If a {@link MethodNotFoundException} is thrown, call
- * to the zero argument <code>MethodExpression</code> derived from
- * the <code>MethodExpression</code> passed to the constructor of
- * this instance. If that fails for any reason, throw an {@link
- * AbortProcessingException}, including the cause of the
- * failure.</span></p>
- *
- * @throws NullPointerException {@inheritDoc}
- * @throws AbortProcessingException {@inheritDoc}
- */
- public void processEvent(FacesEvent event) throws AbortProcessingException {
-
- if (event == null) {
- throw new NullPointerException();
- }
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- // PENDING: The corresponding code in MethodExpressionActionListener
- // has an elaborate message capture, logging, and rethrowing block.
- // Why not here?
- try {
- methodExpressionOneArg.invoke(elContext, new Object[] {event});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
-
-
- // ------------------------------------------------ Methods from StateHolder
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be saved.</p>
- */
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- return new Object[] {
- UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
- UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
- };
- }
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be restored.</p>
- */
- public void restoreState(FacesContext context, Object state) {
-
- if (context == null) {
- throw new NullPointerException();
- }
- if (state == null) {
- return;
- }
-
- methodExpressionOneArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[0]);
- methodExpressionZeroArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[1]);
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
-}
Copied:
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
(from rev 19108,
trunk/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java)
===================================================================
---
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java
(rev 0)
+++
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/event/MethodExpressionEventListener.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,197 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.event;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodNotFoundException;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p><strong><span
+ *
class="changed_modified_2_0">MethodExpressionEventListener</span></strong>
+ * is a {@link FacesListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link FacesEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public abstract class MethodExpressionEventListener implements FacesListener, StateHolder
{
+
+ private static final Class<?>[] EVENT_LISTENER_ZERO_ARG_SIG = new Class[] { };
+
+ private static final Object[] NO_PARAMS = new Object[0];
+
+ // ------------------------------------------------------ Instance Variables
+
+ private MethodExpression methodExpressionOneArg = null;
+ private MethodExpression methodExpressionZeroArg = null;
+
+ private boolean isTransient;
+
+ protected MethodExpressionEventListener() {
+ }
+
+ /**
+ * <p><span class="changed_modified_2_0">Construct</span>
a {@link
+ * FacesListener} that contains a {@link
+ * MethodExpression}.<span
+ * class="changed_added_2_0">To accomodate method expression targets
+ * that take no arguments instead of taking a {@link
+ * FacesEvent} argument</span>, the implementation of this
+ * class must take the argument <code>methodExpressionOneArg</code>,
+ * extract its expression string, and create another
+ * <code>MethodExpression</code> whose expected param types match
+ * those of a zero argument method. The usage requirements for both
+ * of these <code>MethodExpression</code> instances are described in
+ * {@link #processEvent}.</span></p>
+ *
+ * @param methodExpressionOneArg a <code>MethodExpression</code>
+ * that points to a method that returns <code>void</code> and takes
+ * a single argument of type {@link FacesEvent}.
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExpressionOneArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ this.methodExpressionZeroArg =
context.getApplication().getExpressionFactory().createMethodExpression(
+ elContext, methodExpressionOneArg.getExpressionString(), Void.class,
EVENT_LISTENER_ZERO_ARG_SIG);
+ }
+
+ /**
+ * <p>Construct a {@link FacesListener} that contains a {@link
MethodExpression}.</p>
+ *
+ * @param methodExprOneArg
+ * @param methodExprZeroArg
+ */
+ protected MethodExpressionEventListener(MethodExpression methodExprOneArg,
MethodExpression methodExprZeroArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExprOneArg;
+ this.methodExpressionZeroArg = methodExprZeroArg;
+ }
+
+ // ------------------------------------------------------- Event Method
+
+ /**
+ * <p><span class="changed_modified_2_0">Call</span>
through to the
+ * {@link MethodExpression} passed in our constructor. <span
+ * class="changed_added_2_0">First, try to invoke the
+ * <code>MethodExpression</code> passed to the constructor of this
+ * instance, passing the argument {@link FacesEvent} as the
+ * argument. If a {@link MethodNotFoundException} is thrown, call
+ * to the zero argument <code>MethodExpression</code> derived from
+ * the <code>MethodExpression</code> passed to the constructor of
+ * this instance. If that fails for any reason, throw an {@link
+ * AbortProcessingException}, including the cause of the
+ * failure.</span></p>
+ *
+ * @throws NullPointerException {@inheritDoc}
+ * @throws AbortProcessingException {@inheritDoc}
+ */
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ if (event == null) {
+ throw new NullPointerException();
+ }
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ // PENDING: The corresponding code in MethodExpressionActionListener
+ // has an elaborate message capture, logging, and rethrowing block.
+ // Why not here?
+ try {
+ methodExpressionOneArg.invoke(elContext, new Object[] {event});
+ } catch (MethodNotFoundException mnf) {
+ if (null != methodExpressionZeroArg) {
+
+ try {
+ // try to invoke a no-arg version
+ methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+
+
+ // ------------------------------------------------ Methods from StateHolder
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be saved.</p>
+ */
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return new Object[] {
+ UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
+ UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
+ };
+ }
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be restored.</p>
+ */
+ public void restoreState(FacesContext context, Object state) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ if (state == null) {
+ return;
+ }
+
+ methodExpressionOneArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[0]);
+ methodExpressionZeroArg = (MethodExpression) UIComponentBase
+ .restoreAttachedState(context, ((Object[]) state)[1]);
+ }
+
+
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ isTransient = newTransientValue;
+ }
+}
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view (from rev 19108,
trunk/ui/common/ui/src/main/java/org/richfaces/view)
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets (from rev
19108, trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets)
Copied: branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html (from
rev 19108, trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html)
Deleted:
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
===================================================================
---
trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03
08:56:24 UTC (rev 19108)
+++
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,145 +0,0 @@
-/**
- * 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.view.facelets.html;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.view.EditableValueHolderAttachedObjectHandler;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
-import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagException;
-import javax.faces.view.facelets.TagHandler;
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * @author akolonitsky
- * @since Aug 31, 2010
- */
-public abstract class EventListenerHandler extends TagHandler implements
EditableValueHolderAttachedObjectHandler {
-
- protected final TagAttribute binding;
-
- protected final String listenerType;
-
- public abstract static class LazyEventListener<L extends FacesListener>
implements FacesListener, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- protected final String type;
-
- protected final ValueExpression binding;
-
- protected LazyEventListener(String type, ValueExpression binding) {
- this.type = type;
- this.binding = binding;
- }
-
- public void processEvent(FacesEvent event) throws AbortProcessingException {
-
- FacesContext faces = FacesContext.getCurrentInstance();
- if (faces == null) {
- return;
- }
-
- L instance = null;
- if (this.binding != null) {
- instance = (L) binding.getValue(faces.getELContext());
- }
- if (instance == null && this.type != null) {
- try {
- instance = (L) forName(this.type).newInstance();
- } catch (Exception e) {
- throw new AbortProcessingException("Couldn't Lazily
instantiate EventListener", e);
- }
- if (this.binding != null) {
- binding.setValue(faces.getELContext(), instance);
- }
- }
-
- if (instance != null) {
- event.processListener(instance);
- }
- }
- }
-
- public EventListenerHandler(TagConfig config) {
- super(config);
- this.binding = this.getAttribute("binding");
- TagAttribute type = this.getAttribute("type");
- if (type != null) {
- if (type.isLiteral()) {
- try {
- forName(type.getValue());
- } catch (ClassNotFoundException e) {
- throw new TagAttributeException(type, "Couldn't qualify
EventListener", e);
- }
- } else {
- throw new TagAttributeException(type, "Must be a literal class name
of type EventListener");
- }
- this.listenerType = type.getValue();
- } else {
- this.listenerType = null;
- }
- }
-
- public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
-
- // only process if it's been created
- if (parent == null || !ComponentHandler.isNew(parent)) {
- return;
- }
-
- if (isEventSource(parent)) {
- applyAttachedObject(ctx.getFacesContext(), parent);
- } else if (UIComponent.isCompositeComponent(parent)) {
- // Allow the composite component to know about the target component.
- TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
- } else {
- throw new TagException(this.tag, "Parent is not of type
EditableValueHolder, type is: " + parent);
- }
- }
-
- public String getFor() {
- TagAttribute attr = this.getAttribute("for");
- return attr == null ? null : attr.getValue();
- }
-
- public static Class<?> forName(String name) throws ClassNotFoundException {
- if (null == name || "".equals(name)) {
- return null;
- }
-
- return Class.forName(name, false,
Thread.currentThread().getContextClassLoader());
- }
-
- public abstract boolean isEventSource(UIComponent comp);
-}
-
-
Copied:
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
(from rev 19108,
trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java)
===================================================================
---
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java
(rev 0)
+++
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/EventListenerHandler.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,145 @@
+/**
+ * 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.view.facelets.html;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.view.EditableValueHolderAttachedObjectHandler;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * @author akolonitsky
+ * @since Aug 31, 2010
+ */
+public abstract class EventListenerHandler extends TagHandler implements
EditableValueHolderAttachedObjectHandler {
+
+ protected final TagAttribute binding;
+
+ protected final String listenerType;
+
+ public abstract static class LazyEventListener<L extends FacesListener>
implements FacesListener, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String type;
+
+ protected final ValueExpression binding;
+
+ protected LazyEventListener(String type, ValueExpression binding) {
+ this.type = type;
+ this.binding = binding;
+ }
+
+ public void processEvent(FacesEvent event) throws AbortProcessingException {
+
+ FacesContext faces = FacesContext.getCurrentInstance();
+ if (faces == null) {
+ return;
+ }
+
+ L instance = null;
+ if (this.binding != null) {
+ instance = (L) binding.getValue(faces.getELContext());
+ }
+ if (instance == null && this.type != null) {
+ try {
+ instance = (L) forName(this.type).newInstance();
+ } catch (Exception e) {
+ throw new AbortProcessingException("Couldn't Lazily
instantiate EventListener", e);
+ }
+ if (this.binding != null) {
+ binding.setValue(faces.getELContext(), instance);
+ }
+ }
+
+ if (instance != null) {
+ event.processListener(instance);
+ }
+ }
+ }
+
+ public EventListenerHandler(TagConfig config) {
+ super(config);
+ this.binding = this.getAttribute("binding");
+ TagAttribute type = this.getAttribute("type");
+ if (type != null) {
+ if (type.isLiteral()) {
+ try {
+ forName(type.getValue());
+ } catch (ClassNotFoundException e) {
+ throw new TagAttributeException(type, "Couldn't qualify
EventListener", e);
+ }
+ } else {
+ throw new TagAttributeException(type, "Must be a literal class name
of type EventListener");
+ }
+ this.listenerType = type.getValue();
+ } else {
+ this.listenerType = null;
+ }
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+
+ // only process if it's been created
+ if (parent == null || !ComponentHandler.isNew(parent)) {
+ return;
+ }
+
+ if (isEventSource(parent)) {
+ applyAttachedObject(ctx.getFacesContext(), parent);
+ } else if (UIComponent.isCompositeComponent(parent)) {
+ // Allow the composite component to know about the target component.
+ TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
+ } else {
+ throw new TagException(this.tag, "Parent is not of type
EditableValueHolder, type is: " + parent);
+ }
+ }
+
+ public String getFor() {
+ TagAttribute attr = this.getAttribute("for");
+ return attr == null ? null : attr.getValue();
+ }
+
+ public static Class<?> forName(String name) throws ClassNotFoundException {
+ if (null == name || "".equals(name)) {
+ return null;
+ }
+
+ return Class.forName(name, false,
Thread.currentThread().getContextClassLoader());
+ }
+
+ public abstract boolean isEventSource(UIComponent comp);
+}
+
+
Deleted:
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
===================================================================
---
trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03
08:56:24 UTC (rev 19108)
+++
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, 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.view.facelets.html;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.AttachedObjectHandler;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class TagHandlerUtils {
-
- // TODO - is that implementation dependency?
- private static final String JAVAX_FACES_RETARGETABLE_HANDLERS =
"javax.faces.RetargetableHandlers";
-
- private TagHandlerUtils() {
- //utility class constructor
- }
-
- static List<AttachedObjectHandler>
getOrCreateRetargetableHandlersList(UIComponent component) {
- Map<String, Object> attrs = component.getAttributes();
- @SuppressWarnings({
- "unchecked"}) List<AttachedObjectHandler> list =
- (List<AttachedObjectHandler>)
attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
-
- if (list == null) {
- list = new ArrayList<AttachedObjectHandler>();
- attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
- }
-
- return list;
- }
-
- static <T> Class<? extends T> loadClass(String className, Class<T>
type)
- throws ClassNotFoundException, ClassCastException {
-
- ClassLoader ccl = Thread.currentThread().getContextClassLoader();
- Class<?> loadedClass = Class.forName(className, false, ccl);
-
- return loadedClass.asSubclass(type);
- }
-
-}
Copied:
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
(from rev 19108,
trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java)
===================================================================
---
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
(rev 0)
+++
branches/RF-7944/ui/common/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.view.facelets.html;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.AttachedObjectHandler;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class TagHandlerUtils {
+
+ // TODO - is that implementation dependency?
+ private static final String JAVAX_FACES_RETARGETABLE_HANDLERS =
"javax.faces.RetargetableHandlers";
+
+ private TagHandlerUtils() {
+ //utility class constructor
+ }
+
+ static List<AttachedObjectHandler>
getOrCreateRetargetableHandlersList(UIComponent component) {
+ Map<String, Object> attrs = component.getAttributes();
+ @SuppressWarnings({
+ "unchecked"}) List<AttachedObjectHandler> list =
+ (List<AttachedObjectHandler>)
attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
+
+ if (list == null) {
+ list = new ArrayList<AttachedObjectHandler>();
+ attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
+ }
+
+ return list;
+ }
+
+ static <T> Class<? extends T> loadClass(String className, Class<T>
type)
+ throws ClassNotFoundException, ClassCastException {
+
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+ Class<?> loadedClass = Class.forName(className, false, ccl);
+
+ return loadedClass.asSubclass(type);
+ }
+
+}
Modified:
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java
===================================================================
---
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -29,7 +29,7 @@
import javax.faces.context.FacesContext;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
Modified:
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java
===================================================================
---
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/AjaxCommandRendererBase.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -34,7 +34,7 @@
import org.ajax4jsf.renderkit.HandlersChain;
import org.ajax4jsf.renderkit.RendererBase;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
Modified:
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
===================================================================
---
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -36,9 +36,10 @@
import org.ajax4jsf.context.ContextInitParameters;
import org.richfaces.component.QueueRegistry;
+import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+
/**
* @author Nick Belaevski Base class for rendering Queue
*/
Modified:
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java
===================================================================
---
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -34,7 +34,7 @@
import javax.faces.view.facelets.ValidatorHandler;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Nick Belaevski
Deleted:
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java
===================================================================
---
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/TagHandlerUtils.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, 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.view.facelets.html;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.AttachedObjectHandler;
-
-/**
- * @author Nick Belaevski
- *
- */
-final class TagHandlerUtils {
-
- // TODO - is that implementation dependency?
- private static final String JAVAX_FACES_RETARGETABLE_HANDLERS =
"javax.faces.RetargetableHandlers";
-
- private TagHandlerUtils() {
- //utility class constructor
- }
-
- static List<AttachedObjectHandler>
getOrCreateRetargetableHandlersList(UIComponent component) {
- Map<String, Object> attrs = component.getAttributes();
- @SuppressWarnings({
- "unchecked"}) List<AttachedObjectHandler> list =
- (List<AttachedObjectHandler>)
attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
-
- if (list == null) {
- list = new ArrayList<AttachedObjectHandler>();
- attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
- }
-
- return list;
- }
-
- static <T> Class<? extends T> loadClass(String className, Class<T>
type)
- throws ClassNotFoundException, ClassCastException {
-
- ClassLoader ccl = Thread.currentThread().getContextClassLoader();
- Class<?> loadedClass = Class.forName(className, false, ccl);
-
- return loadedClass.asSubclass(type);
- }
-
-}
Modified:
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java
===================================================================
---
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/core/ui/src/main/java/org/richfaces/view/facelets/tag/BehaviorRule.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -30,7 +30,7 @@
import org.ajax4jsf.component.behavior.ClientBehavior;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Anton Belevich
Modified:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -195,6 +195,9 @@
@Attribute(events = @EventName("beforedomupdate"))
public abstract String getOnbeforedomupdate();
+
+ @Attribute
+ public abstract String getClientFilter();
@Override
public Converter getConverter() {
Modified:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -29,7 +29,6 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractAutocomplete;
public class AutocompleteDivLayoutStrategy extends AbstractAutocompleteLayoutStrategy
implements
AutocompleteEncodeStrategy {
@@ -46,41 +45,21 @@
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.startElement(HTML.DIV_ELEM, component);
responseWriter.writeAttribute(HTML.ID_ATTRIBUTE,
getContainerElementId(facesContext, component), null);
- // responseWriter.writeAttribute(HTML.CLASS_ATTRIBUTE, "cb_list_ul",
null);
}
public void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component)
throws IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.endElement(HTML.DIV_ELEM);
}
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object item) throws IOException {
+
+ public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.DIV_ELEM, component);
+ }
+
+ public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException {
ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.DIV_ELEM, comboBox);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font
rf-au-input", null);
-
- if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
- } else {
- if (item != null) {
- // TODO nick - use converter
- String value = null;
- if (comboBox.getItemConverter() != null) {
- value = comboBox.getItemConverter().getAsString(facesContext,
comboBox, item);
- }
- if (value != null) {
- writer.writeText(value, null);
- }
- writer.writeText(item, null);
- // writer.writeText(InputUtils.getConvertedValue(facesContext, comboBox,
item), null);
- }
- }
-
writer.endElement(HTML.DIV_ELEM);
-
}
}
Modified:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -5,18 +5,18 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.richfaces.component.AbstractAutocomplete;
public interface AutocompleteEncodeStrategy {
void encodeItemsContainerBegin(FacesContext facesContext, UIComponent component)
throws IOException ;
void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component) throws
IOException ;
+
+ void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException ;
+
+ void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException ;
void encodeFakeItem(FacesContext facesContext, UIComponent component) throws
IOException ;
- void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
- Object nextItem) throws IOException;
-
- public String getContainerElementId(FacesContext facesContext, UIComponent
component);
+ String getContainerElementId(FacesContext facesContext, UIComponent component);
}
Deleted:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteGridLayoutStrategy.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,34 +0,0 @@
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.component.AbstractAutocomplete;
-
-public class AutocompleteGridLayoutStrategy extends AbstractAutocompleteLayoutStrategy
implements
- AutocompleteEncodeStrategy {
-
- public void encodeFakeItem(FacesContext facesContext, UIComponent component) throws
IOException {
- // TODO Auto-generated method stub
-
- }
-
- public void encodeItemsContainerBegin(FacesContext facesContext, UIComponent
component) throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- public void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component)
throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object nextItem)
- throws IOException {
- // TODO Auto-generated method stub
-
- }
-
-}
Modified:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -7,7 +7,6 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractAutocomplete;
public class AutocompleteListLayoutStrategy extends AbstractAutocompleteLayoutStrategy
implements
AutocompleteEncodeStrategy {
@@ -31,33 +30,15 @@
ResponseWriter responseWriter = facesContext.getResponseWriter();
responseWriter.endElement(HTML.UL_ELEMENT);
}
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object item) throws IOException {
+
+ public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.LI_ELEMENT, component);
+ }
+
+ public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException {
ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.LI_ELEMENT, comboBox);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font
rf-au-input", null);
-
- if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
- } else {
- if (item != null) {
- // TODO nick - use converter
- String value = null;
- if (comboBox.getItemConverter() != null) {
- value = comboBox.getItemConverter().getAsString(facesContext,
comboBox, item);
- }
- if (value != null) {
- writer.writeText(value, null);
- }
- writer.writeText(item, null);
- }
- }
-
writer.endElement(HTML.LI_ELEMENT);
-
}
}
Modified:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -37,6 +37,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.PartialResponseWriter;
import javax.faces.context.PartialViewContext;
+import javax.faces.context.ResponseWriter;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@@ -45,8 +46,10 @@
import javax.servlet.jsp.jstl.sql.Result;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.util.InputUtils;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
@@ -70,6 +73,19 @@
})
public abstract class AutocompleteRendererBase extends InputRendererBase implements
MetaComponentRenderer {
+ public JSFunctionDefinition getClientFilterFunction(UIComponent component) {
+ AbstractAutocomplete autocomplete = (AbstractAutocomplete) component;
+ String clientFilter =
(String)autocomplete.getAttributes().get("clientFilter");
+ if (clientFilter != null && clientFilter.length() != 0) {
+ JSFunctionDefinition clientFilterFunction = new
JSFunctionDefinition("subString");
+ clientFilterFunction.addParameter("value");
+ clientFilterFunction.addToBody(clientFilter);
+ return clientFilterFunction;
+ }
+
+ return null;
+ }
+
public String getScriptOptions(UIComponent component) {
Map<String, Object> attributes = component.getAttributes();
Map<String, Object> options = new HashMap<String, Object>();
@@ -77,7 +93,6 @@
utils.addToScriptHash(options, "buttonId", component.getClientId() +
"Button");
utils.addToScriptHash(options, "selectedItemClass",
attributes.get("selectedItemClass"));
utils.addToScriptHash(options, "minChars",
attributes.get("minChars"), "1");
- utils.addToScriptHash(options, "mode",
attributes.get("mode"), "ajax");
utils.addToScriptHash(options, "filterFunction",
attributes.get("filterFunction"));
utils.addToScriptHash(options, "autofill",
attributes.get("autofill"), "true");
utils.addToScriptHash(options, "disabled",
attributes.get("disabled"), "false");
@@ -88,10 +103,17 @@
utils.addToScriptHash(options, "onerror",
attributes.get("onerror"));
utils.addToScriptHash(options, "onbeforedomupdate",
attributes.get("onbeforedomupdate"));
utils.addToScriptHash(options, "onchange",
attributes.get("onchange"));
- if (attributes.get("mode").equals("ajax")){
- utils.addToScriptHash(options, "isCachedAjax", false,
"true");
- } else if (attributes.get("mode").equals("client")) {
- utils.addToScriptHash(options, "ajaxMode", false,
"true");
+ utils.addToScriptHash(options, "filterFunction",
getClientFilterFunction(component));
+ String mode = (String)attributes.get("mode");
+ if (mode != null) {
+ if (mode.equals("ajax")){
+ utils.addToScriptHash(options, "isCachedAjax", false,
"true");
+ } else if (mode.equals("client") ||
mode.equals("lazyClient")) {
+ utils.addToScriptHash(options, "ajaxMode", false,
"true");
+ if (mode.equals("lazyClient")) {
+ utils.addToScriptHash(options, "lazyClientMode", true,
"false");
+ }
+ }
}
StringBuilder builder = new StringBuilder();
builder.append(ScriptUtils.toScript(options));
@@ -185,12 +207,17 @@
Object nextItem = items.next();
setVar(facesContext, comboBox.getVar(), nextItem);
- strategy.encodeItem(facesContext, comboBox, nextItem);
+ this.encodeItem(facesContext, comboBox, nextItem, strategy);
if (comboBox.getFetchValue() != null) {
fetchValues.add(comboBox.getFetchValue());
} else {
// TODO use converter
- fetchValues.add(nextItem);
+ if (comboBox.getItemConverter() != null) {
+ fetchValues.add(comboBox.getItemConverter().getAsString(facesContext,
component, nextItem));
+ } else{
+ fetchValues.add(nextItem);
+ }
+
}
}
@@ -205,25 +232,50 @@
protected void encodeItemsContainer(FacesContext facesContext, UIComponent component)
throws IOException {
AutocompleteEncodeStrategy strategy = getStrategy(component);
- strategy.encodeItemsContainerBegin(facesContext, component);
- if (component.getAttributes().get("mode").equals("client"))
{
+ Object mode = component.getAttributes().get("mode");
+ if (mode!= null && mode.equals("client")) {
List<Object> fetchValues = new ArrayList<Object>();
this.encodeItems(facesContext, component, fetchValues);
} else {
- strategy.encodeFakeItem(facesContext, component);
+ strategy.encodeItemsContainerBegin(facesContext, component);
+ // TODO: is it needed
+ //strategy.encodeFakeItem(facesContext, component);
+ strategy.encodeItemsContainerEnd(facesContext, component);
}
- strategy.encodeItemsContainerEnd(facesContext, component);
}
+ public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object item, AutocompleteEncodeStrategy strategy) throws IOException {
+ strategy.encodeItemBegin(facesContext, comboBox);
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font
rf-au-input", null);
+
+ if (comboBox.getChildCount() > 0) {
+ for (UIComponent child : comboBox.getChildren()) {
+ child.encodeAll(facesContext);
+ }
+ } else {
+ if (item != null) {
+ // TODO nick - use converter
+ String value = null;
+ if (comboBox.getItemConverter() != null) {
+ value = comboBox.getItemConverter().getAsString(facesContext,
comboBox, item);
+ }
+ if (value != null) {
+ writer.writeText(value, null);
+ }
+ writer.writeText(item, null);
+ }
+ }
+ strategy.encodeItemEnd(facesContext, comboBox);
+ }
+
private AutocompleteEncodeStrategy getStrategy(UIComponent component) {
AbstractAutocomplete comboBox = (AbstractAutocomplete) component;
if (comboBox.getLayout() != null) {
if (comboBox.getLayout().equals(AutocompleteLayout.div.toString())) {
return new AutocompleteDivLayoutStrategy();
}
- if (comboBox.getLayout().equals(AutocompleteLayout.grid.toString())) {
- return new AutocompleteGridLayoutStrategy();
- }
if (comboBox.getLayout().equals(AutocompleteLayout.list.toString())) {
return new AutocompleteListLayoutStrategy();
}
Modified:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -7,16 +7,17 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractAutocomplete;
public class AutocompleteTableLayoutStrategy extends AbstractAutocompleteLayoutStrategy
implements
AutocompleteEncodeStrategy {
public void encodeFakeItem(FacesContext facesContext, UIComponent component) throws
IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
+ responseWriter.startElement(HTML.TR_ELEMENT, component);
responseWriter.startElement(HTML.TD_ELEM, component);
responseWriter.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none",
null);
responseWriter.endElement(HTML.TD_ELEM);
+ responseWriter.endElement(HTML.TR_ELEMENT);
}
@@ -25,42 +26,24 @@
responseWriter.startElement(HTML.TABLE_ELEMENT, component);
responseWriter.writeAttribute(HTML.ID_ATTRIBUTE,
getContainerElementId(facesContext, component), null);
responseWriter.startElement(HTML.TBODY_ELEMENT, component);
- // responseWriter.writeAttribute(HTML.CLASS_ATTRIBUTE, "cb_list_ul",
null);
}
public void encodeItemsContainerEnd(FacesContext facesContext, UIComponent component)
throws IOException {
ResponseWriter responseWriter = facesContext.getResponseWriter();
- responseWriter.endElement(HTML.TABLE_ELEMENT);
responseWriter.endElement(HTML.TBODY_ELEMENT);
+ responseWriter.endElement(HTML.TABLE_ELEMENT);
}
-
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object item) throws IOException {
+
+ public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HTML.TR_ELEMENT, component);
+ writer.startElement(HTML.TD_ELEM, component);
+ }
+
+ public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException {
ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.startElement(HTML.TD_ELEM, comboBox);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-au-option rf-au-font
rf-au-input", null);
-
- if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
- } else {
- if (item != null) {
- // TODO nick - use converter
- String value = null;
- if (comboBox.getItemConverter() != null) {
- value = comboBox.getItemConverter().getAsString(facesContext,
comboBox, item);
- }
- if (value != null) {
- writer.writeText(value, null);
- }
- writer.writeText(item, null);
- // writer.writeText(InputUtils.getConvertedValue(facesContext, comboBox,
item), null);
- }
- }
-
writer.endElement(HTML.TD_ELEM);
-
+ writer.endElement(HTML.TR_ELEMENT);
}
}
Modified:
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -35,7 +35,6 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.AbstractInplaceInput;
import org.richfaces.component.InplaceState;
@@ -51,7 +50,7 @@
@ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(library="org.richfaces", name =
"inplaceInput.js"),
@ResourceDependency(library="org.richfaces", name =
"inplaceInput.ecss") })
-public class InplaceInputBaseRenderer extends RendererBase {
+public class InplaceInputBaseRenderer extends InputRendererBase {
public static final String OPTIONS_EDIT_EVENT = "editEvent";
@@ -61,12 +60,14 @@
public static final String OPTIONS_FOCUS = "focusElement";
- public static final String OPTIONS_BTN_OK = "okbtn";
+ public static final String OPTIONS_BUTTON_OK = "okbtn";
public static final String OPTIONS_LABEL = "label";
- public static final String OPTIONS_BTN_CANCEL = "cancelbtn";
+ public static final String OPTIONS_DEFAULT_LABEL = "defaultLabel";
+ public static final String OPTIONS_BUTTON_CANCEL = "cancelbtn";
+
public static final String OPTIONS_SHOWCONTROLS = "showControls";
public static final String OPTIONS_NONE_CSS = "noneCss";
@@ -115,17 +116,6 @@
setComponentAttributeName("onselect")
));
-
- @Override
- protected void doDecode(FacesContext facesContext, UIComponent component) {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- Map <String, String> parameterMap =
facesContext.getExternalContext().getRequestParameterMap();
- String newValue =
(String)parameterMap.get(inplaceInput.getClientId(facesContext));
- if (newValue != null) {
- inplaceInput.setSubmittedValue(newValue);
- }
- }
-
protected void renderInputHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
INPLACEINPUT_HANDLER_ATTRIBUTES);
}
@@ -134,12 +124,15 @@
return ((AbstractInplaceInput) component).getState();
}
- public String getValue(FacesContext context, UIComponent component) throws
IOException {
- // TODO: convert?
- String value = (String) ((AbstractInplaceInput) component).getValue();
+ public String getValue(FacesContext facesContext, UIComponent component) throws
IOException {
+ AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
+ String value = getInputValue(facesContext, inplaceInput);
+ if(value == null || "".equals(value)) {
+ value = inplaceInput.getDefaultLabel();
+ }
return value;
}
-
+
public String getResourcePath(FacesContext context, String resourceName) {
if (resourceName != null) {
ResourceHandler resourceHandler =
context.getApplication().getResourceHandler();
@@ -188,12 +181,13 @@
options.put(OPTIONS_INPUT, clientId + ":input");
options.put(OPTIONS_LABEL, clientId + ":label");
options.put(OPTIONS_FOCUS, clientId + ":focus");
+ options.put(OPTIONS_DEFAULT_LABEL, inplaceInput.getDefaultLabel());
boolean showControls = inplaceInput.isShowControls();
options.put(OPTIONS_SHOWCONTROLS, showControls);
if(showControls) {
- options.put(OPTIONS_BTN_OK, clientId + ":okbtn");
- options.put(OPTIONS_BTN_CANCEL, clientId + ":cancelbtn");
+ options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
+ options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
}
function.addParameter(options);
Modified:
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,14 +1,35 @@
(function ($, rf) {
rf.utils = rf.utils || {};
- rf.utils.Cache = function (key, items, values) {
+ rf.utils.Cache = function (key, items, values, useCache) {
this.key = key.toLowerCase();
this.cache = {}
this.cache[this.key] = items || [];
- this.values = typeof values != "function" ? values || this.cache[this.key] :
values(items);
+ this.originalValues = typeof values == "function" ? values(items) : values ||
this.cache[this.key];
+ this.values = processValues(this.originalValues);
+ this.useCache = useCache || checkValuesPrefix.call(this);
};
+
+ var processValues = function (values) {
+ var processedValues = [];
+ for (var i = 0; i<values.length; i++) {
+ processedValues.push(values[i].toLowerCase());
+ }
+ return processedValues;
+ }
+
+ var checkValuesPrefix = function () {
+ var result = true;
+ for (var i = 0; i<this.values.length; i++) {
+ if (this.values[i].indexOf(this.key)!=0) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
- var getItems = function (key) {
+ var getItems = function (key, filterFunction) {
key = key.toLowerCase();
var newCache = [];
@@ -19,12 +40,17 @@
if (this.cache[key]) {
newCache = this.cache[key];
} else {
+ var useCustomFilterFunction = typeof filterFunction == "function";
var itemsCache = this.cache[this.key];
for (var i = 0; i<this.values.length; i++) {
- var value = this.values[i].toLowerCase();
- var p = value.indexOf(key);
- if (p == 0) {
+ var value = this.values[i];
+ if (useCustomFilterFunction && filterFunction(key, value)) {
newCache.push(itemsCache[i]);
+ } else {
+ var p = value.indexOf(key);
+ if (p == 0) {
+ newCache.push(itemsCache[i]);
+ }
}
}
@@ -40,12 +66,12 @@
};
var getItemValue = function (item) {
- return this.values[this.cache[this.key].index(item)];
+ return this.originalValues[this.cache[this.key].index(item)];
};
var isCached = function (key) {
key = key.toLowerCase();
- return this.cache[key] || this.key.indexOf(key)==0;
+ return this.cache[key] || this.useCache && key.indexOf(this.key)==0;
};
$.extend(rf.utils.Cache.prototype, (function () {
@@ -95,9 +121,11 @@
minChars:1,
selectFirst:true,
ajaxMode:true,
+ lazyClientMode:false,
isCachedAjax:true,
- tokens: ",",
- attachToBody:true
+ tokens: "",
+ attachToBody:true,
+ filterFunction: undefined
};
var ID = {
@@ -138,9 +166,7 @@
if (element) {
if (event.type=="mouseover") {
var index = this.items.index(element);
- if (index!=this.index) {
- selectItem.call(this, index);
- }
+ selectItem.call(this, event, index);
} else {
this.__onChangeValue(event, getSelectedItemValue.call(this));
rf.Selection.setCaretTo(rf.getDomElement(this.fieldId));
@@ -152,7 +178,7 @@
var updateItemsList = function (value, fetchValues) {
this.items =
$(rf.getDomElement(this.id+ID.ITEMS)).find("."+this.options.itemClass);
if (this.items.length>0) {
- this.cache = new rf.utils.Cache(value, this.items, fetchValues || getData);
+ this.cache = new rf.utils.Cache((this.options.ajaxMode ? value : ""),
this.items, fetchValues || getData, !this.options.ajaxMode);
}
};
@@ -173,7 +199,7 @@
};
var autoFill = function (inputValue, value) {
- if( this.options.autofill) {
+ if( this.options.autofill && value.toLowerCase().indexOf(inputValue)==0) {
var field = rf.getDomElement(this.fieldId);
var start = rf.Selection.getStart(field);
this.setInputValue(inputValue + value.substring(inputValue.length));
@@ -182,18 +208,25 @@
}
};
- var callAjax = function(event, value) {
+ var callAjax = function(event, value, callback) {
- $(rf.getDomElement(this.id+ID.ITEMS)).removeData().empty();
+ clearItems.call(this);
rf.getDomElement(this.id+ID.VALUE).value = value;
var _this = this;
+ var _event = event;
var ajaxSuccess = function (event) {
updateItemsList.call(_this, _this.value, event.componentData &&
event.componentData[_this.id]);
- if (_this.isVisible && _this.options.selectFirst) {
- selectItem.call(_this, 0);
+ if (_this.options.lazyClientMode && _this.value.length!=0) {
+ updateItemsFromCache.call(_this, _this.value);
}
+ if (_this.focused && _this.items.length!=0 && callback) {
+ callback.call(_this, _event);
+ }
+ if (!callback && _this.isVisible && _this.options.selectFirst) {
+ selectItem.call(_this, _event, 0);
+ }
}
var ajaxError = function (event) {
@@ -207,8 +240,8 @@
rf.ajax(this.id, event, {parameters: params, error: ajaxError, complete:ajaxSuccess});
};
- var selectItem = function(index, isOffset, noAutoFill) {
- if (this.items.length==0) return;
+ var selectItem = function(event, index, isOffset) {
+ if (this.items.length==0 || (!isOffset && this.index == index)) return;
if (this.index!=-1) {
this.items.eq(this.index).removeClass(this.options.selectedItemClass);
@@ -221,11 +254,11 @@
if (isOffset) {
this.index += index;
- if ( this.index<0 ) {
- this.index = this.items.length - 1;
- } else if (this.index >= this.items.length) {
- this.index = 0;
- }
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
} else {
if (index<0) {
index = 0;
@@ -237,39 +270,61 @@
var item = this.items.eq(this.index);
item.addClass(this.options.selectedItemClass);
scrollToSelectedItem.call(this);
- !noAutoFill && autoFill.call(this, this.value,
getSelectedItemValue.call(this));
+ if (event &&
+ event.which != rf.KEYS.BACKSPACE &&
+ event.which != rf.KEYS.DEL &&
+ event.which != rf.KEYS.LEFT &&
+ event.which != rf.KEYS.RIGHT) {
+ autoFill.call(this, this.value, getSelectedItemValue.call(this));
+ }
};
var updateItemsFromCache = function (value) {
- var newItems = this.cache.getItems(value);
+ var newItems = this.cache.getItems(value, this.options.filterFunction);
this.items = $(newItems);
//TODO: works only with simple markup, not with <tr>
- $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(newItems);
- }
+ $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(this.items);
+ window.console && console.log &&
console.log("updateItemsFromCache");
+ };
- var onChangeValue = function (event, value) {
- selectItem.call(this);
+ var clearItems = function () {
+ $(rf.getDomElement(this.id+ID.ITEMS)).removeData().empty();
+ this.items = [];
+ };
+
+ var onChangeValue = function (event, value, callback) {
+ selectItem.call(this, event);
// value is undefined if called from AutocompleteBase onChange
var subValue = (typeof value == "undefined") ? this.__getSubValue() : value;
+ var oldValue = this.value;
+ this.value = subValue;
- if (this.cache && this.cache.isCached(subValue)) {
- updateItemsFromCache.call(this, subValue);
- this.index = -1;
- this.value = subValue;
- if (this.options.selectFirst) {
- if (event.which == rf.KEYS.RETURN || event.type == "click") {
- this.setInputValue(subValue);
- } else {
- selectItem.call(this, 0, false, event.which == rf.KEYS.BACKSPACE || event.which ==
rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT);
- }
+ if ((this.options.isCachedAjax || !this.options.ajaxMode) &&
+ this.cache && this.cache.isCached(subValue)) {
+ if (oldValue!=subValue) {
+ updateItemsFromCache.call(this, subValue);
}
+ if (this.items.length!=0 && callback) {
+ callback.call(this, event);
+ }
+ if (event.which == rf.KEYS.RETURN || event.type == "click") {
+ this.setInputValue(subValue);
+ } else if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
+ }
} else {
+ if (event.which == rf.KEYS.RETURN || event.type == "click") {
+ this.setInputValue(subValue);
+ }
if (subValue.length>=this.options.minChars) {
- if (this.options.ajaxMode && this.value!=subValue) {
- this.value = subValue;
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ if ((this.options.ajaxMode || this.options.lazyClientMode) &&
oldValue!=subValue) {
+ callAjax.call(this, event, subValue, callback);
}
+ } else {
+ if (this.options.ajaxMode) {
+ clearItems.call(this);
+ }
}
}
@@ -341,9 +396,11 @@
*/
__updateState: function (event) {
var subValue = this.__getSubValue();
- // called from onShow method, not actually value changed
- if (this.items.length==0 && subValue.length>=this.options.minChars
&& this.isFirstAjax) {
- this.options.ajaxMode && callAjax.call(this, event, subValue);
+ // called from AutocompleteBase when not actually value changed
+ if (this.items.length==0 && this.isFirstAjax) {
+ if ((this.options.ajaxMode && subValue.length>=this.options.minChars) ||
this.options.lazyClientMode) {
+ callAjax.call(this, event, subValue);
+ }
}
return;
},
@@ -359,16 +416,16 @@
/*
* Override abstract protected methods
*/
- __onKeyUp: function () {
- selectItem.call(this, -1, true);
+ __onKeyUp: function (event) {
+ selectItem.call(this, event, -1, true);
},
- __onKeyDown: function () {
- selectItem.call(this, 1, true);
+ __onKeyDown: function (event) {
+ selectItem.call(this, event, 1, true);
},
- __onPageUp: function () {
+ __onPageUp: function (event) {
},
- __onPageDown: function () {
+ __onPageDown: function (event) {
},
__onBeforeShow: function (event) {
@@ -380,14 +437,12 @@
//rf.getDomElement(this.fieldId).focus();
},
__onShow: function (event) {
- if (event.which != rf.KEYS.BACKSPACE && this.items &&
this.items.length>0) {
- if (this.index!=0 && this.options.selectFirst) {
- selectItem.call(this, 0);
- }
+ if (this.options.selectFirst) {
+ selectItem.call(this, event, 0);
}
},
- __onHide: function () {
- selectItem.call(this);
+ __onHide: function (event) {
+ selectItem.call(this, event);
},
/*
* Destructor
Modified:
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -107,6 +107,7 @@
};
var onFocus = function (event) {
+ this.focused = true;
};
var onBlur = function (event) {
@@ -116,6 +117,7 @@
} else if (this.isVisible && !this.isMouseDown) {
var _this = this;
this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
+ this.focused=false;
}
};
@@ -128,15 +130,11 @@
//TODO: is it needed to chesk keys?
//TODO: we need to set value when autoFill used when LEFT or RIGHT was pressed
if (event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT || flag) {
- if (flag || this.isVisible) {
- this.__onChangeValue(event);
- }
if (flag) {
+ this.__onChangeValue(event, undefined, (!this.isVisible ? this.show : undefined));
this.currentValue = this.getInputValue();
- /*if(value && value.length>=this.options.minChars){
- onShow.call(this, event);
- }*/ // TODO: AMarkhel: is this check needed??? for what?
- onShow.call(this, event);
+ } else if (this.isVisible) {
+ this.__onChangeValue(event);
}
}
};
Modified:
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
---
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -28,21 +28,26 @@
$super.constructor.call(this, id);
this.attachToDom(id);
- this.namespace = this.namespace ||
"."+rf.Event.createNamespace(this.name, this.id);
+ this.namespace = this.namespace || "." +
rf.Event.createNamespace(this.name, this.id);
this.currentState = options.state;
this.editEvent = options.editEvent;
this.noneCss = options.noneCss;
this.changedCss = options.changedCss;
this.showControls = options.showControls;
+ this.defaultLabel = options.defaultLabel;
this.element = $(document.getElementById(id));
this.editContainer = $(document.getElementById(options.editContainer));
this.input = $(document.getElementById(options.input));
this.label = $(document.getElementById(options.label));
this.focusElement = $(document.getElementById(options.focusElement));
- this.initialValue = this.label.text();
+ var label = this.label.text();
+ var inputLabel = this.input.val();
+
+ this.initialValue = (label == inputLabel) ? label : "";
+
this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
this.input.bind("focus", $.proxy(this.__editHandler, this));
this.input.bind("change", $.proxy(this.__changeHandler, this));
@@ -66,7 +71,8 @@
$.extend(rf.ui.InplaceInput.prototype, ( function () {
var isSaved = false;
-
+ var isValueChanged = false;
+
return {
name : "inplaceInput",
@@ -86,6 +92,10 @@
var inputValue = this.input.val();
if(inputValue.length > 0) {
this.label.text(inputValue);
+ isValueChanged = true;
+ } else {
+ this.label.text(this.defaultLabel);
+ isValueChanged = false;
}
if(inputValue != this.initialValue) {
@@ -98,7 +108,10 @@
},
cancel: function() {
- var text = this.label.text();
+ var text = "";
+ if(isValueChanged) {
+ text = this.label.text();
+ }
this.input.val(text);
isSaved = true;
this.__hide();
Modified: branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -29,7 +29,7 @@
onmouseout="#{component.attributes['onmouseout']}"
onkeyup="#{component.attributes['onkeyup']}"
onkeydown="#{component.attributes['onkeydown']}"
- onkeypress="#{component.attributes['onkeypress']}"
id="#{clientId}Input" value="#{component.attributes['value']}"
disabled="#{disabled}" name="#{clientId}" type="text"
class="rf-au-font rf-au-input" />
+ onkeypress="#{component.attributes['onkeypress']}"
id="#{clientId}Input" value="#{component.attributes['value']}"
disabled="#{disabled}" name="#{clientId}" type="text"
class="rf-au-font rf-au-input" autocomplete="off"/>
<c:if
test="#{component.attributes['showButton']}">
<c:if
test="#{component.attributes['disabled']}">
<div id="#{clientId}Button"
class="rf-au-button">
Modified: branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,5 +1,28 @@
<?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.
+-->
<cdk:root
xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
@@ -25,8 +48,8 @@
</span>
<input id="#{clientId}:focus" type="image"
style="position: absolute; top: 0px; left: 0px; outline-style: none;"
class="rf-ii-none"/>
<span id="#{clientId}:edit" class="#{getEditStyleClass(component,
inplaceState)}">
- <input id="#{clientId}:input" autocomplete="off"
name="#{clientId}:input"
- type="text" value="#{inplaceValue}" class="rf-ii-f"
style="width: #{component.attributes['inputWidth']};"
+ <input id="#{clientId}:input" autocomplete="off"
name="#{clientId}"
+ type="text" value="#{getInputValue(facesContext, component)}"
class="rf-ii-f" style="width:
#{component.attributes['inputWidth']};"
cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext,
component);"/>
</input>
Modified:
branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
===================================================================
---
branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -31,7 +31,6 @@
import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.html.DomNode;
@@ -52,17 +51,14 @@
environment = new HtmlUnitEnvironment();
environment.withWebRoot(new File("src/test/resources"));
environment.withResource("/WEB-INF/faces-config.xml",
"org/richfaces/renderkit/faces-config.xml");
- environment.withResource("/test.xhtml",
"org/richfaces/renderkit/rendererTest.xhtml");
+ environment.withResource("/test.xhtml",
"org/richfaces/renderkit/inplaceInputTest.xhtml");
environment.start();
}
@Test
- @Ignore("Updates to RF-9132 broke this test - it needs to be fixed, but is
blocking M2 release")
public void testRenderDefaultState() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
- List<?> nodes = page.getByXPath("//*[@id =
'form:input_default']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_default']");
assertEquals("span", span.getNodeName());
assertEquals("rf-ii-d-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -72,10 +68,7 @@
DomNode text = label.getFirstChild();
assertEquals(DomNode.TEXT_NODE, text.getNodeType());
- List<?> editNodes = page.getByXPath("//*[@id =
'form:input_default:edit']");
- assertEquals(1, editNodes.size());
- HtmlElement edit = (HtmlElement) editNodes.get(0);
-
+ HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_default:edit']");
assertEquals("span", edit.getNodeName());
assertEquals("rf-ii-e-s rf-ii-none",
edit.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -89,14 +82,11 @@
}
@Test
- @Ignore("Updates to RF-9132 broke this test - it needs to be fixed, but is
blocking M2 release")
public void testRenderEditState() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
- List<?> nodes = page.getByXPath("//*[@id =
'form:input_edit']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_edit']");
assertEquals("span", span.getNodeName());
assertEquals("rf-ii-d-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -106,9 +96,7 @@
DomNode text = label.getFirstChild();
assertEquals(DomNode.TEXT_NODE, text.getNodeType());
- List<?> editNodes = page.getByXPath("//*[@id =
'form:input_edit:edit']");
- assertEquals(1, editNodes.size());
- HtmlElement edit = (HtmlElement) editNodes.get(0);
+ HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_edit:edit']");
assertEquals("span", edit.getNodeName());
assertEquals("rf-ii-e-s", edit.getAttribute(HTML.CLASS_ATTRIBUTE));
@@ -117,24 +105,15 @@
assertEquals("rf-ii-f", input.getAttribute(HTML.CLASS_ATTRIBUTE));
assertEquals(text.getNodeValue(), input.getAttribute(HTML.VALUE_ATTRIBUTE));
- List<?> buttonNodes = page.getByXPath("//*[@id =
'form:input_edit:btn']");
- assertEquals(1, buttonNodes.size());
-
- HtmlElement button = (HtmlElement) buttonNodes.get(0);
+ HtmlElement button = page.getFirstByXPath("//*[@id =
'form:input_edit:btn']");
assertEquals("span", button.getNodeName());
- List<?> okButtonNodes = page.getByXPath("//*[@id =
'form:input_edit:okbtn']");
- assertEquals(1, okButtonNodes.size());
-
- HtmlElement okButton = (HtmlElement) okButtonNodes.get(0);
+ HtmlElement okButton = page.getFirstByXPath("//*[@id =
'form:input_edit:okbtn']");
assertEquals("input", okButton.getNodeName());
assertEquals("rf-ii-btn",
okButton.getAttribute(HTML.CLASS_ATTRIBUTE));
assertEquals("image", okButton.getAttribute(HTML.TYPE_ATTR));
- List<?> cancelButtonNodes = page.getByXPath("//*[@id =
'form:input_edit:cancelbtn']");
- assertEquals(1, cancelButtonNodes.size());
-
- HtmlElement cancelButton = (HtmlElement) cancelButtonNodes.get(0);
+ HtmlElement cancelButton = page.getFirstByXPath("//*[@id =
'form:input_edit:cancelbtn']");
assertEquals("input", cancelButton.getNodeName());
assertEquals("rf-ii-btn",
cancelButton.getAttribute(HTML.CLASS_ATTRIBUTE));
assertEquals("image", cancelButton.getAttribute(HTML.TYPE_ATTR));
@@ -145,97 +124,62 @@
public void testEdit() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
edit(page, "input_default", "Another Test String");
-
blur(page);
-
- List<?> labelNodes = page.getByXPath("//*[@id =
'form:input_default:label']/text()");
- assertEquals(1, labelNodes.size());
- DomText text = (DomText) labelNodes.get(0);
+ DomText text = page.getFirstByXPath("//*[@id =
'form:input_default:label']/text()");
assertEquals("Another Test String", text.getTextContent());
-
- List<?>nodes = page.getByXPath("//*[@id =
'form:input_default']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_default']");
assertEquals("rf-ii-d-s rf-ii-c-s",
span.getAttribute(HTML.CLASS_ATTRIBUTE));
-
}
private void blur(HtmlPage page) throws Exception {
- List<?> panelNodes = page.getByXPath("//*[@id =
'form:panel']");
- assertEquals(1, panelNodes.size());
- HtmlElement panel = (HtmlElement) panelNodes.get(0);
+ HtmlElement panel = page.getFirstByXPath("//*[@id =
'form:panel']");
panel.click();
}
private void typeNewValue(HtmlPage page, String inplaceInputId, String value) throws
Exception {
- List<?> inputNodes = page.getByXPath("//*[@id = 'form:" +
inplaceInputId + ":input']");
- assertEquals(1, inputNodes.size());
- HtmlElement input = (HtmlElement) inputNodes.get(0);
+ HtmlElement input = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + ":input']");
input.setAttribute(HTML.VALUE_ATTRIBUTE, "");
input.type(value);
}
private void edit(HtmlPage page, String inplaceInputId, String value) throws
Exception {
- List<?> nodes = page.getByXPath("//*[@id = 'form:" +
inplaceInputId + "']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + "']");
span.click();
-
- List<?> editNodes = page.getByXPath("//*[@id = 'form:" +
inplaceInputId + ":edit']");
- assertEquals(1, editNodes.size());
- HtmlElement edit = (HtmlElement) editNodes.get(0);
+ HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + ":edit']");
assertEquals("rf-ii-e-s", edit.getAttribute(HTML.CLASS_ATTRIBUTE));
-
typeNewValue(page, inplaceInputId, value);
}
@Test
public void testEditWithControls() throws Exception {
HtmlPage page = environment.getPage("/test.jsf");
-
edit(page, "input_controls", "Another Test String");
-
- List<?> cancelNodes = page.getByXPath("//*[@id =
'form:input_controls:cancelbtn']");
- assertEquals(1, cancelNodes.size());
- HtmlElement cancel = (HtmlElement) cancelNodes.get(0);
-
+
+ HtmlElement cancel = page.getFirstByXPath("//*[@id =
'form:input_controls:cancelbtn']");
cancel.mouseDown();
- List<?> labelNodes = page.getByXPath("//*[@id =
'form:input_controls:label']/text()");
- assertEquals(1, labelNodes.size());
- DomText text = (DomText) labelNodes.get(0);
+ DomText text = page.getFirstByXPath("//*[@id =
'form:input_controls:label']/text()");
assertEquals("Test String", text.getTextContent());
- List<?> nodes = page.getByXPath("//*[@id =
'form:input_controls']");
- assertEquals(1, nodes.size());
- HtmlElement span = (HtmlElement) nodes.get(0);
+ HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_controls']");
assertEquals("rf-ii-d-s", span.getAttribute(HTML.CLASS_ATTRIBUTE));
edit(page, "input_controls", "Another Test String");
- List<?> okNodes = page.getByXPath("//*[@id =
'form:input_controls:okbtn']");
- assertEquals(1, okNodes.size());
- HtmlElement ok = (HtmlElement) okNodes.get(0);
-
+ HtmlElement ok = page.getFirstByXPath("//*[@id =
'form:input_controls:okbtn']");
ok.mouseDown();
- labelNodes = page.getByXPath("//*[@id =
'form:input_controls:label']/text()");
- assertEquals(1, labelNodes.size());
- text = (DomText) labelNodes.get(0);
+ text = page.getFirstByXPath("//*[@id =
'form:input_controls:label']/text()");
assertEquals("Another Test String", text.getTextContent());
- nodes = page.getByXPath("//*[@id = 'form:input_controls']");
- assertEquals(1, nodes.size());
- span = (HtmlElement) nodes.get(0);
+ span = page.getFirstByXPath("//*[@id =
'form:input_controls']");
assertEquals("rf-ii-d-s rf-ii-c-s",
span.getAttribute(HTML.CLASS_ATTRIBUTE));
edit(page, "input_controls", "Test String");
blur(page);
- labelNodes = page.getByXPath("//*[@id =
'form:input_controls:label']/text()");
- assertEquals(1, labelNodes.size());
- text = (DomText) labelNodes.get(0);
+ text = page.getFirstByXPath("//*[@id =
'form:input_controls:label']/text()");
assertEquals("Test String", text.getTextContent());
}
Copied:
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml
(from rev 19108,
trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml)
===================================================================
---
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml
(rev 0)
+++
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTest.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,26 @@
+<!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:in="http://richfaces.org/input">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces InplaceInput</title>
+</h:head>
+
+<h:body>
+ <h:form id="form">
+ <in:inplaceInput id="input_default"
value="#{dataBean.value}"/>
+
+ <in:inplaceInput id="input_controls" showControls="true"
value="#{dataBean.value}"/>
+
+ <in:inplaceInput id="input_edit" state="edit"
showControls="true" value="#{dataBean.value}"/>
+
+ <h:panelGroup id="panel">
+ <!-- click here for blur -->
+ </h:panelGroup>
+ </h:form>
+</h:body>
+</html>
Deleted:
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml
===================================================================
---
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/input/ui/src/test/resources/org/richfaces/renderkit/rendererTest.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,26 +0,0 @@
-<!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:in="http://richfaces.org/input">
-<f:view contentType="text/html" />
-
-<h:head>
- <title>Richfaces InplaceInput</title>
-</h:head>
-
-<h:body>
- <h:form id="form">
- <in:inplaceInput id="input_default"
value="#{dataBean.value}"/>
-
- <in:inplaceInput id="input_controls" showControls="true"
value="#{dataBean.value}"/>
-
- <in:inplaceInput id="input_edit" state="edit"
showControls="true" value="#{dataBean.value}"/>
-
- <h:panelGroup id="panel">
- <!-- click here for blur -->
- </h:panelGroup>
- </h:form>
-</h:body>
-</html>
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -50,7 +50,6 @@
public static final String COMPONENT_FAMILY = "org.richfaces.Column";
-
@Attribute
public abstract boolean isBreakRowBefore();
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -44,7 +44,7 @@
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.log.RichfacesLogger;
import org.richfaces.renderkit.MetaComponentRenderer;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
* @author Anton Belevich
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -68,6 +68,10 @@
public static final String LAST_FACET_NAME = "last";
+ public static final String NEXT_FACET_NAME = "next";
+
+ public static final String PREVIOUS_FACET_NAME = "previous";
+
public static final String FAST_FORWARD_FACET_NAME = "fastforward";
public static final String FAST_REWIND_FACET_NAME = "fastrewind";
@@ -82,16 +86,9 @@
private Integer page;
- protected enum PropertyKeys {
- boundaryControls, fastControls, fastStep, forComponent, inactiveStyle,
selectStyle, inactiveStyleClass, selectStyleClass, scrollerListener, lastPageMode,
maxPages, pageIndexVar, pagesVar, renderIfSinglePage, style, styleClass, stepControls
- }
-
@Attribute
public abstract String getLastPageMode();
- @Attribute(defaultValue="0")
- public abstract int getFastStep();
-
@Attribute
public abstract String getForComponent();
@@ -104,6 +101,12 @@
@Attribute(defaultValue="show")
public abstract String getFastControls();
+ @Attribute(defaultValue="show")
+ public abstract String getStepControls();
+
+ @Attribute(defaultValue="1")
+ public abstract int getFastStep();
+
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
@@ -163,10 +166,6 @@
return DataScrollerUtils.findDataTable(this);
}
- private int getFastStepOrDefault() {
- return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 1);
- }
-
public int getPageForFacet(String facetName) {
if (facetName == null) {
throw new NullPointerException();
@@ -179,10 +178,14 @@
newPage = 1;
} else if (LAST_FACET_NAME.equals(facetName)) {
newPage = pageCount > 0 ? pageCount : 1;
+ } else if (PREVIOUS_FACET_NAME.equals(facetName)) {
+ newPage = getPage() - 1;
+ } else if (NEXT_FACET_NAME.equals(facetName)) {
+ newPage = getPage() + 1;
} else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
- newPage = getPage() + getFastStepOrDefault();
+ newPage = getPage() + getFastStep();
} else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
- newPage = getPage() - getFastStepOrDefault();
+ newPage = getPage() - getFastStep();
} else {
try {
newPage = Integer.parseInt(facetName.toString());
@@ -234,7 +237,15 @@
public UIComponent getLast() {
return getFacetByKey(LAST_FACET_NAME);
}
+
+ public UIComponent getNext() {
+ return getFacetByKey(NEXT_FACET_NAME);
+ }
+ public UIComponent getPrevious() {
+ return getFacetByKey(PREVIOUS_FACET_NAME);
+ }
+
public UIComponent getFastForward() {
return getFacetByKey(FAST_FORWARD_FACET_NAME);
}
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -40,7 +40,7 @@
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
/**
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -60,7 +60,7 @@
import org.richfaces.model.SortField;
import org.richfaces.model.SortMode;
import org.richfaces.renderkit.MetaComponentRenderer;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
public abstract class UIDataTableBase extends UISequence implements Row,
MetaComponentResolver, MetaComponentEncoder {
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -41,7 +41,7 @@
import org.richfaces.component.UIDataAdaptor;
import org.richfaces.component.util.MessageUtil;
import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
+import org.richfaces.log.Logger;
public class DataTablePreRenderListener implements SystemEventListener {
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -52,7 +52,10 @@
Iterator<UIComponent> components = row.columns();
while(components.hasNext()){
- encodeColumn(facesContext, writer, (UIColumn)components.next(),rowHolder);
+ UIColumn column = (UIColumn)components.next();
+ if(column.isRendered()) {
+ encodeColumn(facesContext, writer, column,rowHolder);
+ }
}
encodeRowEnd(writer);
}
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ControlsState.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -35,7 +35,15 @@
private boolean lastRendered = true;
private boolean lastEnabled = true;
+
+ private boolean nextRendered = true;
+
+ private boolean nextEnabled = true;
+ private boolean previousRendered = true;
+
+ private boolean previousEnabled = true;
+
private boolean fastRewindRendered = true;
private boolean fastRewindEnabled = true;
@@ -109,8 +117,40 @@
public void setFastForwardEnabled(boolean fastForwardEnabled) {
this.fastForwardEnabled = fastForwardEnabled;
}
+
+ public boolean getNextRendered() {
+ return nextRendered;
+ }
- public boolean isControlsSeparatorRendered() {
+ public void setNextRendered(boolean nextRendered) {
+ this.nextRendered = nextRendered;
+ }
+
+ public boolean getNextEnabled() {
+ return nextEnabled;
+ }
+
+ public void setNextEnabled(boolean nextEnabled) {
+ this.nextEnabled = nextEnabled;
+ }
+
+ public boolean getPreviousRendered() {
+ return previousRendered;
+ }
+
+ public void setPreviousRendered(boolean previousRendered) {
+ this.previousRendered = previousRendered;
+ }
+
+ public boolean getPreviousEnabled() {
+ return previousEnabled;
+ }
+
+ public void setPreviousEnabled(boolean previousEnabled) {
+ this.previousEnabled = previousEnabled;
+ }
+
+ public boolean getControlsSeparatorRendered() {
return controlsSeparatorRendered;
}
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -87,10 +87,10 @@
boolean useFirst = true;
boolean useLast = true;
-
+
boolean useBackFast = true;
boolean useForwFast = true;
-
+
ControlsState controlsState = new ControlsState();
if (pageIndex <= minPageIdx) {
@@ -110,6 +110,7 @@
}
String boundaryControls = (String)
component.getAttributes().get("boundaryControls");
+ String stepControls = (String)
component.getAttributes().get("stepControls");
String fastControls = (String)
component.getAttributes().get("fastControls");
boolean isAuto = "auto".equals(boundaryControls);
@@ -125,7 +126,21 @@
controlsState.setFirstRendered(false);
controlsState.setLastRendered(false);
}
+
+ isAuto = "auto".equals(stepControls);
+ if (isAuto || "show".equals(stepControls)) {
+ if (isAuto) {
+ controlsState.setPreviousRendered(useFirst);
+ controlsState.setNextRendered(useLast);
+ }
+ controlsState.setPreviousEnabled(useFirst);
+ controlsState.setNextEnabled(useLast);
+ } else {
+ controlsState.setPreviousRendered(false);
+ controlsState.setNextRendered(false);
+ }
+
isAuto = "auto".equals(fastControls);
if (isAuto || "show".equals(fastControls)) {
if (isAuto) {
@@ -253,9 +268,17 @@
left.put(clientId + "_ds_fr",
AbstractDataScroller.FAST_REWIND_FACET_NAME);
}
+ if (controlsState.getPreviousRendered() &&
controlsState.getPreviousEnabled()) {
+ left.put(clientId + "_ds_prev",
AbstractDataScroller.PREVIOUS_FACET_NAME);
+ }
+
if (controlsState.getFastForwardRendered() &&
controlsState.getFastForwardEnabled()) {
right.put(clientId + "_ds_ff",
AbstractDataScroller.FAST_FORWARD_FACET_NAME);
}
+
+ if (controlsState.getNextRendered() && controlsState.getNextEnabled()) {
+ right.put(clientId + "_ds_next",
AbstractDataScroller.NEXT_FACET_NAME);
+ }
if (controlsState.getLastRendered() && controlsState.getLastEnabled()) {
right.put(clientId + "_ds_l",
AbstractDataScroller.LAST_FACET_NAME);
@@ -306,6 +329,10 @@
definition.addToBody(buffer);
return definition;
}
+
+ public void encodeFacet(FacesContext context, UIComponent component) throws
IOException {
+ component.encodeAll(context);
+ }
public boolean getRendersChildren() {
return true;
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -149,72 +149,73 @@
RowHolder rowHolder = (RowHolder) holder;
Row row = rowHolder.getRow();
- AbstractDataTable dataTable = (AbstractDataTable)row;
-
- boolean partialUpdate = rowHolder.isUpdatePartial();
+ AbstractDataTable dataTable = (AbstractDataTable) row;
+
+ boolean partialUpdate = rowHolder.isUpdatePartial();
boolean parentTbodyStart = rowHolder.isEncodeParentTBody();
boolean tbodyStart = parentTbodyStart;
-
+
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
while (components.hasNext()) {
-
UIComponent child = components.next();
- if(child instanceof Row) {
- boolean isSubtable = (child instanceof AbstractSubTable);
- //new row -> close </tr>
- if (rowHolder.getProcessCell() != 0) {
- encodeRowEnd(writer);
+ if (child.isRendered()) {
+ if (child instanceof Row) {
+ boolean isSubtable = (child instanceof AbstractSubTable);
+ // new row -> close </tr>
+ if (rowHolder.getProcessCell() != 0) {
+ encodeRowEnd(writer);
- if(isSubtable) {
- encodeTableBodyEnd(writer);
- tbodyStart = false;
-
- if (partialUpdate) {
- partialEnd(facesContext);
+ if (isSubtable) {
+ encodeTableBodyEnd(writer);
+ tbodyStart = false;
+
+ if (partialUpdate) {
+ partialEnd(facesContext);
+ }
}
}
- }
-
- rowHolder.nextCell();
-
- if(isSubtable && partialUpdate){
- String id = dataTable.getRelativeClientId(facesContext) +
":"+ child.getId() +":c";
- partialStart(facesContext, id);
- }
-
- child.encodeAll(facesContext);
-
- if (isSubtable && partialUpdate) {
- partialEnd(facesContext);
- }
-
- } else if(child instanceof UIColumn) {
-
- if(!parentTbodyStart && !tbodyStart) {
- if (partialUpdate) {
- partialStart(facesContext,
dataTable.getRelativeClientId(facesContext) + ":tb");
+
+ rowHolder.nextCell();
+
+ if (isSubtable && partialUpdate) {
+ String id = dataTable.getRelativeClientId(facesContext) +
":" + child.getId() + ":c";
+ partialStart(facesContext, id);
}
-
- encodeTableBodyStart(writer, facesContext, dataTable);
- rowHolder.setRowStart(true);
- tbodyStart = true;
- }
-
- encodeColumn(facesContext, writer, (UIColumn)child, rowHolder);
-
- if(!components.hasNext()) {
- encodeRowEnd(writer);
-
- if(!parentTbodyStart && tbodyStart) {
- encodeTableBodyEnd(writer);
- tbodyStart = false;
-
- if(partialUpdate) {
- partialEnd(facesContext);
+
+ child.encodeAll(facesContext);
+
+ if (isSubtable && partialUpdate) {
+ partialEnd(facesContext);
+ }
+
+ } else if (child instanceof UIColumn) {
+
+ if (!parentTbodyStart && !tbodyStart) {
+ if (partialUpdate) {
+ partialStart(facesContext,
dataTable.getRelativeClientId(facesContext) + ":tb");
}
+
+ encodeTableBodyStart(writer, facesContext, dataTable);
+ rowHolder.setRowStart(true);
+ tbodyStart = true;
}
+
+ encodeColumn(facesContext, writer, (UIColumn) child, rowHolder);
+
+ if (!components.hasNext()) {
+ encodeRowEnd(writer);
+
+ if (!parentTbodyStart && tbodyStart) {
+ encodeTableBodyEnd(writer);
+ tbodyStart = false;
+
+ if (partialUpdate) {
+ partialEnd(facesContext);
+ }
+ }
+ }
}
}
}
Modified:
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -194,18 +194,19 @@
while (components.hasNext()) {
UIComponent component = components.next();
-
- if(component instanceof UIColumn) {
- encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
-
- } else if (component instanceof AbstractSubTable) {
- if(component.isRendered()) {
- encodeRowEnd(writer);
+ if(component.isRendered()) {
+ if(component instanceof UIColumn ) {
+ encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
+
+ } else if (component instanceof AbstractSubTable) {
+ if(component.isRendered()) {
+ encodeRowEnd(writer);
+ }
+
+ component.encodeAll(facesContext);
+ rowHolder.setRowStart(true);
}
-
- component.encodeAll(facesContext);
- rowHolder.setRowStart(true);
- }
+ }
}
encodeRowEnd(writer);
Modified:
branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -132,13 +132,21 @@
RichFaces.Event.fireById(this.id, this.getScrollEventName(), {'page' :
page});
}
},
-
+
+ fastForward: function() {
+ this.switchToPage("fastforward");
+ },
+
+ fastRewind: function() {
+ this.switchToPage("fastrewind");
+ },
+
next: function() {
- this.switchToPage("fastforward");
+ this.switchToPage("next");
},
previous: function() {
- this.switchToPage("fastrewind");
+ this.switchToPage("previous");
},
first: function() {
Copied: branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include (from
rev 19108, trunk/ui/iteration/ui/src/main/templates/buttons.template.include)
===================================================================
--- branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include
(rev 0)
+++
branches/RF-7944/ui/iteration/ui/src/main/templates/buttons.template.include 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,51 @@
+<!--
+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.
+-->
+
+<c:choose
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core">
+ <c:when test="#{isEnabled}">
+ <a id="#{id}" class="#{enabledStyles}"
href="javascript:void(0);" >
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </a>
+ </c:when>
+ <c:otherwise>
+ <span id="#{id}" class="#{disabledStyles}">
+ <c:choose>
+ <c:when test="#{facet != null}">
+ <cdk:call expression="encodeFacet(facesContext, facet);"/>
+ </c:when>
+ <c:otherwise>
+ #{defaultText}
+ </c:otherwise>
+ </c:choose>
+ </span>
+ </c:otherwise>
+</c:choose>
Modified: branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/main/templates/datascroller.template.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,8 +1,32 @@
<?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.
+-->
+
<cdk:root
xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
-
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude">
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.DataScrollerRenderer</cdk:class>
@@ -12,81 +36,79 @@
</cc:interface>
<cc:implementation>
-
<cdk:object type="org.richfaces.renderkit.ControlsState"
name="controlsState"
value="#{getControlsState(facesContext,component)}" />
<span id="#{clientId}" class="rf-ds"><!-- Now decor is
disabled !!! -->
+
<c:if test="#{controlsState.firstRendered}">
- <c:choose>
- <c:when test="#{controlsState.firstEnabled}">
- <a id="#{clientId}_ds_f" class="rf-ds-btn rf-ds-l"
href="javascript:void(0)" >
- ««
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_f" class="rf-ds-btn rf-ds-l
rf-ds-dis">
- ««
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="boolean" name="isEnabled"
value="#{controlsState.firstEnabled}"/>
+ <cdk:object type="UIComponent" name="facet"
value="#{component.getFacet('first')}"/>
+ <cdk:object type="String" name="enabledStyles"
value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="String" name="disabledStyles"
value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object type="String" name="id"
value="#{clientId}_ds_f"/>
+ <cdk:object type="String" name="defaultText"
value="««««"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
</c:if>
-
<c:if test="#{controlsState.fastRewindRendered}">
- <c:choose>
- <c:when test="#{controlsState.fastRewindEnabled}">
- <a id="#{clientId}_ds_fr" class="rf-ds-btn rf-ds-l"
href="javascript:void(0)">
- «
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_fr" class="rf-ds-btn rf-ds-l
rf-ds-dis">
- «
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="boolean" name="isEnabled"
value="#{controlsState.fastRewindEnabled}"/>
+ <cdk:object type="UIComponent" name="facet"
value="#{component.getFacet('fastRewind')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object type="java.lang.String" name="id"
value="#{clientId}_ds_fr"/>
+ <cdk:object type="java.lang.String" name="defaultText"
value="««"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
</c:if>
+
+ <c:if test="#{controlsState.previousRendered}">
+ <cdk:object name="isEnabled"
value="#{controlsState.previousEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('previous')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-l"/>
+ <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-l rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_prev"/>
+ <cdk:object name="defaultText" value="«"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
- <cdk:object type="java.util.Map" name="digitals"
value="#{renderPager(responseWriter, facesContext, component)}" />
-
- <c:if test="#{controlsState.fastForwardRendered}">
- <c:choose>
- <c:when test="#{controlsState.fastForwardEnabled}">
- <a id="#{clientId}_ds_ff" class="rf-ds-btn rf-ds-r"
href="javascript:void(0)">
- »
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_ff" class="rf-ds-btn rf-ds-r
rf-ds-dis">
- »
- </span>
- </c:otherwise>
- </c:choose>
+ <cdk:object type="java.util.Map" name="digitals"
value="#{renderPager(responseWriter, facesContext, component)}" />
+
+ <c:if test="#{controlsState.nextRendered}">
+ <cdk:object name="isEnabled"
value="#{controlsState.nextEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('next')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_next"/>
+ <cdk:object name="defaultText" value="»"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
</c:if>
+ <c:if test="#{controlsState.fastForwardRendered}">
+ <cdk:object name="isEnabled"
value="#{controlsState.fastForwardEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('fastForward')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_ff"/>
+ <cdk:object name="defaultText"
value="»»"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
<c:if test="#{controlsState.lastRendered}">
- <c:choose>
- <c:when test="#{controlsState.lastEnabled}">
- <a id="#{clientId}_ds_l" class="rf-ds-btn rf-ds-r"
href="javascript:void(0)">
- »»
- </a>
- </c:when>
- <c:otherwise>
- <span id="#{clientId}_ds_l" class="rf-ds-btn rf-ds-r
rf-ds-dis">
- »»
- </span>
- </c:otherwise>
- </c:choose>
- </c:if>
-
+ <cdk:object name="isEnabled"
value="#{controlsState.lastEnabled}"/>
+ <cdk:object name="facet"
value="#{component.getFacet('last')}"/>
+ <cdk:object type="java.lang.String" name="enabledStyles"
value="rf-ds-btn rf-ds-r"/>
+ <cdk:object type="java.lang.String" name="disabledStyles"
value="rf-ds-btn rf-ds-r rf-ds-dis"/>
+ <cdk:object name="id" value="#{clientId}_ds_l"/>
+ <cdk:object name="defaultText"
value="»»»»"/>
+ <xi:include xpointer="xpointer(/*)"
href="buttons.template.include" />
+ </c:if>
+
<cdk:object type="java.util.Map" name="buttons"
value="#{getControls(facesContext, component, controlsState)}" />
<script type="text/javascript">
<cdk:call expression="buildScript(responseWriter, facesContext, component,
buttons, digitals);"/>
</script>
</span>
-
-
+
</cc:implementation>
</cdk:root>
\ No newline at end of file
Copied:
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java
(from rev 19108,
trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java)
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java
(rev 0)
+++
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableTest.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,274 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.component;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.jboss.test.faces.AbstractFacesTest;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.model.Arrangeable;
+import org.richfaces.model.ArrangeableState;
+import org.richfaces.model.FilterField;
+import org.richfaces.model.SortField;
+import org.richfaces.model.SortMode;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class UIDataTableTest extends AbstractFacesTest {
+
+ private class MockArrangeableModel extends ExtendedDataModel<Object> implements
Arrangeable {
+
+ private ArrangeableState state;
+ @Override
+ public Object getRowKey() {
+ return null;
+ }
+
+ @Override
+ public void setRowKey(Object key) {
+ }
+
+ @Override
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object
argument) {
+ }
+
+ @Override
+ public int getRowCount() {
+ return 0;
+ }
+
+ @Override
+ public Object getRowData() {
+ return null;
+ }
+
+ @Override
+ public int getRowIndex() {
+ return 0;
+ }
+
+ @Override
+ public Object getWrappedData() {
+ return null;
+ }
+
+ @Override
+ public boolean isRowAvailable() {
+ return false;
+ }
+
+ @Override
+ public void setRowIndex(int rowIndex) {
+ }
+
+ @Override
+ public void setWrappedData(Object data) {
+ }
+
+ public void arrange(FacesContext context, ArrangeableState state) {
+ this.state = state;
+ }
+
+ public ArrangeableState getState() {
+ return state;
+ }
+
+ }
+ private UIDataTable table = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ setupFacesRequest();
+ table = new UIDataTable();
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ table = null;
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link
org.richfaces.component.UIDataTableBase#getRendersChildren()}.
+ */
+ @Test
+ public void testGetRendersChildren() {
+ Assert.assertTrue(table.getRendersChildren());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#dataChildren()}.
+ */
+ @Test
+ public void testDataChildren() {
+ Assert.assertTrue(table.dataChildren() instanceof DataTableDataIterator);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#fixedChildren()}.
+ */
+ @Test
+ public void testFixedChildren() {
+ Assert.assertTrue(table.fixedChildren() instanceof
DataTableFixedChildrenIterator);
+ }
+
+ /**
+ * Test method for {@link
org.richfaces.component.UIDataTableBase#createExtendedDataModel()}.
+ */
+ @Test
+ public void testCreateExtendedDataModel() {
+ Assert.assertFalse(table.createExtendedDataModel() instanceof Arrangeable);
+ List<String> sortPriority = Arrays.asList("id2", "id0",
"id1");
+ List<UIComponent> children = table.getChildren();
+ ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
+ ELContext elContext = facesContext.getELContext();
+ UIColumn column = new UIColumn();
+ column.setRendered(false);
+ children.add(column);
+ for (int i = 0; i < sortPriority.size(); i++) {
+ UIColumn child = new UIColumn();
+ child.setId("id" + i);
+ child.setValueExpression("filterExpression", expressionFactory
+ .createValueExpression(elContext, "#{'id" + i +
"'}", Object.class));
+ child.setValueExpression("sortBy", expressionFactory
+ .createValueExpression(elContext, "#{'id" + i +
"'}", Object.class));
+ child.setSortOrder(SortOrder.ascending);
+ children.add(child);
+ }
+ Assert.assertTrue(table.createExtendedDataModel() instanceof Arrangeable);
+ MockArrangeableModel model = new MockArrangeableModel();
+ table.setValue(model);
+ table.setSortPriority(sortPriority);
+ Assert.assertSame(model, table.createExtendedDataModel());
+ ArrangeableState state = model.getState();
+ List<FilterField> filterFields = state.getFilterFields();
+ for (int i = 0; i < sortPriority.size(); i++) {
+ Assert.assertEquals("id" + i ,
filterFields.get(i).getFilterExpression().getValue(elContext));
+ }
+ List<SortField> sortFields = state.getSortFields();
+ for (int i = 0; i < sortPriority.size(); i++) {
+ Assert.assertEquals(sortPriority.get(i),
sortFields.get(i).getSortBy().getValue(elContext));
+ }
+ Assert.assertEquals(facesContext.getViewRoot().getLocale(), state.getLocale());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#columns()}.
+ */
+ @Test
+ public void testColumns() {
+ Assert.assertTrue(table.columns() instanceof DataTableColumnsIterator);
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getHeader()}.
+ */
+ @Test
+ public void testGetHeader() {
+ UIOutput component = new UIOutput();
+ table.getFacets().put("header", component);
+ Assert.assertSame(component, table.getHeader());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getFooter()}.
+ */
+ @Test
+ public void testGetFooter() {
+ UIOutput component = new UIOutput();
+ table.getFacets().put("footer", component);
+ Assert.assertSame(component, table.getFooter());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getFilterVar()}
and
+ * {@link org.richfaces.component.UIDataTableBase#setFilterVar(java.lang.String)}.
+ */
+ @Test
+ public void testFilterVar() {
+ String string = "fv";
+ table.setFilterVar(string);
+ Assert.assertEquals(string, table.getFilterVar());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getSortPriority()}
and
+ * {@link
org.richfaces.component.UIDataTableBase#setSortPriority(java.util.Collection)}.
+ */
+ @Test
+ public void testSortPriority() {
+ table.setSortPriority(Collections.EMPTY_LIST);
+ Assert.assertEquals(Collections.EMPTY_LIST, table.getSortPriority());
+ }
+
+ /**
+ * Test method for {@link org.richfaces.component.UIDataTableBase#getSortMode()} and
+ * {@link
org.richfaces.component.UIDataTableBase#setSortMode(org.richfaces.model.SortMode)}.
+ */
+ @Test
+ public void testSortMode() {
+ table.setSortMode(SortMode.multi);
+ Assert.assertEquals(SortMode.multi, table.getSortMode());
+ }
+
+ /**
+ * Test method for {@link
org.richfaces.component.UIDataTableBase#isColumnFacetPresent(java.lang.String)}.
+ */
+ @Test
+ public void testIsColumnFacetPresent() {
+ String facetName = "header";
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ UIColumn child = new UIColumn();
+ List<UIComponent> children = table.getChildren();
+ children.add(new UIColumn());
+ children.add(child);
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ child.getFacets().put(facetName, new UIOutput());
+ Assert.assertTrue(table.isColumnFacetPresent(facetName));
+ child.setRendered(false);
+ Assert.assertFalse(table.isColumnFacetPresent(facetName));
+ }
+}
Modified:
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataGridRendererTest.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -15,7 +15,6 @@
import org.junit.Before;
import org.junit.Test;
import org.richfaces.component.AbstractDataGrid;
-import org.richfaces.component.UIDataGrid;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
Copied:
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java
(from rev 19108,
trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java)
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java
(rev 0)
+++
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerBean.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,37 @@
+package org.richfaces.renderkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DataScrollerBean {
+
+ private List<String> content;
+
+ private int pageNumber = 1;
+
+
+ public DataScrollerBean() {
+ content = new ArrayList<String>();
+ content.add("1 page content");
+ content.add("2 page content");
+ content.add("3 page content");
+ content.add("4 page content");
+ content.add("5 page content");
+ }
+
+ public List<String> getContent() {
+ return content;
+ }
+
+ public void setContent(List<String> content) {
+ this.content = content;
+ }
+
+ public int getPageNumber() {
+ return pageNumber;
+ }
+
+ public void setPageNumber(int pageNumber) {
+ this.pageNumber = pageNumber;
+ }
+}
Copied:
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
(from rev 19108,
trunk/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java)
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java
(rev 0)
+++
branches/RF-7944/ui/iteration/ui/src/test/java/org/richfaces/renderkit/DataScrollerRenderTest.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,582 @@
+package org.richfaces.renderkit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.List;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.html.DomNode;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class DataScrollerRenderTest {
+
+ private HtmlUnitEnvironment environment;
+
+ @Before
+ public void setUp() {
+ environment = new HtmlUnitEnvironment();
+ environment.withWebRoot(new File("src/test/resources"));
+ environment.withResource("/WEB-INF/faces-config.xml",
"org/richfaces/renderkit/faces-config.xml");
+ environment.withResource("/test.xhtml",
"org/richfaces/renderkit/dataTableTest.xhtml");
+ environment.start();
+ }
+
+ @Test
+ public void testEncoding() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+
+ String scrollerId = "scroller1";
+ //first scroll
+ List<?> nodes = page.getByXPath("//*[@id =
'form:scroller1']");
+
+ assertEquals(1, nodes.size());
+ HtmlElement span = (HtmlElement) nodes.get(0);
+ assertEquals("span", span.getNodeName());
+ assertEquals("rf-ds", span.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // first/fastRewind/previous buttons with arrows
+ HtmlElement first = getFirstButton(page, scrollerId);
+ assertEquals("span", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ HtmlElement fastRewind = getFastRewindButton(page, scrollerId);
+ assertEquals("span", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ HtmlElement previous = getPreviousButton(page, scrollerId);
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // currently selected digital button
+ HtmlElement dc1 = getDigitalButton(page, scrollerId, 1);
+ assertEquals("span", dc1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
dc1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // digital buttons
+ HtmlElement d2 = getDigitalButton(page, scrollerId, 2);
+ assertEquals("a", d2.getNodeName());
+ assertEquals("rf-ds-dtl",
d2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d2.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement d3 = getDigitalButton(page, scrollerId, 3);
+ assertEquals("a", d3.getNodeName());
+ assertEquals("rf-ds-dtl",
d3.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d3.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement d4 = getDigitalButton(page, scrollerId, 4);
+ assertEquals("a", d4.getNodeName());
+ assertEquals("rf-ds-dtl",
d4.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d4.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement d5 = getDigitalButton(page, scrollerId, 5);
+ assertEquals("a", d5.getNodeName());
+ assertEquals("rf-ds-dtl",
d5.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);", d5.getAttribute(HTML.HREF_ATTR));
+
+ // next/fastForward/last buttons with arrows
+ HtmlElement next = getNextButton(page, scrollerId);
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);",
next.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement fastForward = getFastForwardButton(page, scrollerId);
+ assertEquals("a", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);",
fastForward.getAttribute(HTML.HREF_ATTR));
+
+ HtmlElement last = getLastButton(page, scrollerId);
+ assertEquals("a", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ assertEquals("javascript:void(0);",
last.getAttribute(HTML.HREF_ATTR));
+ }
+
+ @Test
+ public void testOutDataScrollerFirstLastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ HtmlElement last = getLastButton(page, firstScrollerId);
+ last.click();
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ HtmlElement first = getFirstButton(page, firstScrollerId);
+ first.click();
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerFirstLastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ HtmlElement last = getLastButton(page, secondScrollerId);
+ last.click();
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ HtmlElement first = getFirstButton(page, secondScrollerId);
+ first.click();
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testOutDataScrollerNextPreviousButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement next = getNextButton(page, firstScrollerId);
+
+ next.click();
+
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
+ previous.click();
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerNextPreviousButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement next = getNextButton(page, secondScrollerId);
+ next.click();
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller outside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement previous = getPreviousButton(page, secondScrollerId);
+ previous.click();
+
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testOutDataScrollerFastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 3; i <= 5; i = i + 2) {
+ HtmlElement ff = getFastForwardButton(page, firstScrollerId);
+
+ ff.click();
+
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 3; i >= 1; i = i - 2) {
+ HtmlElement fr = getFastRewindButton(page, firstScrollerId);
+ fr.click();
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerFastButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 3; i <= 5; i = i + 2) {
+ HtmlElement ff = getFastForwardButton(page, secondScrollerId);
+ ff.click();
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller outside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 3; i >= 1; i = i - 2) {
+ HtmlElement fr = getFastRewindButton(page, secondScrollerId);
+ fr.click();
+
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testOutDataScrollerDigitalButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ currentDigital1.click();
+
+ currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ currentDigital1.click();
+
+ currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @Test
+ public void testInnerDataScrollerDigitalButtons() throws Exception {
+ HtmlPage page = environment.getPage("/test.jsf");
+ String firstScrollerId = "scroller1";
+
+ //dataScroller inside dataTable 'footer' facet
+ String secondScrollerId = "richTable:scroller2";
+
+ for(int i = 2; i <= 5; i++) {
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ currentDigital2.click();
+
+ currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller outside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkLastPageButtons(page, firstScrollerId, secondScrollerId);
+
+ //scroll back
+ for(int i = 4; i >= 1; i--) {
+ HtmlElement currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ currentDigital2.click();
+
+ currentDigital2 = getDigitalButton(page, secondScrollerId, i);
+ assertEquals("span", currentDigital2.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital2.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // if scroller inside dataTable has switched
+ HtmlElement currentDigital1 = getDigitalButton(page, firstScrollerId, i);
+ assertEquals("span", currentDigital1.getNodeName());
+ assertEquals("rf-ds-dtl rf-ds-cur",
currentDigital1.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ // check if page has switched
+ assertEquals(i + " page content", getCurrentPageContent(page, i));
+ }
+
+ checkFirstPageButtons(page, firstScrollerId, secondScrollerId);
+ }
+
+ @After
+ public void tearDown() {
+ environment.release();
+ environment = null;
+ }
+
+ private void checkFirstPageButtons(HtmlPage page, String firstScrollerId, String
secondScrollerId) throws Exception {
+ HtmlElement fastForward = getFastForwardButton(page, firstScrollerId);
+ HtmlElement last = getLastButton(page, firstScrollerId);
+ HtmlElement next = getNextButton(page, firstScrollerId);
+
+ //check right buttons
+ assertEquals("a", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ fastForward = getFastForwardButton(page, secondScrollerId);
+ last = getFastForwardButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
+
+ assertEquals("a", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r",
next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ //check if left buttons is disabled
+ HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
+ HtmlElement first = getFirstButton(page, firstScrollerId);
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
+
+ assertEquals("span", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ fastRewind = getFastRewindButton(page, secondScrollerId);
+ first = getFirstButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
+
+ assertEquals("span", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l rf-ds-dis",
previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ }
+
+ private void checkLastPageButtons(HtmlPage page, String firstScrollerId, String
secondScrollerId) throws Exception {
+ //check if right buttons is disabled
+ HtmlElement fastForward = getFastForwardButton(page, firstScrollerId);
+ HtmlElement last = getLastButton(page, firstScrollerId);
+ HtmlElement next = getNextButton(page, firstScrollerId);
+
+ assertEquals("span", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis",
fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis",
last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis",
next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+
+ fastForward = getFastForwardButton(page, secondScrollerId);
+ last = getFastForwardButton(page, secondScrollerId);
+ next = getNextButton(page, secondScrollerId);
+
+ assertEquals("span", fastForward.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis",
fastForward.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", last.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis",
last.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("span", next.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-r rf-ds-dis",
next.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ //check if left buttons is enabled
+ HtmlElement fastRewind = getFastRewindButton(page, firstScrollerId);
+ HtmlElement first = getFirstButton(page, firstScrollerId);
+ HtmlElement previous = getPreviousButton(page, firstScrollerId);
+
+ assertEquals("a", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l",
fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l",
first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l",
previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ fastRewind = getFastRewindButton(page, secondScrollerId);
+ first = getFirstButton(page, secondScrollerId);
+ previous = getPreviousButton(page, secondScrollerId);
+
+ assertEquals("a", fastRewind.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l",
fastRewind.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", first.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l",
first.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+
+ assertEquals("a", previous.getNodeName());
+ assertEquals("rf-ds-btn rf-ds-l",
previous.getAttribute(HTML.CLASS_ATTRIBUTE).trim());
+ }
+
+ private String getCurrentPageContent(HtmlPage page, int i) throws Exception {
+ HtmlElement content = page.getFirstByXPath("//*[@id =
'form:richTable:" + (--i) + ":pageContent']");
+ DomNode text = content.getFirstChild();
+ assertEquals(DomNode.TEXT_NODE, text.getNodeType());
+ return text.getNodeValue();
+ }
+
+ private HtmlElement getPreviousButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId
+"_ds_prev']");
+ }
+
+ private HtmlElement getNextButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId
+"_ds_next']");
+ }
+
+ private HtmlElement getFastRewindButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId
+"_ds_fr']");
+ }
+
+ private HtmlElement getFirstButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId
+"_ds_f']");
+ }
+
+ private HtmlElement getFastForwardButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId
+"_ds_ff']");
+ }
+
+ private HtmlElement getLastButton(HtmlPage page, String scrollerId) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId
+"_ds_l']");
+ }
+
+ private HtmlElement getDigitalButton(HtmlPage page, String scrollerId, int i) {
+ return page.getFirstByXPath("//*[@id = 'form:" + scrollerId +
"_ds_" + i +"']");
+ }
+
+}
Copied:
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml
(from rev 19108,
trunk/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml)
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml
(rev 0)
+++
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/dataTableTest.xhtml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,29 @@
+<!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:it="http://richfaces.org/iteration">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces List</title>
+</h:head>
+
+<h:body>
+ <h:form id="form">
+
+ <it:dataScroller fastStep="2" id="scroller1"
for="richTable" page="#{dataScrollerBean.pageNumber}"
maxPages="5"></it:dataScroller>
+ <it:dataTable id="richTable" rowKeyVar="rowKey"
var="content" value="#{dataScrollerBean.content}"
rows="1">
+ <it:column>
+ <h:panelGroup id="pageContent">
+ <h:outputText value="#{content}"/>
+ </h:panelGroup>
+ </it:column>
+ <f:facet name="footer">
+ <it:dataScroller fastStep="2" id="scroller2"
for="richTable" page="#{dataScrollerBean.pageNumber}"
maxPages="5"></it:dataScroller>
+ </f:facet>
+ </it:dataTable>
+ </h:form>
+</h:body>
+</html>
Modified:
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml
===================================================================
---
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/iteration/ui/src/test/resources/org/richfaces/renderkit/faces-config.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -10,5 +10,11 @@
<managed-bean-class>org.richfaces.renderkit.DataBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
-
+
+ <managed-bean>
+ <managed-bean-name>dataScrollerBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.renderkit.DataScrollerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
</faces-config>
\ No newline at end of file
Copied:
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
(from rev 19108,
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java)
===================================================================
---
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java
(rev 0)
+++
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandEvent.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class ChangeExpandEvent extends FacesEvent {
+
+ private final Boolean isExpanded;
+
+
+ // ------------------------------------------------------------ Constructors
+
+ /**
+ * <p>Construct a new event object from the specified source component,
+ * old value, and new value.</p>
+ *
+ * <p>The default {@link javax.faces.event.PhaseId} for this event is {@link
+ * javax.faces.event.PhaseId#ANY_PHASE}.</p>
+ *
+ * @param component Source {@link UIComponent} for this event
+ * @param isExpanded
+ *
+ * @throws IllegalArgumentException if <code>component</code> is
+ * <code>null</code>
+ */
+ public ChangeExpandEvent(UIComponent component, Boolean isExpanded) {
+ super(component);
+ this.isExpanded = isExpanded;
+ }
+
+
+ // -------------------------------------------------------------- Properties
+
+ public Boolean getExpanded() {
+ return isExpanded;
+ }
+
+ // ------------------------------------------------- Event Broadcast Methods
+
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ChangeExpandListener;
+ }
+
+ /**
+ * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ ((ChangeExpandListener) listener).processChangeExpand(this);
+ }
+}
+
Copied:
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
(from rev 19108,
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java)
===================================================================
---
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java
(rev 0)
+++
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandListener.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.event;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p>A listener interface for receiving {@link ChangeExpandEvent}s. A class
+ * that is interested in receiving such events implements this interface, and
+ * then registers itself with the source {@link javax.faces.component.UIComponent} of
interest, by
+ * calling <code>addChangeExpandListener()</code>.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since 2010-08-27
+ *
+ */
+public interface ChangeExpandListener extends FacesListener {
+
+
+ /**
+ * <p>Invoked when {@link ChangeExpandEvent} occurs.</p>
+ *
+ * @param event The {@link ChangeExpandEvent} that has occurred
+ *
+ * @throws AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ */
+ public void processChangeExpand(ChangeExpandEvent event)
+ throws AbortProcessingException;
+
+}
Copied:
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
(from rev 19108,
trunk/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java)
===================================================================
---
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java
(rev 0)
+++
branches/RF-7944/ui/output/api/src/main/java/org/richfaces/event/ChangeExpandSource.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.event;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public interface ChangeExpandSource {
+
+ /**
+ * <p>Add a new {@link org.richfaces.event.ChangeExpandListener} to the set of
listeners
+ * interested in being notified when {@link org.richfaces.event.ChangeExpandEvent}s
occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be added
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void addChangeExpandListener(ChangeExpandListener listener);
+
+ /**
+ * <p>Return the set of registered {@link
org.richfaces.event.ChangeExpandListener}s for this instance.
+ * If there are no registered listeners, a zero-length array is returned.</p>
+ */
+ ChangeExpandListener[] getChangeExpandListeners();
+
+ /**
+ * <p>Remove an existing {@link org.richfaces.event.ChangeExpandListener} (if
any) from the
+ * set of listeners interested in being notified when
+ * {@link org.richfaces.event.ChangeExpandEvent}s occur.</p>
+ *
+ * @param listener The {@link org.richfaces.event.ChangeExpandListener} to be
removed
+ * @throws NullPointerException if <code>listener</code>
+ * is <code>null</code>
+ */
+ void removeChangeExpandListener(ChangeExpandListener listener);
+
+}
Copied:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
(from rev 19108,
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+import org.richfaces.event.ItemChangeEvent;
+
+import javax.el.MethodExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public abstract class AbstractCollapsiblePanel extends UITogglePanel implements
ChangeExpandSource {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.CollapsiblePanel";
+
+ public enum States {
+ expanded("exp"),
+ collapsed("colps");
+
+ private final String abbreviation;
+
+ States(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
+ }
+
+ protected AbstractCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public String getActiveItem() {
+ String ai = super.getActiveItem();
+ return ai == null ? "true" : ai;
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid) {
+ return isExpanded();
+ }
+
+ @Override
+ protected boolean isActiveItem(UIComponent kid, String value) {
+ return isExpanded();
+ }
+
+
+ public boolean isExpanded() {
+ return Boolean.parseBoolean(getActiveItem());
+ }
+
+ public void setExpanded(boolean isExpanded) {
+ setActiveItem(String.valueOf(isExpanded));
+ }
+
+ public abstract String getHeader();
+
+ public abstract MethodExpression getChangeExpandListener();
+
+ @Override
+ public void queueEvent(FacesEvent facesEvent) {
+ ChangeExpandEvent event = null;
+ if ((facesEvent instanceof ItemChangeEvent) && (facesEvent.getComponent()
== this)) {
+ event = new ChangeExpandEvent(this, Boolean.valueOf(((ItemChangeEvent)
facesEvent).getNewItem()));
+
+ setEventPhase(event);
+ }
+
+ super.queueEvent(event != null ? event : facesEvent);
+ }
+
+ // ------------------------------------------------ Event Processing Methods
+
+ public void addChangeExpandListener(ChangeExpandListener listener) {
+ addFacesListener(listener);
+ }
+
+ public ChangeExpandListener[] getChangeExpandListeners() {
+ return (ChangeExpandListener[]) getFacesListeners(ChangeExpandListener.class);
+ }
+
+ public void removeChangeExpandListener(ChangeExpandListener listener) {
+ removeFacesListener(listener);
+ }
+}
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -27,7 +27,6 @@
/**
* @author akolonitsky
* @version 1.0
- * @since -4712-01-01
*
*/
public abstract class AbstractDivPanel extends UIOutput {
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -56,6 +56,11 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
+ public static final String META_NAME_FIRST = "@first";
+ public static final String META_NAME_PREV = "@prev";
+ public static final String META_NAME_NEXT = "@next";
+ public static final String META_NAME_LAST = "@last";
+
// TODO What is MessageId ?
public static final String UPDATE_MESSAGE_ID =
"javax.faces.component.UIInput.UPDATE";
@@ -370,7 +375,7 @@
String previous = (String) getValue();
setValue(activeItem);
setSubmittedActiveItem(null);
- if (!previous.equalsIgnoreCase(activeItem)) {
+ if (previous != null && !previous.equalsIgnoreCase(activeItem)) {
queueEvent(new ItemChangeEvent(this, previous, activeItem));
}
}
@@ -378,18 +383,23 @@
@Override
public void queueEvent(FacesEvent event) {
if ((event instanceof ItemChangeEvent) && (event.getComponent() == this))
{
- if (isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else if (isBypassUpdates()) {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- } else {
- event.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
+ setEventPhase(event);
}
super.queueEvent(event);
}
+ protected void setEventPhase(FacesEvent event) {
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else if (isBypassUpdates()) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+
+
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
@@ -423,7 +433,7 @@
return isActiveItem(kid, getActiveItemValue());
}
- protected static boolean isActiveItem(UIComponent kid, String value) {
+ protected boolean isActiveItem(UIComponent kid, String value) {
if (kid == null || value == null) {
return false;
}
@@ -467,13 +477,13 @@
}
public AbstractTogglePanelItem getItem(String name) {
- if ("(a)first".equals(name)) {
+ if (META_NAME_FIRST.equals(name)) {
return getFirstItem();
- } else if ("(a)prev".equals(name)) {
+ } else if (META_NAME_PREV.equals(name)) {
return getPrevItem();
- } else if ("(a)next".equals(name)) {
+ } else if (META_NAME_NEXT.equals(name)) {
return getNextItem();
- } else if ("(a)last".equals(name)) {
+ } else if (META_NAME_LAST.equals(name)) {
return getLastItem();
} else {
return getItemByIndex(getChildIndex(name));
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -28,6 +28,7 @@
import javax.faces.context.FacesContext;
import javax.faces.render.Renderer;
import java.io.IOException;
+import java.util.Map;
/**
* @author akolonitsky
@@ -94,8 +95,9 @@
}
protected static void hidePanelItem(UIComponent item) {
- //TODO nick - attributes shouldn't be overwritten
- item.getAttributes().put(RendererUtils.HTML.STYLE_ATTRIBUTE,
"display:none");
+ Map<String,Object> attrs = item.getAttributes();
+ Object style = attrs.get(RendererUtils.HTML.STYLE_ATTRIBUTE);
+ attrs.put(RendererUtils.HTML.STYLE_ATTRIBUTE, "display:none; " +
style);
}
public abstract String getName();
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -22,6 +22,8 @@
package org.richfaces.component;
+import org.richfaces.renderkit.html.DivPanelRenderer;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
@@ -36,6 +38,22 @@
public static final String COMPONENT_FAMILY =
"org.richfaces.TogglePanelTitledItem";
+ public enum HeaderStates {
+ active("act"),
+ inactive("inact"),
+ disable("dis");
+
+ private final String abbreviation;
+
+ HeaderStates(String abbreviation) {
+ this.abbreviation = abbreviation;
+ }
+
+ public String abbreviation() {
+ return abbreviation;
+ }
+ }
+
protected AbstractTogglePanelTitledItem() {
setRendererType("org.richfaces.TogglePanelTitledItem");
}
@@ -61,14 +79,32 @@
}
encodeBegin(context);
- if (getRendersChildren()) {
- encodeChildren(context);
- } else if (this.getChildCount() > 0) {
- for (UIComponent kid : getChildren()) {
- kid.encodeAll(context);
+ if (!isDisabled()) {
+ if (getRendersChildren()) {
+ encodeChildren(context);
+ } else if (this.getChildCount() > 0) {
+ for (UIComponent kid : getChildren()) {
+ kid.encodeAll(context);
+ }
}
}
-
+
encodeEnd(context);
}
+
+ public UIComponent getHeaderFacet(Enum<?> state) {
+ return getHeaderFacet(this, state);
+ }
+
+ public static UIComponent getHeaderFacet(UIComponent component, Enum<?> state)
{
+ UIComponent headerFacet = null;
+ if (state != null) {
+ headerFacet = component.getFacet("header" +
DivPanelRenderer.capitalize(state.toString()));
+ }
+
+ if (headerFacet == null) {
+ headerFacet = component.getFacet("header");
+ }
+ return headerFacet;
+ }
}
Copied:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
(from rev 19108,
trunk/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UICollapsiblePanel.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.component;
+
+import javax.el.MethodExpression;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class UICollapsiblePanel extends AbstractCollapsiblePanel {
+
+ public enum PropertyKeys {
+ header,
+ changeExpandListener
+ }
+
+ public String getHeader() {
+ return (String) getStateHelper().eval(PropertyKeys.header);
+ }
+
+ public void setHeader(String header) {
+ getStateHelper().put(PropertyKeys.header, header);
+ }
+
+ public MethodExpression getChangeExpandListener() {
+ return (MethodExpression)
getStateHelper().get(PropertyKeys.changeExpandListener);
+ }
+
+ public void setChangeExpandListener(MethodExpression changeExpandListener) {
+ getStateHelper().put(PropertyKeys.changeExpandListener, changeExpandListener);
+ }
+}
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -36,7 +36,7 @@
}
public String getName() {
- return (String) getStateHelper().eval(PropertyKeys.name);
+ return (String) getStateHelper().eval(PropertyKeys.name, getId());
}
public void setName(String name) {
@@ -50,6 +50,4 @@
public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
-
-
}
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -54,7 +54,7 @@
}
public String getTargetItem() {
- return (String) getStateHelper().eval(PropertyKeys.targetItem);
+ return (String) getStateHelper().eval(PropertyKeys.targetItem,
AbstractTogglePanel.META_NAME_NEXT);
}
public void setTargetItem(String target) {
Copied:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
(from rev 19108,
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlCollapsiblePanel.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,245 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.component.UICollapsiblePanel;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class HtmlCollapsiblePanel extends UICollapsiblePanel implements
ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.CollapsiblePanel";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.CollapsiblePanel";
+
+ private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
+ "switch",
+ "beforeswitch",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ bodyClass,
+ headerClass,
+ headerControlClass,
+ oncomplete,
+ onbeforedomupdate,
+ onswitch,
+ onbeforeswitch,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlCollapsiblePanel() {
+ setRendererType("org.richfaces.CollapsiblePanel");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getBodyClass() {
+ return (String) getStateHelper().eval(PropertyKeys.bodyClass);
+ }
+
+ public void setBodyClass(String bodyClass) {
+ getStateHelper().put(PropertyKeys.bodyClass, bodyClass);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getHeaderControlClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerControlClass);
+ }
+
+ public void setHeaderControlClass(String headerControlClass) {
+ getStateHelper().put(PropertyKeys.headerControlClass, headerControlClass);
+ }
+
+ public String getOncomplete() {
+ return (String) getStateHelper().eval(PropertyKeys.oncomplete);
+ }
+
+ public void setOncomplete(String oncomplete) {
+ getStateHelper().put(PropertyKeys.oncomplete, oncomplete);
+ }
+
+ public String getOnbeforedomupdate() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforedomupdate);
+ }
+
+ public void setOnbeforedomupdate(String onbeforedomupdate) {
+ getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
+ }
+
+ public String getOnswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onswitch);
+ }
+
+ public void setOnswitch(String onswitch) {
+ getStateHelper().put(PropertyKeys.onswitch, onswitch);
+ }
+
+ public String getOnbeforeswitch() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeswitch);
+ }
+
+ public void setOnbeforeswitch(String onbeforeswitch) {
+ getStateHelper().put(PropertyKeys.onbeforeswitch, onbeforeswitch);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Copied:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java
(from rev 19108,
trunk/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionChangeExpandListener.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.event;
+
+import javax.el.MethodExpression;
+import javax.faces.event.AbortProcessingException;
+
+/**
+ * <p><strong><span
+ *
class="changed_modified_2_0">MethodExpressionChangeExpandListener</span></strong>
+ * is a {@link ChangeExpandListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link ChangeExpandEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ *
+ */
+public class MethodExpressionChangeExpandListener extends MethodExpressionEventListener
implements ChangeExpandListener {
+
+ public MethodExpressionChangeExpandListener() {
+ super();
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg) {
+ super(methodExprOneArg);
+ }
+
+ public MethodExpressionChangeExpandListener(MethodExpression methodExprOneArg,
MethodExpression methodExprZeroArg) {
+ super(methodExprOneArg, methodExprZeroArg);
+ }
+
+ // ------------------------------------------------------- Listener Method
+
+ public void processChangeExpand(ChangeExpandEvent changeExpandEvent) throws
AbortProcessingException {
+ processEvent(changeExpandEvent);
+ }
+}
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -22,13 +22,7 @@
package org.richfaces.event;
-import javax.el.ELContext;
-import javax.el.ELException;
import javax.el.MethodExpression;
-import javax.el.MethodNotFoundException;
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
/**
@@ -44,158 +38,23 @@
* @since -4712-01-01
*
*/
-//TODO nick - good candidate for utility class
-public class MethodExpressionItemChangeListener implements ItemChangeListener,
StateHolder {
+public class MethodExpressionItemChangeListener extends MethodExpressionEventListener
implements ItemChangeListener {
- private static final Class<?>[] ITEM_CHANGE_LISTENER_ZERO_ARG_SIG = new Class[]
{};
-
- private static final Object[] NO_PARAMS = new Object[0];
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
public MethodExpressionItemChangeListener() {
}
- /**
- * <p><span class="changed_modified_2_0">Construct</span>
a {@link
- * ItemChangeListener} that contains a {@link
- * MethodExpression}.<span
- * class="changed_added_2_0">To accomodate method expression targets
- * that take no arguments instead of taking a {@link
- * ItemChangeEvent} argument</span>, the implementation of this
- * class must take the argument <code>methodExpressionOneArg</code>,
- * extract its expression string, and create another
- * <code>MethodExpression</code> whose expected param types match
- * those of a zero argument method. The usage requirements for both
- * of these <code>MethodExpression</code> instances are described in
- * {@link #processItemChange}.</p>
- *
- * @param methodExpressionOneArg a <code>MethodExpression</code>
- * that points to a method that returns <code>void</code> and takes
- * a single argument of type {@link ItemChangeEvent}.
- */
- public MethodExpressionItemChangeListener(MethodExpression methodExpressionOneArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- this.methodExpressionZeroArg = context.getApplication().
- getExpressionFactory().createMethodExpression(elContext,
- methodExpressionOneArg.getExpressionString(), Void.class,
- ITEM_CHANGE_LISTENER_ZERO_ARG_SIG);
+ public MethodExpressionItemChangeListener(MethodExpression methodExprOneArg) {
+ super(methodExprOneArg);
}
- /**
- * <p>Construct a {@link ItemChangeListener} that contains a {@link
MethodExpression}.</p>
- *
- * @param methodExpressionOneArg
- * @param methodExpressionZeroArg
- */
- public MethodExpressionItemChangeListener(MethodExpression methodExpressionOneArg,
- MethodExpression methodExpressionZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- this.methodExpressionZeroArg = methodExpressionZeroArg;
+ public MethodExpressionItemChangeListener(MethodExpression methodExprOneArg,
MethodExpression methodExprZeroArg) {
+ super(methodExprOneArg, methodExprZeroArg);
}
- // ------------------------------------------------------- Event Method
+ // ------------------------------------------------------- Listener Method
- /**
- * <p><span class="changed_modified_2_0">Call</span>
through to the
- * {@link MethodExpression} passed in our constructor. <span
- * class="changed_added_2_0">First, try to invoke the
- * <code>MethodExpression</code> passed to the constructor of this
- * instance, passing the argument {@link ItemChangeEvent} as the
- * argument. If a {@link MethodNotFoundException} is thrown, call
- * to the zero argument <code>MethodExpression</code> derived from
- * the <code>MethodExpression</code> passed to the constructor of
- * this instance. If that fails for any reason, throw an {@link
- * AbortProcessingException}, including the cause of the
- * failure.</span></p>
- *
- * @throws NullPointerException {@inheritDoc}
- * @throws AbortProcessingException {@inheritDoc}
- */
public void processItemChange(ItemChangeEvent itemChangeEvent) throws
AbortProcessingException {
-
- if (itemChangeEvent == null) {
- throw new NullPointerException();
- }
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- // PENDING: The corresponding code in MethodExpressionActionListener
- // has an elaborate message capture, logging, and rethrowing block.
- // Why not here?
- try {
- methodExpressionOneArg.invoke(elContext, new Object[] {itemChangeEvent});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
- }
- } catch (ELException e) {
- throw new AbortProcessingException(e.getMessage(), e.getCause());
- }
+ processEvent(itemChangeEvent);
}
-
-
- // ------------------------------------------------ Methods from StateHolder
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be saved.</p>
- */
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- return new Object[] {
- UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
- UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
- };
- }
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be restored.</p>
- */
- public void restoreState(FacesContext context, Object state) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- if (state == null) {
- return;
- }
-
- methodExpressionOneArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[0]);
- methodExpressionZeroArg = (MethodExpression) UIComponentBase
- .restoreAttachedState(context, ((Object[]) state)[1]);
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
}
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -24,8 +24,8 @@
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.renderkit.RendererUtils;
-import org.richfaces.component.AbstractTogglePanelItem;
import org.richfaces.component.AbstractTogglePanelTitledItem;
+import org.richfaces.renderkit.RenderKitUtils;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
@@ -33,16 +33,22 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
+import java.util.Map;
+import static org.richfaces.component.AbstractTogglePanelTitledItem.HeaderStates;
+import static org.richfaces.component.html.HtmlAccordionItem.PropertyKeys;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+
/**
*
- * <div id="clientId" class="rf-aci">
- * <div id="clientId:header" class="rf-aci-h">
- * <div class="rf-aci-h-inactive">Level 1</div>
- * <div class="rf-aci-h-active" >Level 1</div>
- * <div class="rf-aci-h-disabled">Level 1</div>
+ * <div id="clientId" class="rf-ac-itm">
+ * <div id="clientId:header" class="rf-ac-itm-hdr">
+ * <div class="rf-ac-itm-hdr-inact">Level 1</div>
+ * <div class="rf-ac-itm-hdr-act" >Level 1</div>
+ * <div class="rf-ac-itm-hdr-dis">Level 1</div>
* </div>
- * <div id="clientId:content" class="rf-aci-c">
+ * <div id="clientId:content" class="rf-ac-itm-cnt">
* Content will be here.
* </div>
* </div>
@@ -50,7 +56,7 @@
* @author akolonitsky
* @since 2010-08-05
*/
-@ResourceDependencies({ // TODO review
+@ResourceDependencies({
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
@@ -61,6 +67,14 @@
})
public class AccordionItemRenderer extends TogglePanelItemRenderer {
+ private static final RenderKitUtils.Attributes HEADER_ATTRIBUTES =
RenderKitUtils.attributes()
+ .generic("style", PropertyKeys.headerStyle.toString())
+ .generic("onclick", PropertyKeys.onheaderclick.toString(),
"headerclick")
+ .generic("ondblclick", PropertyKeys.onheaderdblclick.toString(),
"headerdblclick")
+ .generic("onmousedown", PropertyKeys.onheadermousedown.toString(),
"headermousedown")
+ .generic("onmousemove", PropertyKeys.onheadermousemove.toString(),
"headermousemove")
+ .generic("onmouseup", PropertyKeys.onheadermouseup.toString(),
"headermouseup");
+
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
super.doEncodeBegin(writer, context, component);
@@ -72,35 +86,36 @@
@Override
protected String getStyleClass(UIComponent component) {
- return "rf-aci " + attributeAsString(component,
"styleClass");
+ return concatClasses("rf-ac-itm", attributeAsString(component,
"styleClass"));
}
@Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
encodeContentEnd(component, writer);
- super.doEncodeEnd(writer, context, component); //To change body of overridden
methods use File | Settings | File Templates.
+ super.doEncodeEnd(writer, context, component);
}
@Override
protected void writeJavaScript(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
- // todo how to call method from parent of parent class?
-
Object script = getScriptObject(context, component);
- if (script != null) {
- writer.startElement(RendererUtils.HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(RendererUtils.HTML.TYPE_ATTR,
"text/javascript", "type");
- writer.writeText(script, null);
- writer.endElement(RendererUtils.HTML.SCRIPT_ELEM);
+ if (script == null) {
+ return;
}
+
+ writer.startElement(RendererUtils.HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(RendererUtils.HTML.TYPE_ATTR, "text/javascript",
"type");
+ writer.writeText(script, null);
+ writer.endElement(RendererUtils.HTML.SCRIPT_ELEM);
}
private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws
IOException {
writer.startElement("div", component);
- writer.writeAttribute("class", "rf-aci-c " +
attributeAsString(component, "contentClass"), null);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-cnt",
attributeAsString(component, "contentClass")), null);
writer.writeAttribute("id", component.getClientId() +
":content", null);
- if (!((AbstractTogglePanelItem) component).isActive()) {
+ AbstractTogglePanelTitledItem item = (AbstractTogglePanelTitledItem) component;
+ if (!item.isActive() || item.isDisabled()) {
writer.writeAttribute("style", "display: none", null);
}
}
@@ -109,24 +124,25 @@
responseWriter.endElement("div");
}
- private void encodeHeader(FacesContext facesContext, UIComponent component,
ResponseWriter responseWriter) throws IOException {
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter
writer) throws IOException {
- responseWriter.startElement("div", component);
- responseWriter.writeAttribute("class", "rf-aci-h " +
attributeAsString(component, "contentClass"), null);
- responseWriter.writeAttribute("id", component.getClientId() +
":header", null);
+ writer.startElement("div", component);
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr",
attributeAsString(component, PropertyKeys.headerClass)), null);
+ writer.writeAttribute("id", component.getClientId() +
":header", null);
+ renderPassThroughAttributes(context, component, HEADER_ATTRIBUTES);
AbstractTogglePanelTitledItem titledItem = (AbstractTogglePanelTitledItem)
component;
boolean isActive = titledItem.isActive();
boolean isDisabled = titledItem.isDisabled();
- encodeHeader(facesContext, component, responseWriter, "inactive",
!isActive && !isDisabled);
- encodeHeader(facesContext, component, responseWriter, "active",
isActive && !isDisabled);
- encodeHeader(facesContext, component, responseWriter, "disable",
isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.inactive, !isActive
&& !isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.active, isActive
&& !isDisabled);
+ encodeHeader(context, titledItem, writer, HeaderStates.disable, isDisabled);
- responseWriter.endElement("div");
+ writer.endElement("div");
}
- private void encodeHeader(FacesContext facesContext, UIComponent component,
ResponseWriter writer,
- String state, Boolean isDisplay) throws IOException {
+ private void encodeHeader(FacesContext facesContext, AbstractTogglePanelTitledItem
component, ResponseWriter writer,
+ HeaderStates state, Boolean isDisplay) throws IOException
{
writer.startElement("div", component);
@@ -134,11 +150,10 @@
writer.writeAttribute("style", "display : none", null);
}
- String name = "headerClass" + capitalize(state);
- writer.writeAttribute("class", "rf-aci-h-" + state + "
" + attributeAsString(component, name), name);
+ String name = "headerClass" + capitalize(state.toString());
+ writer.writeAttribute("class", concatClasses("rf-ac-itm-hdr-"
+ state.abbreviation(), attributeAsString(component, name)), null);
-
- UIComponent headerFacet = component.getFacet("header" +
capitalize(state));
+ UIComponent headerFacet = component.getHeaderFacet(state);
if (headerFacet != null && headerFacet.isRendered()) {
headerFacet.encodeAll(facesContext);
} else {
@@ -158,6 +173,14 @@
}
@Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context,
UIComponent component) {
+ Map<String, Object> res = super.getScriptObjectOptions(context,
component);
+ res.put("disabled", ((AbstractTogglePanelTitledItem)
component).isDisabled());
+
+ return res;
+ }
+
+ @Override
protected Class<? extends UIComponent> getComponentClass() {
return AbstractTogglePanelTitledItem.class;
}
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -39,9 +39,8 @@
/**
* @author akolonitsky
- * @since 2010-08-05
*/
-@ResourceDependencies( { // TODO review
+@ResourceDependencies( {
@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
@@ -69,7 +68,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return "rf-ac " + attributeAsString(component,
"styleClass");
+ return HtmlUtil.concatClasses("rf-ac", attributeAsString(component,
"styleClass"));
}
@Override
Copied:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
(from rev 19108,
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractCollapsiblePanel;
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.richfaces.component.AbstractCollapsiblePanel.States.*;
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.component.util.HtmlUtil.concatStyles;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+@ResourceDependencies( {
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"TogglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"TogglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"CollapsiblePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"CollapsiblePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"collapsiblePanel.ecss") })
+public class CollapsiblePanelRenderer extends TogglePanelRenderer {
+
+ public static final String SWITCH = "switch";
+ public static final String BEFORE_SWITCH = "beforeswitch";
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) component;
+
+ Map<String, String> requestMap =
+ context.getExternalContext().getRequestParameterMap();
+
+ // Don't overwrite the value unless you have to!
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
+ if (newValue != null) {
+ panel.setSubmittedActiveItem(newValue);
+ }
+
+ String compClientId = component.getClientId(context);
+ String clientId = requestMap.get(compClientId);
+ if (clientId != null && clientId.equals(compClientId)) {
+ String itemClientId = clientId + (Boolean.parseBoolean(newValue) ?
":content" : ":empty");
+ context.getPartialViewContext().getRenderIds().add(itemClientId);
+
+ //TODO nick - this should be done on encode, not on decode
+ addOnCompleteParam(newValue, panel.getClientId());
+ }
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
comp) throws IOException {
+ super.doEncodeBegin(writer, context, comp);
+
+ encodeHeader(context, comp, writer);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-cp", super.getStyleClass(component));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.CollapsiblePanel",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context,
UIComponent component) {
+ AbstractTogglePanel panel = (AbstractTogglePanel) component;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("activeItem", panel.getActiveItem());
+ options.put("ajax", getAjaxOptions(context, panel));
+ options.put("switchMode", panel.getSwitchType());
+
+ TogglePanelRenderer.addEventOption(context, panel, options, SWITCH);
+ TogglePanelRenderer.addEventOption(context, panel, options, BEFORE_SWITCH);
+
+ return options;
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter
writer) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId(context) +
":header", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-hdr",
attributeAsString(component, "headerClass")), null);
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+ encodeHeader(context, component, writer, expanded, panel.isExpanded());
+ encodeHeader(context, component, writer, collapsed, !panel.isExpanded());
+
+ writer.endElement("div");
+ }
+
+ private void encodeHeader(FacesContext context, UIComponent component, ResponseWriter
responseWriter, AbstractCollapsiblePanel.States state, boolean isVisible) throws
IOException {
+ responseWriter.startElement("div", component);
+ responseWriter.writeAttribute("class", "rf-cp-hdr-" +
state.abbreviation(), null);
+ responseWriter.writeAttribute("style",
concatStyles(styleElement("display", isVisible ? "" :
"none"), attributeAsString(component, "headerClass")), null);
+
+ UIComponent header = AbstractTogglePanelTitledItem.getHeaderFacet(component,
state);
+ if (header != null && header.isRendered()) {
+ header.encodeAll(context);
+ } else {
+ String headerText = (String)
component.getAttributes().get("header");
+ if (headerText != null && !headerText.isEmpty()) {
+ responseWriter.writeText(headerText, null);
+ }
+ }
+
+ responseWriter.endElement("div");
+ }
+
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context,
UIComponent component)
+ throws IOException {
+
+ AbstractCollapsiblePanel panel = (AbstractCollapsiblePanel) component;
+
+ encodeContentChild(writer, context, component, panel);
+ encodeEmptyChild(writer, context, component, panel);
+ }
+
+ private void encodeContentChild(ResponseWriter writer, FacesContext context,
UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (panel.isExpanded()) {
+ encodeContent(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeContent(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId()
+ ":content"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " +
panel.getSwitchType());
+ }
+ }
+ }
+
+ private void encodeEmptyChild(ResponseWriter writer, FacesContext context,
UIComponent component, AbstractCollapsiblePanel panel) throws IOException {
+ if (!panel.isExpanded()) {
+ encodeEmptyDiv(writer, context, component, true);
+ } else {
+ switch (panel.getSwitchType()) {
+ case client:
+ encodeEmptyDiv(writer, context, component, false);
+ break;
+
+ case ajax:
+ context.getResponseWriter().write(getPlaceHolder(panel.getClientId()
+ ":empty"));
+ break;
+
+ case server:
+ // Do nothing.
+ break;
+
+ default:
+ throw new IllegalStateException("Unknown switch type : " +
panel.getSwitchType());
+ }
+ }
+ }
+
+ private String getPlaceHolder(String id) {
+ return "<div id=\"" + id + "\" style=\"display:
none\" ></div>";
+ }
+
+ private void encodeContent(ResponseWriter writer, FacesContext context, UIComponent
component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() +
":content", null);
+ writer.writeAttribute("class", concatClasses("rf-cp-b",
attributeAsString(component, "bodyClass")), null);
+ writer.writeAttribute("style", concatStyles(visible ? "" :
"none", attributeAsString(component, "style")), null);
+
+ renderChildren(context, component);
+
+ writer.endElement("div");
+ }
+
+ private void encodeEmptyDiv(ResponseWriter writer, FacesContext context, UIComponent
component, boolean visible) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("id", component.getClientId() +
":empty", null);
+ writer.writeAttribute("class", "rf-cp-empty", null);
+ writer.writeAttribute("style", styleElement("display",
visible ? "" : "none"), null);
+ writer.endElement("div");
+ }
+
+ @Override
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context,
UIComponent component) {
+ return null;
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractCollapsiblePanel.class;
+ }
+}
+
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -62,12 +62,18 @@
return "";
}
+ return styleElement(attr, value);
+ }
+
+ protected static String styleElement(Object name, Object value) {
return new StringBuilder()
- .append(attr).append(':').append(value).toString();
+ .append(name).append(':').append(value).toString();
}
+
protected static String attributeAsString(UIComponent comp, Enum attr) {
return attributeAsString(comp, attr.toString());
}
+
protected static String attributeAsString(UIComponent comp, String attr) {
Object o = comp.getAttributes().get(attr);
return o == null ? "" : o.toString();
@@ -80,7 +86,7 @@
* @return Capitalized string.
* @throws IllegalArgumentException String is <kk>null</kk> or empty.
*/
- protected static String capitalize(final String string) {
+ public static String capitalize(final String string) {
return Character.toUpperCase(string.charAt(0)) + string.substring(1);
}
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -54,7 +54,7 @@
@Override
protected String getStyleClass(UIComponent component) {
- return HtmlUtil.concatClasses("rf-tgp-i", attributeAsString(component,
"styleClass"));
+ return HtmlUtil.concatClasses("rf-tgp-itm",
attributeAsString(component, "styleClass"));
}
@Override
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -60,7 +60,7 @@
@ResourceDependency(library = "org.richfaces", name =
"TogglePanel.js") })
public class TogglePanelRenderer extends DivPanelRenderer {
- private static final String VALUE_POSTFIX = "-value";
+ public static final String VALUE_POSTFIX = "-value";
private static final String ON = "on";
private static final String ITEM_CHANGE = "itemchange";
@@ -74,7 +74,7 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- String newValue = requestMap.get(getActiveItemRequestParamName(context,
component));
+ String newValue = requestMap.get(getValueRequestParamName(context, component));
if (newValue != null) {
panel.setSubmittedActiveItem(newValue);
}
@@ -92,7 +92,7 @@
}
}
- private static void addOnCompleteParam(String newValue, String panelId) {
+ protected static void addOnCompleteParam(String newValue, String panelId) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panelId)
.append("').onCompleteHandler('").append(newValue).append("');");
@@ -100,7 +100,7 @@
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- private static String getActiveItemRequestParamName(FacesContext context, UIComponent
component) {
+ public static String getValueRequestParamName(FacesContext context, UIComponent
component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
@@ -114,8 +114,8 @@
writer.startElement(HTML.INPUT_ELEM, comp);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getActiveItem(),
"activeItem");
- writer.writeAttribute(HTML.ID_ATTRIBUTE, getActiveItemRequestParamName(context,
comp), null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, getActiveItemRequestParamName(context,
comp), null);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, getValueRequestParamName(context, comp),
null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, getValueRequestParamName(context,
comp), null);
writer.endElement(HTML.INPUT_ELEM);
}
@@ -127,7 +127,7 @@
@Override
protected void doEncodeChildren(ResponseWriter writer, FacesContext context,
UIComponent component)
throws IOException {
-
+
renderChildren(context, component);
}
@@ -141,7 +141,7 @@
protected Map<String, Object> getScriptObjectOptions(FacesContext context,
UIComponent component) {
AbstractTogglePanel panel = (AbstractTogglePanel) component;
- Map<String, Object> options = new HashMap<String, Object>(5);
+ Map<String, Object> options = new HashMap<String, Object>();
options.put("activeItem", panel.getActiveItem());
options.put("cycledSwitching", panel.isCycledSwitching());
options.put("items", getChildrenScriptObjects(context, panel));
@@ -155,11 +155,11 @@
public static void addEventOption(FacesContext context, UIComponent component,
Map<String, Object> options,
String eventName) {
-
+
HandlersChain handlersChain = new HandlersChain(context, component);
handlersChain.addInlineHandlerFromAttribute(ON + eventName);
handlersChain.addBehaviors(eventName);
- handlersChain.addAjaxSubmitFunction();
+// handlersChain.addAjaxSubmitFunction();
String handler = handlersChain.toScript();
if (handler != null) {
@@ -168,11 +168,11 @@
}
}
- private static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent
panel) {
+ public static AjaxEventOptions getAjaxOptions(FacesContext context, UIComponent
panel) {
return AjaxRendererUtils.buildEventOptions(context, panel);
}
- private List<JSObject> getChildrenScriptObjects(FacesContext context,
UIComponent component) {
+ protected List<JSObject> getChildrenScriptObjects(FacesContext context,
UIComponent component) {
List<JSObject> res = new
ArrayList<JSObject>(component.getChildCount());
for (UIComponent child : component.getChildren()) {
res.add(getChildScriptObject(context, (AbstractTogglePanelItem) child));
Copied:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
(from rev 19108,
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ChangeExpandListenerHandler.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.view.facelets.html;
+
+import org.richfaces.event.ChangeExpandEvent;
+import org.richfaces.event.ChangeExpandListener;
+import org.richfaces.event.ChangeExpandSource;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagConfig;
+
+/**
+ *
+ * @author akolonitsky
+ * @version 1.0
+ */
+public final class ChangeExpandListenerHandler extends EventListenerHandler {
+
+ private static class LazyChangeExpandListener extends
LazyEventListener<ChangeExpandListener> implements ChangeExpandListener {
+ private static final long serialVersionUID = -391020876192823200L;
+
+ LazyChangeExpandListener(String type, ValueExpression binding) {
+ super(type, binding);
+ }
+
+ public void processChangeExpand(ChangeExpandEvent event) throws
AbortProcessingException {
+ processEvent(event);
+ }
+ }
+
+ public ChangeExpandListenerHandler(TagConfig config) {
+ super(config);
+ }
+
+ public void applyAttachedObject(FacesContext context, UIComponent parent) {
+ ValueExpression expression = null;
+ if (this.binding != null) {
+ FaceletContext ctx = (FaceletContext)
context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
+ expression = this.binding.getValueExpression(ctx,
ChangeExpandListener.class);
+ }
+
+ ChangeExpandSource source = (ChangeExpandSource) parent;
+ source.addChangeExpandListener(new LazyChangeExpandListener(this.listenerType,
expression));
+ }
+
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ChangeExpandSource;
+ }
+}
+
Copied:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
(from rev 19108,
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/CollapsiblePanelTagHandler.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.view.facelets.html;
+
+import org.richfaces.component.AbstractCollapsiblePanel;
+
+import org.richfaces.event.MethodExpressionChangeExpandListener;
+import org.richfaces.event.ChangeExpandEvent;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-27
+ */
+public class CollapsiblePanelTagHandler extends ComponentHandler {
+
+ private static final MetaRule META_RULE = new CollapsiblePanelMetaRule();
+
+
+ public CollapsiblePanelTagHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(META_RULE);
+ return metaRuleset;
+ }
+
+ private static class CollapsiblePanelMetaRule extends MetaRule{
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
+ if (meta.isTargetInstanceOf(AbstractCollapsiblePanel.class)) {
+ if ("changeExpandListener".equals(name)) {
+ return new ChangeExpandExpressionMetadata(attribute);
+ }
+
+ }
+ return null;
+ }
+ }
+
+ private static final class ChangeExpandExpressionMetadata extends Metadata {
+ private static final Class<?>[] CHANGE_EXPAND_SIG = new Class[]
{ChangeExpandEvent.class };
+
+ private final TagAttribute attr;
+
+ ChangeExpandExpressionMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCollapsiblePanel) instance).addChangeExpandListener(new
MethodExpressionChangeExpandListener(
+ this.attr.getMethodExpression(ctx, null,
CHANGE_EXPAND_SIG)));
+ }
+ }
+
+
+
+}
+
Modified:
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -22,7 +22,6 @@
package org.richfaces.view.facelets.html;
-import org.richfaces.component.AbstractTogglePanel;
import org.richfaces.event.ItemChangeEvent;
import org.richfaces.event.ItemChangeListener;
import org.richfaces.event.ItemChangeSource;
@@ -31,14 +30,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
-import javax.faces.view.EditableValueHolderAttachedObjectHandler;
-import javax.faces.view.facelets.ComponentHandler;
import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.TagAttribute;
-import javax.faces.view.facelets.TagAttributeException;
import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagException;
-import javax.faces.view.facelets.TagHandler;
import java.io.Serializable;
/**
@@ -46,90 +39,24 @@
* @author akolonitsky
* @version 1.0
*/
-public final class ItemChangeListenerHandler extends TagHandler implements
EditableValueHolderAttachedObjectHandler {
+public final class ItemChangeListenerHandler extends EventListenerHandler {
- private static class LazyItemChangeListener implements ItemChangeListener,
Serializable {
+ private static class LazyItemChangeListener extends
LazyEventListener<ItemChangeListener> implements ItemChangeListener, Serializable {
+ private static final long serialVersionUID = 7715606467989165179L;
- private static final long serialVersionUID = 1L;
-
- private final String type;
-
- private final ValueExpression binding;
-
LazyItemChangeListener(String type, ValueExpression binding) {
- this.type = type;
- this.binding = binding;
+ super(type, binding);
}
- public void processItemChange(ItemChangeEvent event)
- throws AbortProcessingException {
-
- FacesContext faces = FacesContext.getCurrentInstance();
- if (faces == null) {
- return;
- }
-
- ItemChangeListener instance = null;
- if (this.binding != null) {
- instance = (ItemChangeListener) binding.getValue(faces.getELContext());
- }
- if (instance == null && this.type != null) {
- try {
- instance = (ItemChangeListener) forName(this.type).newInstance();
- } catch (Exception e) {
- throw new AbortProcessingException("Couldn't Lazily
instantiate ItemChangeListener", e);
- }
- if (this.binding != null) {
- binding.setValue(faces.getELContext(), instance);
- }
- }
- if (instance != null) {
- instance.processItemChange(event);
- }
+ public void processItemChange(ItemChangeEvent event) throws
AbortProcessingException {
+ processEvent(event);
}
}
- private final TagAttribute binding;
-
- private final String listenerType;
-
public ItemChangeListenerHandler(TagConfig config) {
super(config);
- this.binding = this.getAttribute("binding");
- TagAttribute type = this.getAttribute("type");
- if (type != null) {
- if (type.isLiteral()) {
- try {
- forName(type.getValue());
- } catch (ClassNotFoundException e) {
- throw new TagAttributeException(type, "Couldn't qualify
ItemChangeListener", e);
- }
- } else {
- throw new TagAttributeException(type, "Must be a literal class name
of type ItemChangeListener");
- }
- this.listenerType = type.getValue();
- } else {
- this.listenerType = null;
- }
}
- public void apply(FaceletContext ctx, UIComponent parent) {
-
- // only process if it's been created
- if (parent == null || !ComponentHandler.isNew(parent)) {
- return;
- }
-
- if (parent instanceof AbstractTogglePanel) {
- applyAttachedObject(ctx.getFacesContext(), parent);
- } else if (UIComponent.isCompositeComponent(parent)) {
- // Allow the composite component to know about the target component.
- TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
- } else {
- throw new TagException(this.tag, "Parent is not of type
AbstractTogglePanel, type is: " + parent);
- }
- }
-
public void applyAttachedObject(FacesContext context, UIComponent parent) {
ValueExpression valueExpr = null;
if (this.binding != null) {
@@ -141,17 +68,9 @@
evh.addItemChangeListener(new LazyItemChangeListener(this.listenerType,
valueExpr));
}
- public String getFor() {
- TagAttribute attr = this.getAttribute("for");
- return attr == null ? null : attr.getValue();
+ @Override
+ public boolean isEventSource(UIComponent comp) {
+ return comp instanceof ItemChangeSource;
}
-
- public static Class<?> forName(String name) throws ClassNotFoundException {
- if (null == name || "".equals(name)) {
- return null;
- }
-
- return Class.forName(name, false,
Thread.currentThread().getContextClassLoader());
- }
}
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -11,6 +11,61 @@
</behavior>
<component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+
<component-class>org.richfaces.component.html.HtmlCollapsiblePanel</component-class>
+ <property>
+ <description></description>
+ <property-name>switchType</property-name>
+
<property-class>org.richfaces.component.SwitchType</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>expanded</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>header</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>changeExpandListener</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+
+ </component>
+ <component>
<component-type>org.richfaces.TogglePanel</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
@@ -604,6 +659,11 @@
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
+
<component-family>org.richfaces.CollapsiblePanel</component-family>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+
<renderer-class>org.richfaces.renderkit.html.CollapsiblePanelRenderer</renderer-class>
+ </renderer>
+ <renderer>
<component-family>org.richfaces.TogglePanel</component-family>
<renderer-type>org.richfaces.TogglePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</renderer-class>
Modified: branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-03
12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-09-03
12:51:59 UTC (rev 19110)
@@ -29,6 +29,217 @@
</tag>
<tag>
+ <tag-name>collapsiblePanel</tag-name>
+ <component>
+ <component-type>org.richfaces.CollapsiblePanel</component-type>
+ <renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
+
<handler-class>org.richfaces.view.facelets.html.CollapsiblePanelTagHandler</handler-class>
+ </component>
+ <attribute>
+ <description></description>
+ <name>switchType</name>
+ <type>org.richfaces.component.SwitchType</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>expanded</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>header</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>immediate</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>changeExpandListener</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bodyClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerControlClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>oncomplete</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforedomupdate</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeswitch</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+ <tag>
+ <description>
+ Register a ChangeExpandListener instance on the UIComponent
+ associated with the closest parent UIComponent custom
+ action.
+ </description>
+ <tag-name>changeExpandListener</tag-name>
+
<handler-class>org.richfaces.view.facelets.html.ChangeExpandListenerHandler</handler-class>
+ <attribute>
+ <description>
+ Fully qualified Java class name of a
+ ChangeExpandListener to be created and registered.
+ </description>
+ <name>type</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description>
+ Value binding expression that evaluates to an object that
+ implements org.richfaces.event.ChangeExpandListener.
+ </description>
+ <name>binding</name>
+ <required>false</required>
+ <type>org.richfaces.event.ChangeExpandListener</type>
+ </attribute>
+ <attribute>
+ <description>
+ <p class="changed_added_2_0">If present, this
attribute refers
+ to the value of one of the exposed attached objects within the
+ composite component inside of which this tag is
nested.</p>
+ </description>
+ <name>for</name>
+ <required>false</required>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+
+ <tag>
<tag-name>togglePanel</tag-name>
<component>
<component-type>org.richfaces.TogglePanel</component-type>
@@ -37,6 +248,11 @@
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -57,11 +273,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -219,7 +430,7 @@
<component>
<component-type>org.richfaces.TogglePanelItem</component-type>
<renderer-type>org.richfaces.TogglePanelItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -324,10 +535,15 @@
<component>
<component-type>org.richfaces.Accordion</component-type>
<renderer-type>org.richfaces.Accordion</renderer-type>
-
+
</component>
<attribute>
<description></description>
+ <name>cycledSwitching</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -338,16 +554,6 @@
</attribute>
<attribute>
<description></description>
- <name>height</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
- <name>width</name>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description></description>
<name>bypassUpdates</name>
<type>boolean</type>
</attribute>
@@ -358,11 +564,6 @@
</attribute>
<attribute>
<description></description>
- <name>cycledSwitching</name>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description></description>
<name>data</name>
<type>java.lang.Object</type>
</attribute>
@@ -408,6 +609,16 @@
</attribute>
<attribute>
<description></description>
+ <name>width</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>height</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>itemHeaderClassActive</name>
<type>java.lang.String</type>
</attribute>
@@ -509,7 +720,7 @@
<component>
<component-type>org.richfaces.TogglePanelTitledItem</component-type>
<renderer-type>org.richfaces.AccordionItem</renderer-type>
-
+
</component>
<attribute>
<description></description>
@@ -673,8 +884,4 @@
</attribute>
</tag>
-
-
-
-
</facelet-taglib>
Modified:
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -41,7 +41,16 @@
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
- rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this)
+ if (!this.disabled) {
+ rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this);
+ }
+
+ if (this.isSelected()) {
+ var item = this;
+ $(this.togglePanelId).ready(function () {
+ item.__fitToHeight(item.getTogglePanel());
+ });
+ }
},
/***************************** Public Methods
****************************************************************/
@@ -59,7 +68,7 @@
__header : function (state) {
var res = $(rf.getDomElement(this.id + ":header"));
if (state) {
- return res.find(".rf-aci-h-" + state);
+ return res.find(".rf-ac-itm-hdr-" + state);
}
return res;
@@ -83,24 +92,28 @@
__enter : function () {
var parentPanel = this.getTogglePanel();
if (parentPanel.isKeepHeight) {
- this.__content().hide();
- var h = parentPanel.getInnerHeight();
-
- var items = parentPanel.getItems();
- for (var i = 0; i < items.length; i++) {
- h -= items[i].__header().outerHeight();
- }
-
- this.__content().height(h - 20); // 20 it is padding top and bottom
+ this.__content().hide(); // TODO ?
+ this.__fitToHeight(parentPanel);
}
this.__content().show();
- this.__header("inactive").hide();
- this.__header("active").show();
+ this.__header("inact").hide();
+ this.__header("act").show();
return this.__fireEnter();
},
+ __fitToHeight : function (parentPanel) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i in items) {
+ h -= items[i].__header().outerHeight();
+ }
+
+ this.__content().height(h - 20); // 20 it is padding top and bottom
+ },
+
getHeight : function (recalculate) {
if (recalculate || !this.__height) {
this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
@@ -121,8 +134,8 @@
}
this.__content().hide();
- this.__header("active").hide();
- this.__header("inactive").show();
+ this.__header("act").hide();
+ this.__header("inact").show();
return true;
},
Copied:
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
(from rev 19108,
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanel = rf.ui.TogglePanel.extendClass({
+
+ name:"CollapsiblePanel",
+
+ /**
+ * @class CollapsiblePanel
+ * @name CollapsiblePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.switchMode = options.switchMode;
+
+ this.__addUserEventHandler("beforeswitch");
+ this.__addUserEventHandler("switch");
+
+ this.items = [
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":content", {"index":0,
"togglePanelId":this.id, "switchMode":this.switchMode,
"name":"true"}),
+
+ new RichFaces.ui.CollapsiblePanelItem(
+ this.id + ":empty", {"index":1,
"togglePanelId":this.id, "switchMode":this.switchMode,
"name":"false"})
+ ];
+ this.options.cycledSwitching = true;
+
+ rf.Event.bindById(this.id + ":header", "click",
this.__onHeaderClick, this)
+ },
+
+ switchPanel : function (to) {
+ this.switchToItem(to || "@next");
+ },
+
+ /***************************** Private Methods
********************************************************/
+
+ __onHeaderClick : function () {
+ this.switchToItem("@next");
+ },
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "switch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeswitch", {
+ id: this.id,
+ isExpanded : newItem.getName()
+ });
+ },
+
+
+ destroy: function () {
+ rf.ui.TogglePanel.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Copied:
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
(from rev 19108,
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanelItem.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.CollapsiblePanelItem = rf.ui.TogglePanelItem.extendClass({
+
+ init : function (componentId, options) {
+ rf.ui.TogglePanelItem.call(this, componentId, options);
+ },
+
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+ this.__header(this.__state()).show();
+
+ return true;
+ },
+
+ __leave : function () {
+ rf.getDomElement(this.id).style.display = "none";
+ this.__header(this.__state()).hide();
+
+ return true;
+ },
+
+ __state : function () {
+ return this.getName() === "true" ? "expanded" :
"collapsed";
+ },
+
+ __header : function (state) {
+ var res = $(rf.getDomElement(this.togglePanelId + ":header"));
+ if (state) {
+ return res.find(".rf-cp-hdr-" + state);
+ }
+
+ return res;
+ }
+ });
+})(jQuery, RichFaces);
Modified:
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -66,7 +66,7 @@
this.__setActiveItem(newPanel.getName());
- rf.submitForm(this.__getParentForm(), null, {});
+ rf.submitForm(this.__getParentForm());
return false;
},
@@ -111,7 +111,7 @@
this.__setActiveItem(newPanel.getName());
newPanel.__enter();
- this.__fireItemChange(oldPanel, newPanel);
+ this.comp.__fireItemChange(oldPanel, newPanel);
return true;
},
@@ -136,16 +136,6 @@
* */
__getValueInputId: function () {
return this.comp.id + "-value"
- },
-
- /********************* Events *************************/
-
- __fireItemChange : function (oldItem, newItem) {
- return new rf.Event.fireById(this.comp.id, "itemchange", {
- id: this.comp.id,
- oldItem : oldItem,
- newItem : newItem
- });
}
};
@@ -163,19 +153,22 @@
name:"TogglePanel",
init : function (componentId, options) {
- // call constructor of parent class
rf.BaseComponent.call(this, componentId);
this.attachToDom(componentId);
this.options = options;
this.activeItem = this.options.activeItem;
this.items = this.options.items;
+
+ this.__addUserEventHandler("itemchange");
+ this.__addUserEventHandler("beforeitemchange");
},
- /***************************** Public Methods
********************************************************************/
+ /***************************** Public Methods
****************************************************************/
/**
* @methodOf
+ *
* @name TogglePanel#getSelectItem
*
* @return {String} name of current selected panel item
@@ -326,20 +319,42 @@
/********************* Methods *************************/
- __ITEMS_META_NAMES : {
- "@first" : function (comp) { return 0; },
- "@prev" : function (comp) { return
comp.__getItemIndex(comp.activeItem) - 1; },
- "@next" : function (comp) { return
comp.__getItemIndex(comp.activeItem) + 1; },
- "@last" : function (comp) { return comp.items.length - 1; }
- },
+ __ITEMS_META_NAMES : (function () {
+ function goFrom (comp, ind, step) {
+ var res = ind;
+ while ((!comp.items[res] || comp.items[res].disabled) && res <
comp.items.length && res > 0) {
+ res += step;
+ }
+ return res;
+ }
+
+ return {
+ "@first" : function (comp) {
+ return goFrom(comp, 0, 1);
+ },
+
+ "@prev" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) -
1 , -1);
+ },
+
+ "@next" : function (comp) {
+ return goFrom(comp, parseInt(comp.__getItemIndex(comp.activeItem)) +
1 , 1);
+ },
+
+ "@last" : function (comp) {
+ return goFrom(comp, comp.items.length - 1, -1);
+ }
+ }
+ })(),
+
/**
* @private
* */
__getItemIndex : function (itemName) {
- for (var i = 0; i < this.items.length; i++) {
- if (this.items[i].getName() === itemName) {
- return i;
+ for (var i in this.items) {
+ if (!this.items[i].disabled && this.items[i].getName() ===
itemName) {
+ return parseInt(i);
}
}
@@ -349,6 +364,16 @@
/**
* @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ /**
+ * @private
* @param {Number} index - array index
*
* @return {TogglePanelItem}
@@ -381,6 +406,15 @@
/**
* Fire Concealable Event
* */
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.id, "itemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
__fireBeforeItemChange : function (oldItem, newItem) {
return rf.Event.fireById(this.id, "beforeitemchange", {
id: this.id,
@@ -389,11 +423,8 @@
});
},
- // class stuff
destroy: function () {
- // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
- // rf.Event.unbindById(this.componentId,
"."+this.namespace);
- // $super.destroy.call(this);
+ rf.BaseComponent.destroy.call(this);
}
});
})(jQuery, RichFaces);
Modified:
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-09-03
12:51:59 UTC (rev 19110)
@@ -38,6 +38,7 @@
this.name = this.options.name;
this.togglePanelId = this.options.togglePanelId;
this.switchMode = this.options.switchMode;
+ this.disabled = this.options.disabled || false;
},
/***************************** Public Methods
*****************************************************************/
Modified:
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03
12:00:31 UTC (rev 19109)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-09-03
12:51:59 UTC (rev 19110)
@@ -1,5 +1,4 @@
.rf-ac {
- /*width: 300px;*/ /*visible width*/
border-width: 1px;
border-style: solid;
border-color: '#{richSkin.panelBorderColor}';
@@ -7,7 +6,7 @@
background: '#{richSkin.generalBackgroundColor}';
}
-.rf-aci-h {
+.rf-ac-itm-hdr {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
@@ -24,13 +23,17 @@
cursor: pointer;
}
-.rf-aci-c {
+.rf-ac-itm-hdr-act {}
+.rf-ac-itm-hdr-inact {}
+.rf-ac-itm-hdr-dis {}
+
+.rf-ac-itm-cnt {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.panelBorderColor}';
- /*height: 100px*/ /*visible modal panel height minus header height*/;
position: relative;
overflow: auto;
overflow-x: hidden;
padding: 10px;
-}
\ No newline at end of file
+}
+
Copied:
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
(from rev 19108,
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss)
===================================================================
---
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,32 @@
+.rf-cp{
+ background-color:'#{richSkin.generalBackgroundColor}';
+ color:'#{richSkin.panelBorderColor}';
+ border-width:1px;
+ border-style:solid;
+ padding:1px;
+}
+
+.rf-cp-hdr{
+ background-color:'#{richSkin.headerBackgroundColor}';
+ border-color:'#{richSkin.headerBackgroundColor}';
+ font-size:'#{richSkin.headerSizeFont}';
+ color:'#{richSkin.headerTextColor}';
+ font-weight:'#{richSkin.headerWeightFont}';
+ font-family:'#{richSkin.headerFamilyFont}';
+ padding:2px;
+ border-width:1px;
+ border-style:solid;
+ background-position:top left;
+ background-repeat:repeat-x;
+ background-image:"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+}
+
+.rf-cp-hdr-exp {}
+.rf-cp-hdr-colps {}
+
+.rf-cp-b{
+ font-size:'#{richSkin.generalSizeFont}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ padding:10px;
+}
\ No newline at end of file
Copied:
branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java
(from rev 19108,
trunk/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java)
===================================================================
---
branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java
(rev 0)
+++
branches/RF-7944/ui/output/ui/src/test/java/org/richfaces/component/UITogglePanelItemTest.java 2010-09-03
12:51:59 UTC (rev 19110)
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-24
+ */
+public class UITogglePanelItemTest {
+
+ private UITogglePanelItem togglePanelItem;
+
+ @Before
+ public void setUp () {
+ togglePanelItem = new UITogglePanelItem();
+ }
+
+ @Test
+ public void testGetName() {
+ Assert.assertNull(togglePanelItem.getName());
+
+ String id = "id";
+ togglePanelItem.setId(id);
+ Assert.assertEquals(togglePanelItem.getId(), id);
+ Assert.assertEquals(togglePanelItem.getName(), id);
+
+ String name = "name";
+ togglePanelItem.setName(name);
+ Assert.assertEquals(togglePanelItem.getName(), name);
+ }
+}
+
Modified: branches/RF-7944/ui/parent/pom.xml
===================================================================
--- branches/RF-7944/ui/parent/pom.xml 2010-09-03 12:00:31 UTC (rev 19109)
+++ branches/RF-7944/ui/parent/pom.xml 2010-09-03 12:51:59 UTC (rev 19110)
@@ -129,12 +129,6 @@
<!-- tests -->
<dependency>
- <!-- todo api? -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-stage</artifactId>
<scope>test</scope>