JBoss Rich Faces SVN: r20303 - in trunk/examples/richfaces-showcase/src/main: java/org/richfaces/demo/progressBar and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-12-02 08:20:26 -0500 (Thu, 02 Dec 2010)
New Revision: 20303
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/treeModelRecursiveAdaptor.xhtml
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/progressBar/ProgressBarBean.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/panelMenu/samples/panelMenu-sample.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/progressBar/samples/ajaxProgressBar-sample.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml
Log:
tree Adaptors, checkstyle fixes, PanelBar fixes after component refactoring.
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java 2010-12-02 12:11:55 UTC (rev 20302)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java 2010-12-02 13:20:26 UTC (rev 20303)
@@ -4,30 +4,31 @@
import javax.faces.bean.RequestScoped;
import org.richfaces.event.ItemChangeEvent;
+
@ManagedBean
@RequestScoped
public class PanelMenuBean {
- private String current;
- private boolean singleMode;
- public boolean isSingleMode() {
- return singleMode;
- }
+ private String current;
+ private boolean singleMode;
- public void setSingleMode(boolean singleMode) {
- this.singleMode = singleMode;
- }
+ public boolean isSingleMode() {
+ return singleMode;
+ }
- public PanelMenuBean() {
- }
-
- public String getCurrent() {
- return this.current;
- }
-
- public void setCurrent(String current) {
- this.current = current;
- }
- public void updateCurrent(ItemChangeEvent event) {
- setCurrent(event.getNewItem());
- }
+ public void setSingleMode(boolean singleMode) {
+ this.singleMode = singleMode;
+ }
+
+ public String getCurrent() {
+ return this.current;
+ }
+
+ public void setCurrent(String current) {
+ this.current = current;
+ }
+
+ public void updateCurrent(ItemChangeEvent event) {
+ setCurrent(event.getNewItem());
+ System.out.println(event.getNewItem());
+ }
}
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/progressBar/ProgressBarBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/progressBar/ProgressBarBean.java 2010-12-02 12:11:55 UTC (rev 20302)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/progressBar/ProgressBarBean.java 2010-12-02 13:20:26 UTC (rev 20303)
@@ -11,18 +11,18 @@
/**
* @author Ilya Shaikovsky
- *
+ *
*/
@ManagedBean
@ViewScoped
public class ProgressBarBean implements Serializable {
-
+
private static final long serialVersionUID = -314414475508376585L;
private boolean buttonRendered = true;
- private boolean enabled=false;
+ private boolean enabled = false;
private Long startTime;
-
+
public String startProcess() {
setEnabled(true);
setButtonRendered(false);
@@ -30,24 +30,23 @@
return null;
}
- public Long getCurrentValue(){
+ public Long getCurrentValue() {
if (isEnabled()) {
- Long current = (new Date().getTime() - startTime)/1000;
- if (current>100){
+ Long current = (new Date().getTime() - startTime) / 1000;
+ if (current >= 100) {
setButtonRendered(true);
} else if (current.equals(0)) {
return new Long(1);
}
- return (new Date().getTime() - startTime)/1000;
- }
+ return (new Date().getTime() - startTime) / 1000;
+ }
if (startTime == null) {
return Long.valueOf(-1);
} else {
- return Long.valueOf(101);
+ return Long.valueOf(100);
}
-
}
-
+
public boolean isEnabled() {
return enabled;
}
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java 2010-12-02 12:11:55 UTC (rev 20302)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java 2010-12-02 13:20:26 UTC (rev 20303)
@@ -50,7 +50,7 @@
private List<TreeNode> rootNodes = new ArrayList<TreeNode>();
private Map<String, Country> countriesCache = new HashMap<String, Country>();
private Map<String, Company> companiesCache = new HashMap<String, Company>();
-
+ private Object currentSelection;
@PostConstruct
public void init() {
for (CDXmlDescriptor current : cdXmlDescriptors) {
@@ -62,6 +62,13 @@
company.getCds().add(cd);
}
}
+
+ public void selectionChanged(TreeSelectionChangeEvent selectionChangeEvent){
+ //considering only single selection
+ List<Object> selection = new ArrayList<Object>(selectionChangeEvent.getNewSelection());
+ currentSelection = selection.get(0);
+
+ }
private Country getCountryByName(CDXmlDescriptor descriptor) {
String countryName = descriptor.getCountry();
@@ -88,10 +95,6 @@
return company;
}
- private void selectionListener(TreeSelectionChangeEvent event) {
- //TODO: implement when ready
- }
-
public List<CDXmlDescriptor> getCdXmlDescriptors() {
return cdXmlDescriptors;
}
Added: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java 2010-12-02 13:20:26 UTC (rev 20303)
@@ -0,0 +1,22 @@
+package org.richfaces.demo.tree.adaptors;
+
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+
+@ManagedBean
+@RequestScoped
+public class FileSystemBean {
+ private static final String SRC_PATH = "/WEB-INF";
+
+ private List<FileSystemNode> srcRoots;
+
+ public synchronized List<FileSystemNode> getSourceRoots() {
+ if (srcRoots == null) {
+ srcRoots = new FileSystemNode(SRC_PATH).getNodes();
+ }
+
+ return srcRoots;
+ }
+}
Added: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java 2010-12-02 13:20:26 UTC (rev 20303)
@@ -0,0 +1,51 @@
+package org.richfaces.demo.tree.adaptors;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+public class FileSystemNode {
+ private String path;
+
+ private List<FileSystemNode> children;
+
+ private String shortPath;
+
+ public FileSystemNode(String path) {
+ this.path = path;
+ int idx = path.lastIndexOf('/');
+ if (idx != -1) {
+ shortPath = path.substring(idx + 1);
+ } else {
+ shortPath = path;
+ }
+ }
+
+ public synchronized List<FileSystemNode> getNodes() {
+ if (children == null) {
+ children = new ArrayList<FileSystemNode>();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Set resourcePaths = externalContext.getResourcePaths(this.path);
+ if (resourcePaths != null) {
+ Object[] nodes = (Object[]) resourcePaths.toArray();
+ for (Object node : nodes) {
+ String nodePath = node.toString();
+ if (nodePath.endsWith("/")) {
+ nodePath = nodePath.substring(0, nodePath.length() - 1);
+ }
+ children.add(new FileSystemNode(nodePath));
+ }
+ }
+ }
+ return children;
+ }
+
+ public String getShortPath() {
+ return shortPath;
+ }
+
+}
\ No newline at end of file
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-02 12:11:55 UTC (rev 20302)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-02 13:20:26 UTC (rev 20303)
@@ -291,6 +291,16 @@
</sample>
</samples>
</demo>
+ <demo new="true">
+ <id>treeAdaptors</id>
+ <name>Tree Adaptors</name>
+ <samples>
+ <sample>
+ <id>treeModelRecursiveAdaptor</id>
+ <name>Simple treeModelRecursiveAdaptor usage</name>
+ </sample>
+ </samples>
+ </demo>
</demos>
</group>
<group>
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/panelMenu/samples/panelMenu-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/panelMenu/samples/panelMenu-sample.xhtml 2010-12-02 12:11:55 UTC (rev 20302)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/panelMenu/samples/panelMenu-sample.xhtml 2010-12-02 13:20:26 UTC (rev 20303)
@@ -16,7 +16,7 @@
iconExpandedGroup="disc" iconCollapsedGroup="disc"
iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right"
iconCollapsedTopGroup="chevronDown"
- itemChangeListener="#{panelMenuBean.updateCurrent}">
+ activeItem="#{panelMenuBean.current}">
<rich:panelMenuGroup label="Group 1">
<rich:panelMenuItem label="Item 1.1">
<f:param name="current" value="Item 1.1" />
@@ -71,8 +71,5 @@
</a4j:outputPanel>
</rich:panel>
</h:panelGrid>
- <rich:tabPanel>
- <rich:tab label="12 ">asdasd</rich:tab>
- </rich:tabPanel>
</h:form>
</ui:composition>
\ No newline at end of file
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/progressBar/samples/ajaxProgressBar-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/progressBar/samples/ajaxProgressBar-sample.xhtml 2010-12-02 12:11:55 UTC (rev 20302)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/progressBar/samples/ajaxProgressBar-sample.xhtml 2010-12-02 13:20:26 UTC (rev 20303)
@@ -5,28 +5,29 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <h:form id="form">
- <rich:progressBar mode="ajax" value="#{progressBarBean.currentValue}"
- interval="2000"
- enabled="#{progressBarBean.enabled}" minValue="-1" maxValue="100"
- reRenderAfterComplete="progressPanel">
- <f:facet name="initial">
- <br />
- <h:outputText value="Process doesn't started yet" />
- <a4j:commandButton action="#{progressBarBean.startProcess}"
- value="Start Process" execute="@form"
- rendered="#{progressBarBean.buttonRendered}"
- style="margin: 9px 0px 5px;" />
- </f:facet>
- <f:facet name="complete">
- <br />
- <h:outputText value="Process Done" />
- <a4j:commandButton action="#{progressBarBean.startProcess}"
- value="Restart Process" execute="@form"
- rendered="#{progressBarBean.buttonRendered}"
- style="margin: 9px 0px 5px;" />
- </f:facet>
- <h:outputText value="#{progressBarBean.currentValue} %"/>
- </rich:progressBar>
- </h:form>
+ <h:form id="form">
+ <rich:progressBar mode="ajax" value="#{progressBarBean.currentValue}"
+ interval="2000" id="pb" enabled="#{progressBarBean.enabled}"
+ minValue="0" maxValue="100" reRenderAfterComplete="progressPanel">
+ <f:facet name="initial">
+ <h:panelGroup>
+ <h:outputText value="Process doesn't started yet" />
+ <a4j:commandButton action="#{progressBarBean.startProcess}"
+ value="Start Process" execute="@form" render="pb"
+ rendered="#{progressBarBean.buttonRendered}"
+ style="margin: 9px 0px 5px;" />
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="finish">
+ <h:panelGroup>
+ <h:outputText value="Process Done" />
+ <a4j:commandButton action="#{progressBarBean.startProcess}"
+ value="Restart Process" execute="@form"
+ rendered="#{progressBarBean.buttonRendered}"
+ style="margin: 9px 0px 5px;" />
+ </h:panelGroup>
+ </f:facet>
+ <h:outputText value="#{progressBarBean.currentValue} %" />
+ </rich:progressBar>
+ </h:form>
</ui:composition>
\ No newline at end of file
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml 2010-12-02 12:11:55 UTC (rev 20302)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml 2010-12-02 13:20:26 UTC (rev 20303)
@@ -7,7 +7,8 @@
xmlns:rich="http://richfaces.org/rich">
<rich:tree id="tree" nodeType="#{node.type}" var="node"
- value="#{treeBean.rootNodes}" toggleType="client">
+ value="#{treeBean.rootNodes}" toggleType="client"
+ >
<rich:treeNode type="country">
#{node.name}
</rich:treeNode>
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml 2010-12-02 13:20:26 UTC (rev 20303)
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition 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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:form>
+ <rich:tree style="width:300px" toggleType="ajax" var="item">
+ <rich:treeModelRecursiveAdaptor roots="#{fileSystemBean.sourceRoots}" nodes="#{item.nodes}" >
+ <rich:treeNode>
+ #{item.shortPath}
+ </rich:treeNode>
+ </rich:treeModelRecursiveAdaptor>
+ </rich:tree>
+ </h:form>
+</ui:composition>
\ No newline at end of file
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/treeModelRecursiveAdaptor.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/treeModelRecursiveAdaptor.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/treeModelRecursiveAdaptor.xhtml 2010-12-02 13:20:26 UTC (rev 20303)
@@ -0,0 +1,18 @@
+<!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">
+
+<ui:composition>
+ <p>DESC</p>
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+</ui:composition>
+
+</html>
\ No newline at end of file
15 years, 5 months
JBoss Rich Faces SVN: r20301 - modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-02 07:01:55 -0500 (Thu, 02 Dec 2010)
New Revision: 20301
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml
Log:
* added time so that attribute render is testable
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml 2010-12-02 11:59:05 UTC (rev 20300)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml 2010-12-02 12:01:55 UTC (rev 20301)
@@ -41,6 +41,12 @@
<ui:define name="component">
+ <h:outputText id="time" value="#{phasesBean.date}">
+ <f:convertDateTime pattern="HH:mm:ss.SSS" />
+ </h:outputText>
+
+ <br/><br/>
+
<h:commandLink id="tcLink1" value="Item 1">
<rich:toggleControl targetPanel="richTogglePanel" targetItem="item1" />
</h:commandLink>
15 years, 5 months
JBoss Rich Faces SVN: r20300 - in trunk/ui/input/ui/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-02 06:59:05 -0500 (Thu, 02 Dec 2010)
New Revision: 20300
Added:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
Log:
RF-9854, RF-9843
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-12-02 11:57:35 UTC (rev 20299)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-12-02 11:59:05 UTC (rev 20300)
@@ -41,7 +41,7 @@
renderer = @JsfRenderer(type = "org.richfaces.InplaceSelectRenderer"),
tag = @Tag(name="inplaceSelect")
)
-public abstract class AbstractInplaceSelect extends AbstractSelect implements InplaceComponent {
+public abstract class AbstractInplaceSelect extends AbstractSelectComponent implements InplaceComponent {
public static final String COMPONENT_TYPE = "org.richfaces.InplaceSelect";
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2010-12-02 11:57:35 UTC (rev 20299)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2010-12-02 11:59:05 UTC (rev 20300)
@@ -1,31 +1,6 @@
-/*
- * 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.component;
-import javax.faces.component.UISelectOne;
-
import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
@@ -35,115 +10,27 @@
*
*/
@JsfComponent(
- type = AbstractSelect.COMPONENT_TYPE,
- family = AbstractSelect.COMPONENT_FAMILY,
+ type = AbstractSelectComponent.COMPONENT_TYPE,
+ family = AbstractSelectComponent.COMPONENT_FAMILY,
generate = "org.richfaces.component.UISelect",
renderer = @JsfRenderer(type = "org.richfaces.SelectRenderer"),
tag = @Tag(name="select")
)
-public abstract class AbstractSelect extends UISelectOne {
-
+
+public abstract class AbstractSelect extends AbstractSelectComponent {
+
public static final String COMPONENT_TYPE = "org.richfaces.Select";
public static final String COMPONENT_FAMILY = "org.richfaces.Select";
+
- @Attribute(defaultValue="250px")
- public abstract String getListWidth();
-
- @Attribute(defaultValue="100px")
- public abstract String getListHeight();
-
- @Attribute(defaultValue="true")
- public abstract boolean isShowButton();
-
@Attribute(defaultValue="false")
public abstract boolean isEnableManualInput();
-
+
@Attribute(defaultValue="true")
public abstract boolean isSelectFirst();
- @Attribute
- public abstract String getDefaultLabel();
-
- @Attribute
- public abstract String getItemClass();
-
- @Attribute
- public abstract String getSelectItemClass();
-
- @Attribute
- public abstract String getListClass();
+ @Attribute(defaultValue="true")
+ public abstract boolean isShowButton();
- @Attribute(events=@EventName("blur"))
- public abstract String getOnblur();
-
- @Attribute(events=@EventName("click"))
- public abstract String getOnclick();
-
- @Attribute(events=@EventName("dblclick"))
- public abstract String getOndblclick();
-
- @Attribute(events=@EventName("focus"))
- public abstract String getOnfocus();
-
- @Attribute(events=@EventName("keydown"))
- public abstract String getOnkeydown();
-
- @Attribute(events=@EventName("keypress"))
- public abstract String getOnkeypress();
-
- @Attribute(events=@EventName("keyup"))
- public abstract String getOnkeyup();
-
- @Attribute(events=@EventName("mousedown"))
- public abstract String getOnmousedown();
-
- @Attribute(events=@EventName("mousemove"))
- public abstract String getOnmousemove();
-
- @Attribute(events=@EventName("mouseout"))
- public abstract String getOnmouseout();
-
- @Attribute(events=@EventName("mouseover"))
- public abstract String getOnmouseover();
-
- @Attribute(events=@EventName("mouseup"))
- public abstract String getOnmouseup();
-
- @Attribute(events=@EventName("listclick"))
- public abstract String getOnlistclick();
-
- @Attribute(events=@EventName("listdblclick"))
- public abstract String getOnlistdblclick();
-
- @Attribute(events=@EventName("listmousedown"))
- public abstract String getOnlistmousedown();
-
- @Attribute(events=@EventName("listmouseup"))
- public abstract String getOnlistmouseup();
-
- @Attribute(events=@EventName("listmouseover"))
- public abstract String getOnlistmouseover();
-
- @Attribute(events=@EventName("listmousemove"))
- public abstract String getOnlistmousemove();
-
- @Attribute(events=@EventName("listmouseout"))
- public abstract String getOnlistmouseout();
-
- @Attribute(events=@EventName("listkeypress"))
- public abstract String getOnlistkeypress();
-
- @Attribute(events=@EventName("listkeydown"))
- public abstract String getOnlistkeydown();
-
- @Attribute(events=@EventName("listkeyup"))
- public abstract String getOnlistkeyup();
-
- @Attribute(events=@EventName("select"))
- public abstract String getOnselect();
-
- @Attribute(events=@EventName("change"))
- public abstract String getOnchange();
-
}
Added: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java (rev 0)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelectComponent.java 2010-12-02 11:59:05 UTC (rev 20300)
@@ -0,0 +1,127 @@
+/*
+ * 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.component;
+
+import javax.faces.component.UISelectOne;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+
+/**
+ * @author abelevich
+ *
+ */
+
+public abstract class AbstractSelectComponent extends UISelectOne {
+
+ @Attribute(defaultValue="250px")
+ public abstract String getListWidth();
+
+ @Attribute(defaultValue="100px")
+ public abstract String getListHeight();
+
+ @Attribute
+ public abstract String getDefaultLabel();
+
+ @Attribute
+ public abstract String getItemClass();
+
+ @Attribute
+ public abstract String getSelectItemClass();
+
+ @Attribute
+ public abstract String getListClass();
+
+ @Attribute(events=@EventName("blur"))
+ public abstract String getOnblur();
+
+ @Attribute(events=@EventName("click"))
+ public abstract String getOnclick();
+
+ @Attribute(events=@EventName("dblclick"))
+ public abstract String getOndblclick();
+
+ @Attribute(events=@EventName("focus"))
+ public abstract String getOnfocus();
+
+ @Attribute(events=@EventName("keydown"))
+ public abstract String getOnkeydown();
+
+ @Attribute(events=@EventName("keypress"))
+ public abstract String getOnkeypress();
+
+ @Attribute(events=@EventName("keyup"))
+ public abstract String getOnkeyup();
+
+ @Attribute(events=@EventName("mousedown"))
+ public abstract String getOnmousedown();
+
+ @Attribute(events=@EventName("mousemove"))
+ public abstract String getOnmousemove();
+
+ @Attribute(events=@EventName("mouseout"))
+ public abstract String getOnmouseout();
+
+ @Attribute(events=@EventName("mouseover"))
+ public abstract String getOnmouseover();
+
+ @Attribute(events=@EventName("mouseup"))
+ public abstract String getOnmouseup();
+
+ @Attribute(events=@EventName("listclick"))
+ public abstract String getOnlistclick();
+
+ @Attribute(events=@EventName("listdblclick"))
+ public abstract String getOnlistdblclick();
+
+ @Attribute(events=@EventName("listmousedown"))
+ public abstract String getOnlistmousedown();
+
+ @Attribute(events=@EventName("listmouseup"))
+ public abstract String getOnlistmouseup();
+
+ @Attribute(events=@EventName("listmouseover"))
+ public abstract String getOnlistmouseover();
+
+ @Attribute(events=@EventName("listmousemove"))
+ public abstract String getOnlistmousemove();
+
+ @Attribute(events=@EventName("listmouseout"))
+ public abstract String getOnlistmouseout();
+
+ @Attribute(events=@EventName("listkeypress"))
+ public abstract String getOnlistkeypress();
+
+ @Attribute(events=@EventName("listkeydown"))
+ public abstract String getOnlistkeydown();
+
+ @Attribute(events=@EventName("listkeyup"))
+ public abstract String getOnlistkeyup();
+
+ @Attribute(events=@EventName("select"))
+ public abstract String getOnselect();
+
+ @Attribute(events=@EventName("change"))
+ public abstract String getOnchange();
+
+}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java 2010-12-02 11:57:35 UTC (rev 20299)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java 2010-12-02 11:59:05 UTC (rev 20300)
@@ -33,7 +33,7 @@
import javax.faces.context.ResponseWriter;
import javax.faces.model.SelectItem;
-import org.richfaces.component.AbstractSelect;
+import org.richfaces.component.AbstractSelectComponent;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.component.util.InputUtils;
import org.richfaces.component.util.SelectUtils;
@@ -92,7 +92,7 @@
}
public static List<ClientSelectItem> getConvertedSelectItems(FacesContext facesContext, UIComponent component) {
- AbstractSelect select = (AbstractSelect) component;
+ AbstractSelectComponent select = (AbstractSelectComponent) component;
List<SelectItem> selectItems = SelectUtils.getSelectItems(facesContext, select);
List<ClientSelectItem> clientSelectItems = new ArrayList<ClientSelectItem>();
@@ -106,7 +106,7 @@
public static void encodeItems(FacesContext facesContext, UIComponent component,
List<ClientSelectItem> clientSelectItems, String itemHtmlElement, String defaultItemCss) throws IOException {
- AbstractSelect select = (AbstractSelect) component;
+ AbstractSelectComponent select = (AbstractSelectComponent) component;
if (clientSelectItems != null && !clientSelectItems.isEmpty()) {
ResponseWriter writer = facesContext.getResponseWriter();
String clientId = component.getClientId(facesContext);
@@ -133,7 +133,7 @@
}
public static String getSelectInputLabel(FacesContext facesContext, UIComponent component) {
- AbstractSelect select = (AbstractSelect) component;
+ AbstractSelectComponent select = (AbstractSelectComponent) component;
Object value = select.getSubmittedValue();
String label = null;
if (value == null) {
@@ -152,7 +152,7 @@
return label;
}
- public static void addSelectCssToOptions(AbstractSelect abstractSelect, Map<String, Object> options, String [] defaultCss) {
+ public static void addSelectCssToOptions(AbstractSelectComponent abstractSelect, Map<String, Object> options, String [] defaultCss) {
String itemCss = abstractSelect.getItemClass();
if(itemCss != null && itemCss.trim().length() > 0) {
options.put(PopupConstants.OPTIONS_ITEM_CLASS, HtmlUtil.concatClasses(defaultCss[0], itemCss));
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2010-12-02 11:57:35 UTC (rev 20299)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2010-12-02 11:59:05 UTC (rev 20300)
@@ -30,7 +30,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.richfaces.component.AbstractSelect;
+import org.richfaces.component.AbstractSelectComponent;
/**
* @author abelevich
@@ -63,7 +63,7 @@
}
public String getSelectLabel(FacesContext facesContext, UIComponent component) {
- AbstractSelect select = (AbstractSelect) component;
+ AbstractSelectComponent select = (AbstractSelectComponent) component;
String label = getSelectInputLabel(facesContext, select);
if (label == null || "".equals(label.trim())) {
label = select.getDefaultLabel();
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-12-02 11:57:35 UTC (rev 20299)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-12-02 11:59:05 UTC (rev 20300)
@@ -112,7 +112,7 @@
position : absolute;
bottom : 0px;
right : 0px;
- wigth : 1px;
+ width : 1px;
height : 1px;
}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-12-02 11:57:35 UTC (rev 20299)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-12-02 11:59:05 UTC (rev 20300)
@@ -158,7 +158,7 @@
position : absolute;
top : -4px;
right : 0px;
- wigth : 1px;
+ width : 1px;
height : 1px;
}
15 years, 5 months
JBoss Rich Faces SVN: r20299 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceSelect.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-02 06:57:35 -0500 (Thu, 02 Dec 2010)
New Revision: 20299
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceSelect/TestRichInplaceSelect.java
Log:
* fixed issue link and a typo
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceSelect/TestRichInplaceSelect.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceSelect/TestRichInplaceSelect.java 2010-12-02 11:33:32 UTC (rev 20298)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceSelect/TestRichInplaceSelect.java 2010-12-02 11:57:35 UTC (rev 20299)
@@ -456,7 +456,7 @@
}
@Test
- @IssueTracking("https://jira.jboss.org/browse/RF-9854")
+ @IssueTracking("https://jira.jboss.org/browse/RF-9896")
public void testSelectItemClass() {
selenium.type(pjq("input[type=text][id$=selectItemClassInput]"), "metamer-ftest-class");
selenium.waitForPageToLoad();
@@ -464,7 +464,7 @@
selenium.click(select);
selenium.mouseOver(options.format(0));
- assertTrue(selenium.belongsClass(options.format(0), "metamer-ftest-class"), "Selected item does not contains defined class.");
+ assertTrue(selenium.belongsClass(options.format(0), "metamer-ftest-class"), "Selected item does not contain defined class.");
for (int i = 1; i < 50; i++) {
assertFalse(selenium.belongsClass(options.format(i), "metamer-ftest-class"), "Not selected item " + i + " should not contain defined class.");
}
15 years, 5 months
JBoss Rich Faces SVN: r20298 - modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-02 06:33:32 -0500 (Thu, 02 Dec 2010)
New Revision: 20298
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml
Log:
https://jira.jboss.org/browse/RFPL-674
* unnecessary IDs removed
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml 2010-12-02 11:17:12 UTC (rev 20297)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml 2010-12-02 11:33:32 UTC (rev 20298)
@@ -117,27 +117,27 @@
</script>
<h:commandButton id="switchButton1" value="switch to item1">
- <rich:componentControl id="componentControl1" event="click" operation="switchToItem" target="accordion" >
+ <rich:componentControl event="click" operation="switchToItem" target="accordion" >
<f:param value="item1" />
</rich:componentControl>
</h:commandButton>
<h:commandButton id="switchButton2" value="switch to item2">
- <rich:componentControl id="componentControl2" event="click" operation="switchToItem" target="accordion" >
+ <rich:componentControl event="click" operation="switchToItem" target="accordion" >
<f:param value="item2" />
</rich:componentControl>
</h:commandButton>
<h:commandButton id="switchButton3" value="switch to item3">
- <rich:componentControl id="componentControl3" event="click" operation="switchToItem" target="accordion" >
+ <rich:componentControl event="click" operation="switchToItem" target="accordion" >
<f:param value="item3" />
</rich:componentControl>
</h:commandButton>
<h:commandButton id="switchButton4" value="switch to item4">
- <rich:componentControl id="componentControl4" event="click" operation="switchToItem" target="accordion" >
+ <rich:componentControl event="click" operation="switchToItem" target="accordion" >
<f:param value="item4" />
</rich:componentControl>
</h:commandButton>
<h:commandButton id="switchButton5" value="switch to item5">
- <rich:componentControl id="componentControl5" event="click" operation="switchToItem" target="accordion" >
+ <rich:componentControl event="click" operation="switchToItem" target="accordion" >
<f:param value="item5" />
</rich:componentControl>
</h:commandButton>
15 years, 5 months
JBoss Rich Faces SVN: r20297 - in modules/tests/metamer/trunk/application/src/main: webapp/components/richDataTable and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-12-02 06:17:12 -0500 (Thu, 02 Dec 2010)
New Revision: 20297
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml
Log:
updated rich:dataTable samples in order to be compatible with rich:extendedDataTable samples (RFPL-912)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-12-02 11:16:16 UTC (rev 20296)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-12-02 11:17:12 UTC (rev 20297)
@@ -28,46 +28,55 @@
import java.util.Map;
import javax.annotation.PostConstruct;
-
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
-import org.richfaces.component.SortOrder;
+import javax.faces.bean.ViewScoped;
import org.ajax4jsf.model.DataComponentState;
import org.richfaces.component.UIDataTable;
+import org.richfaces.component.UIDataTableBase;
import org.richfaces.model.Filter;
import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.ColumnSortingMap;
import org.richfaces.tests.metamer.model.Employee;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Managed bean for rich:dataTable.
- *
+ *
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
@ManagedBean(name = "richDataTableBean")
-@SessionScoped
+@ViewScoped
public class RichDataTableBean implements Serializable {
private static final long serialVersionUID = 4814439475400649809L;
private static Logger logger;
private Attributes attributes;
+ private UIDataTable binding;
private DataComponentState dataTableState;
private Map<Object, Integer> stateMap = new HashMap<Object, Integer>();
private int page = 1;
// true = model, false = empty table
private boolean state = true;
+
// sorting
- private SortOrder capitalsOrder = SortOrder.unsorted;
- private SortOrder statesOrder = SortOrder.unsorted;
+ private ColumnSortingMap sorting = new ColumnSortingMap() {
+ private static final long serialVersionUID = 1L;
+
+ protected UIDataTableBase getBinding() {
+ return binding;
+ }
+
+ protected Attributes getAttributes() {
+ return attributes;
+ }
+ };
+
// filtering
- private String sexFilter;
- private String nameFilter;
- private String titleFilter;
- private int kidsFilter;
- private int kidsFilter2;
+ private Map<String, Object> filtering = new HashMap<String, Object>();
+
// facets
private Map<String, String> facets = new HashMap<String, String>();
@@ -84,7 +93,7 @@
attributes.setAttribute("rendered", true);
attributes.setAttribute("rows", 10);
attributes.get("sortPriority").setType(Collection.class);
-
+
// hidden attributes
attributes.remove("filteringListeners");
attributes.remove("sortingListeners");
@@ -98,7 +107,7 @@
attributes.remove("rowKey");
attributes.remove("rowKeyConverter");
attributes.remove("relativeRowIndex");
-
+
// TODO these must be tested in other way
attributes.remove("componentState");
attributes.remove("rowKeyVar");
@@ -113,7 +122,7 @@
attributes.remove("header");
attributes.remove("footer");
attributes.remove("noData");
-
+
// facets initial values
facets.put("noData", "There is no data.");
facets.put("caption", "Caption");
@@ -123,6 +132,14 @@
facets.put("columnCapitalHeader", "Capital Header");
facets.put("columnCapitalFooter", "Capital Footer");
}
+
+ public void setBinding(UIDataTable binding) {
+ this.binding = binding;
+ }
+
+ public UIDataTable getBinding() {
+ return binding;
+ }
public Attributes getAttributes() {
return attributes;
@@ -168,91 +185,25 @@
return new Date();
}
- public SortOrder getCapitalsOrder() {
- return capitalsOrder;
+ public Map<String, String> getFacets() {
+ return facets;
}
- public void setCapitalsOrder(SortOrder capitalsOrder) {
- this.capitalsOrder = capitalsOrder;
+ public ColumnSortingMap getSorting() {
+ return sorting;
}
- public SortOrder getStatesOrder() {
- return statesOrder;
+ public Map<String, Object> getFiltering() {
+ return filtering;
}
- public void setStatesOrder(SortOrder statesOrder) {
- this.statesOrder = statesOrder;
- }
-
- public String getSexFilter() {
- return sexFilter;
- }
-
- public void setSexFilter(String sexFilter) {
- this.sexFilter = sexFilter;
- }
-
- public String getNameFilter() {
- return nameFilter;
- }
-
- public void setNameFilter(String nameFilter) {
- this.nameFilter = nameFilter;
- }
-
- public String getTitleFilter() {
- return titleFilter;
- }
-
- public void setTitleFilter(String titleFilter) {
- this.titleFilter = titleFilter;
- }
-
- public int getKidsFilter() {
- return kidsFilter;
- }
-
- public void setKidsFilter(int kidsFilter) {
- this.kidsFilter = kidsFilter;
- }
-
- public int getKidsFilter2() {
- return kidsFilter2;
- }
-
- public void setKidsFilter2(int kidsFilter2) {
- this.kidsFilter2 = kidsFilter2;
- }
-
- public void sortByCapitals() {
- statesOrder = SortOrder.unsorted;
- if (capitalsOrder.equals(SortOrder.ascending)) {
- setCapitalsOrder(SortOrder.descending);
- } else {
- setCapitalsOrder(SortOrder.ascending);
- }
- }
-
- public void sortByStates() {
- capitalsOrder = SortOrder.unsorted;
- if (statesOrder.equals(SortOrder.ascending)) {
- setStatesOrder(SortOrder.descending);
- } else {
- setStatesOrder(SortOrder.ascending);
- }
- }
-
- public void sortReset() {
- setStatesOrder(SortOrder.ascending);
- setCapitalsOrder(SortOrder.unsorted);
- }
-
public Filter<?> getFilterSexImpl() {
return new Filter<Employee>() {
public boolean accept(Employee e) {
- String sex = getSexFilter();
- if (sex == null || sex.length() == 0 || sex.equalsIgnoreCase("all") || sex.equalsIgnoreCase(e.getSex().toString())) {
+ String sex = (String) getFiltering().get("sex");
+ if (sex == null || sex.length() == 0 || sex.equalsIgnoreCase("all")
+ || sex.equalsIgnoreCase(e.getSex().toString())) {
return true;
}
return false;
@@ -260,20 +211,4 @@
};
}
- public Filter<?> getFilterKidsImpl() {
- return new Filter<Employee>() {
-
- public boolean accept(Employee e) {
- int kids = getKidsFilter();
- if (e.getNumberOfKids() >= kids) {
- return true;
- }
- return false;
- }
- };
- }
-
- public Map<String, String> getFacets() {
- return facets;
- }
}
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml 2010-12-02 11:16:16 UTC (rev 20296)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml 2010-12-02 11:17:12 UTC (rev 20297)
@@ -50,25 +50,13 @@
<ui:define name="component">
<rich:dataTable id="richDataTable"
- filterVar="#{richDataTableBean.attributes['filterVar'].value}"
- filteringListeners="#{richDataTableBean.attributes['filteringListeners'].value}"
first="#{richDataTableBean.attributes['first'].value}"
- iterationState="#{richDataTableBean.attributes['iterationState'].value}"
- iterationStatusVar="#{richDataTableBean.attributes['iterationStatusVar'].value}"
keepSaved="#{richDataTableBean.attributes['keepSaved'].value}"
noDataLabel="#{richDataTableBean.attributes['noDataLabel'].value}"
- relativeRowIndex="#{richDataTableBean.attributes['relativeRowIndex'].value}"
rendered="#{richDataTableBean.attributes['rendered'].value}"
- rowAvailable="#{richDataTableBean.attributes['rowAvailable'].value}"
- rowCount="#{richDataTableBean.attributes['rowCount'].value}"
- rowData="#{richDataTableBean.attributes['rowData'].value}"
- rowIndex="#{richDataTableBean.attributes['rowIndex'].value}"
- rowKey="#{richDataTableBean.attributes['rowKey'].value}"
- rowKeyConverter="#{richDataTableBean.attributes['rowKeyConverter'].value}"
rows="#{richDataTableBean.attributes['rows'].value}"
sortMode="#{richDataTableBean.attributes['sortMode'].value}"
sortPriority="#{richDataTableBean.attributes['sortPriority'].value}"
- sortingListeners="#{richDataTableBean.attributes['sortingListeners'].value}"
value="#{richDataTableBean.state ? model.employees : null}"
var="record"
>
@@ -84,11 +72,11 @@
<br/>
<h:outputText id="columnHeaderSexType" value="(filter)" />
<br/>
- <h:selectOneMenu id="columnHeaderSexInput" value="#{richDataTableBean.sexFilter}" >
+ <h:selectOneMenu id="columnHeaderSexInput" value="#{richDataTableBean.filtering['sex']}" >
<f:selectItem itemValue="ALL" itemLabel="all"/>
<f:selectItem itemValue="FEMALE" itemLabel="female"/>
<f:selectItem itemValue="MALE" itemLabel="male"/>
- <a4j:ajax render="commonGrid" execute="@this" event="change"/>
+ <a4j:ajax render="commonGrid" event="change"/>
</h:selectOneMenu>
</h:panelGroup>
</f:facet>
@@ -101,15 +89,15 @@
</rich:column>
- <rich:column id="columnName" filterValue="#{richDataTableBean.nameFilter}" filterExpression="#{fn:containsIgnoreCase(record.name, richDataTableBean.nameFilter)}">
+ <rich:column id="columnName" filterExpression="#{fn:containsIgnoreCase(record.name, richDataTableBean.filtering['name'])}">
<f:facet name="header">
<h:outputText id="columnHeaderName" value="Name" />
<br/>
<h:outputText id="columnHeaderNameType" value="(expression contains ignore case)" />
<br/>
- <h:inputText id="columnHeaderNameInput" value="#{richDataTableBean.nameFilter}">
- <a4j:ajax render="commonGrid" execute="@this" event="change"/>
- </h:inputText>
+ <h:inputText id="columnHeaderNameInput" value="#{richDataTableBean.filtering['name']}">
+ <a4j:ajax render="commonGrid" event="change"/>
+ </h:inputText>
</f:facet>
<h:outputText value="#{record.name}" />
@@ -118,14 +106,14 @@
</f:facet>
</rich:column>
- <rich:column id="columnTitle" filterValue="#{richDataTableBean.titleFilter}" filterExpression="#{richDataTableBean.titleFilter == null || richDataTableBean.titleFilter == '' || record.title == richDataTableBean.titleFilter}">
+ <rich:column id="columnTitle" filterExpression="#{richDataTableBean.filtering['title'] == null || richDataTableBean.filtering['title'] == '' || record.title == richDataTableBean.filtering['title']}">
<f:facet name="header">
<h:outputText id="columnHeaderTitle" value="Title" />
<br/>
<h:outputText id="columnHeaderTitleType" value="(expression equals)" />
<br/>
- <h:inputText id="columnHeaderTitleInput" value="#{richDataTableBean.titleFilter}">
- <a4j:ajax render="commonGrid" execute="@this" event="change"/>
+ <h:inputText id="columnHeaderTitleInput" value="#{richDataTableBean.filtering['title']}">
+ <a4j:ajax render="commonGrid" event="change"/>
</h:inputText>
</f:facet>
@@ -135,14 +123,14 @@
</f:facet>
</rich:column>
- <rich:column id="columnNumberOfKids" filter="#{richDataTableBean.filterKidsImpl}">
+ <rich:column id="columnNumberOfKids1" filterExpression="#{empty richDataTableBean.filtering['numberOfKids1'] || record.numberOfKids >= richDataTableBean.filtering['numberOfKids1']}">
<f:facet name="header">
<h:outputText id="columnHeaderNumberOfKids" value="Number of Kids" />
<br/>
<h:outputText id="columnHeaderNumberOfKidsType" value="(expression >=)" />
<br/>
- <rich:inputNumberSpinner id="columnHeaderNumberOfKidsInput" value="#{richDataTableBean.kidsFilter}" minValue="0" maxValue="5" cycled="true">
- <a4j:ajax render="commonGrid" execute="@this"/>
+ <rich:inputNumberSpinner id="spinnerFilter" minValue="0" maxValue="6" cycled="false" value="#{richDataTableBean.filtering['numberOfKids1']}">
+ <a4j:ajax render="commonGrid" />
</rich:inputNumberSpinner>
</f:facet>
@@ -158,9 +146,11 @@
<br/>
<h:outputText id="columnHeaderNumberOfKids2Type" value="(expression <)" />
<br/>
- <rich:inputNumberSlider id="columnHeaderNumberOfKids2Input" value="#{richDataTableBean.kidsFilter2}" minValue="0" maxValue="5" showInput="false">
- <a4j:ajax render="commonGrid" execute="@this"/>
+ <rich:inputNumberSlider id="sliderFilter" minValue="0" maxValue="6" value="#{richDataTableBean.filtering['numberOfKids2']}">
+ <!-- <a4j:ajax render="commonGrid" /> -->
</rich:inputNumberSlider>
+ <br />
+ (DOESN'T WORK, NOT REPORTED YET (causes continuous refreshing of page))
</f:facet>
<h:outputText value="#{record.numberOfKids}" />
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/simple.xhtml 2010-12-02 11:16:16 UTC (rev 20296)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/simple.xhtml 2010-12-02 11:17:12 UTC (rev 20297)
@@ -60,11 +60,11 @@
var="record"
>
- <rich:column id="columnState" sortBy="#{record.state}">
+ <rich:column id="columnState">
<h:outputText value="#{record.state}" />
</rich:column>
- <rich:column id="columnCapital" sortBy="#{record.name}">
+ <rich:column id="columnCapital">
<h:outputText value="#{record.name}" />
</rich:column>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml 2010-12-02 11:16:16 UTC (rev 20296)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml 2010-12-02 11:17:12 UTC (rev 20297)
@@ -50,26 +50,15 @@
<ui:define name="component">
<rich:dataTable id="richDataTable"
- filterVar="#{richDataTableBean.attributes['filterVar'].value}"
- filteringListeners="#{richDataTableBean.attributes['filteringListeners'].value}"
+ binding="#{richDataTableBean.binding}"
first="#{richDataTableBean.attributes['first'].value}"
- iterationState="#{richDataTableBean.attributes['iterationState'].value}"
- iterationStatusVar="#{richDataTableBean.attributes['iterationStatusVar'].value}"
keepSaved="#{richDataTableBean.attributes['keepSaved'].value}"
noDataLabel="#{richDataTableBean.attributes['noDataLabel'].value}"
- relativeRowIndex="#{richDataTableBean.attributes['relativeRowIndex'].value}"
rendered="#{richDataTableBean.attributes['rendered'].value}"
- rowAvailable="#{richDataTableBean.attributes['rowAvailable'].value}"
- rowCount="#{richDataTableBean.attributes['rowCount'].value}"
- rowData="#{richDataTableBean.attributes['rowData'].value}"
- rowIndex="#{richDataTableBean.attributes['rowIndex'].value}"
- rowKey="#{richDataTableBean.attributes['rowKey'].value}"
- rowKeyConverter="#{richDataTableBean.attributes['rowKeyConverter'].value}"
rows="#{richDataTableBean.attributes['rows'].value}"
sortMode="#{richDataTableBean.attributes['sortMode'].value}"
sortPriority="#{richDataTableBean.attributes['sortPriority'].value}"
- sortingListeners="#{richDataTableBean.attributes['sortingListeners'].value}"
- value="#{richDataTableBean.state ? model.capitals : null}"
+ value="#{richDataTableBean.state ? model.employees : null}"
var="record"
>
@@ -77,26 +66,33 @@
<h:outputText value="There is no data." style="color: red;"/>
</f:facet>
- <rich:column id="columnState" sortBy="#{record.state}" sortOrder="#{richDataTableBean.statesOrder}">
+ <rich:column id="columnSex" sortBy="#{record.sex}" sortOrder="#{richDataTableBean.sorting['columnSex'].order}">
<f:facet name="header">
- <a4j:commandLink id="sortStates" value="State" render="richDataTable" action="#{richDataTableBean.sortByStates}"/>
+ <a4j:commandLink id="sortBySex" value="Sex" render="richDataTable" action="#{richDataTableBean.sorting['columnSex'].reverseOrder}" />
</f:facet>
+ <h:graphicImage library="images" name="#{record.sex == 'MALE' ? 'male.png' : 'female.png'}" />
+ </rich:column>
- <h:outputText value="#{record.state}" />
- <f:facet name="footer">
- <h:outputText id="columnFooterState" value="State" />
+
+ <rich:column id="columnName" sortBy="#{record.name}" sortOrder="#{richDataTableBean.sorting['columnName'].order}">
+ <f:facet name="header">
+ <a4j:commandLink id="sortByName" value="Name" render="richDataTable" action="#{richDataTableBean.sorting['columnName'].reverseOrder}" />
</f:facet>
+ <h:outputText value="#{record.name}" />
</rich:column>
- <rich:column id="columnCapital" sortBy="#{record.name}" sortOrder="#{richDataTableBean.capitalsOrder}" sortingListeners="#{richDataTableBean.sortingListener}">
+ <rich:column id="columnTitle" sortBy="#{record.title}" sortOrder="#{richDataTableBean.sorting['columnTitle'].order}">
<f:facet name="header">
- <a4j:commandLink id="sortCapitals" value="Capital" render="richDataTable" action="#{richDataTableBean.sortByCapitals}"/>
+ <a4j:commandLink id="sortByTitle" value="Title" render="richDataTable" action="#{richDataTableBean.sorting['columnTitle'].reverseOrder}" />
</f:facet>
+ <h:outputText value="#{record.title}" />
+ </rich:column>
- <h:outputText value="#{record.name}" />
- <f:facet name="footer">
- <h:outputText id="columnFooterCapital" value="Capital" />
+ <rich:column id="columnNumberOfKids" sortBy="#{record.numberOfKids}" sortOrder="#{richDataTableBean.sorting['columnNumberOfKids'].order}">
+ <f:facet name="header">
+ <a4j:commandLink id="sortByNumberOfKids" value="# of Kids" render="richDataTable" action="#{richDataTableBean.sorting['columnNumberOfKids'].reverseOrder}" />
</f:facet>
+ <h:outputText value="#{record.numberOfKids}" />
</rich:column>
<f:facet name="footer">
@@ -105,7 +101,7 @@
</rich:dataTable>
- <a4j:commandButton id="sortReset" value="Reset Sorting" render="richDataTable" action="#{richDataTableBean.sortReset}"/>
+ <a4j:commandButton id="sortReset" value="Reset Sorting" action="#{richDataTableBean.sorting.clear}" render="richDataTable" />
</ui:define>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml 2010-12-02 11:16:16 UTC (rev 20296)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml 2010-12-02 11:17:12 UTC (rev 20297)
@@ -50,26 +50,14 @@
<ui:define name="component">
<rich:dataTable id="richDataTable"
- filterVar="#{richDataTableBean.attributes['filterVar'].value}"
- filteringListeners="#{richDataTableBean.attributes['filteringListeners'].value}"
first="#{richDataTableBean.attributes['first'].value}"
- iterationState="#{richDataTableBean.attributes['iterationState'].value}"
- iterationStatusVar="#{richDataTableBean.attributes['iterationStatusVar'].value}"
keepSaved="#{richDataTableBean.attributes['keepSaved'].value}"
noDataLabel="#{richDataTableBean.attributes['noDataLabel'].value}"
- relativeRowIndex="#{richDataTableBean.attributes['relativeRowIndex'].value}"
rendered="#{richDataTableBean.attributes['rendered'].value}"
- rowAvailable="#{richDataTableBean.attributes['rowAvailable'].value}"
- rowCount="#{richDataTableBean.attributes['rowCount'].value}"
- rowData="#{richDataTableBean.attributes['rowData'].value}"
- rowIndex="#{richDataTableBean.attributes['rowIndex'].value}"
- rowKey="#{richDataTableBean.attributes['rowKey'].value}"
- rowKeyConverter="#{richDataTableBean.attributes['rowKeyConverter'].value}"
rows="#{richDataTableBean.attributes['rows'].value}"
sortMode="#{richDataTableBean.attributes['sortMode'].value}"
sortPriority="#{richDataTableBean.attributes['sortPriority'].value}"
- sortingListeners="#{richDataTableBean.attributes['sortingListeners'].value}"
- value="#{richDataTableBean.state ? model.capitals : null}"
+ value="#{richDataTableBean.state ? model.employees : null}"
var="record"
>
@@ -77,34 +65,49 @@
<h:outputText value="There is no data." style="color: red;"/>
</f:facet>
- <rich:column id="columnState" sortBy="#{record.state}" sortOrder="#{richDataTableBean.statesOrder}">
+ <rich:column id="columnSex" sortBy="#{record.sex}">
<f:facet name="header">
- <h:commandLink id="sortStates" value="State">
+ <h:commandLink id="sortSexes" value="Sex">
<rich:componentControl event="click" target="richDataTable" operation="sort">
- <f:param value="columnState" />
+ <f:param value="columnSex" />
</rich:componentControl>
</h:commandLink>
</f:facet>
+ <h:graphicImage library="images" name="#{record.sex == 'MALE' ? 'male.png' : 'female.png'}" />
+ </rich:column>
- <h:outputText value="#{record.state}" />
- <f:facet name="footer">
- <h:outputText id="columnFooterState" value="State" />
+
+ <rich:column id="columnName" sortBy="#{record.name}">
+ <f:facet name="header">
+ <h:commandLink id="sortByName" value="Name">
+ <rich:componentControl event="click" target="richDataTable" operation="sort">
+ <f:param value="columnName" />
+ </rich:componentControl>
+ </h:commandLink>
</f:facet>
+ <h:outputText value="#{record.name}" />
</rich:column>
- <rich:column id="columnCapital" sortBy="#{record.name}" sortOrder="#{richDataTableBean.capitalsOrder}">
+ <rich:column id="columnTitle" sortBy="#{record.title}">
<f:facet name="header">
- <h:commandLink id="sortCapitals" value="Capital">
+ <h:commandLink id="sortByTitle" value="Title">
<rich:componentControl event="click" target="richDataTable" operation="sort">
- <f:param value="columnCapital" />
+ <f:param value="columnTitle" />
</rich:componentControl>
</h:commandLink>
</f:facet>
+ <h:outputText value="#{record.title}" />
+ </rich:column>
- <h:outputText value="#{record.name}" />
- <f:facet name="footer">
- <h:outputText id="columnFooterCapital" value="Capital" />
+ <rich:column id="columnNumberOfKids" sortBy="#{record.numberOfKids}">
+ <f:facet name="header">
+ <h:commandLink id="sortByNumberOfKids" value="Number of Kids">
+ <rich:componentControl event="click" target="richDataTable" operation="sort">
+ <f:param value="columnNumberOfKids" />
+ </rich:componentControl>
+ </h:commandLink>
</f:facet>
+ <h:outputText value="#{record.numberOfKids}" />
</rich:column>
<f:facet name="footer">
15 years, 5 months
JBoss Rich Faces SVN: r20296 - in modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer: bean and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-12-02 06:16:16 -0500 (Thu, 02 Dec 2010)
New Revision: 20296
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/ColumnSortingMap.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java
Log:
separated ColumnSortingMap from RichExtendedDataTable to allow reuse in RichDataTable
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/ColumnSortingMap.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/ColumnSortingMap.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/ColumnSortingMap.java 2010-12-02 11:16:16 UTC (rev 20296)
@@ -0,0 +1,73 @@
+package org.richfaces.tests.metamer;
+
+import java.util.Collection;
+import java.util.TreeMap;
+
+import org.richfaces.component.SortOrder;
+import org.richfaces.component.UIDataTableBase;
+import org.richfaces.model.SortMode;
+
+public abstract class ColumnSortingMap extends TreeMap<String, ColumnSortingMap.ColumnSorting> {
+
+ private static final long serialVersionUID = 1L;
+
+ public ColumnSorting get(Object key) {
+ if (key instanceof String && !containsKey(key)) {
+ String columnName = (String) key;
+ put(columnName, new ColumnSorting(columnName));
+ }
+ return super.get(key);
+ }
+
+ protected abstract UIDataTableBase getBinding();
+
+ protected abstract Attributes getAttributes();
+
+ public class ColumnSorting {
+ private String columnName;
+ private SortOrder order = SortOrder.unsorted;
+
+ public ColumnSorting(String key) {
+ this.columnName = key;
+ }
+
+ public SortOrder getOrder() {
+ return order;
+ }
+
+ public void setOrder(SortOrder order) {
+ this.order = order;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void reverseOrder() {
+ SortMode mode = getBinding().getSortMode();
+
+ Object sortOrderObject = getAttributes().get("sortPriority").getValue();
+ Collection<String> sortPriority;
+ if (sortOrderObject instanceof Collection) {
+ sortPriority = (Collection<String>) sortOrderObject;
+ } else {
+ throw new IllegalStateException("sortOrder attribute have to be Collection");
+ }
+
+ if (SortMode.single.equals(mode)) {
+ ColumnSortingMap.this.clear();
+ ColumnSortingMap.this.put(columnName, this);
+
+ sortPriority.clear();
+ } else {
+ sortPriority.remove(columnName);
+ }
+
+ sortPriority.add(columnName);
+
+ if (SortOrder.ascending.equals(order)) {
+ order = SortOrder.descending;
+ } else {
+ order = SortOrder.ascending;
+ }
+ }
+
+ }
+}
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java 2010-12-02 11:05:12 UTC (rev 20295)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java 2010-12-02 11:16:16 UTC (rev 20296)
@@ -23,21 +23,19 @@
package org.richfaces.tests.metamer.bean;
import java.io.Serializable;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.TreeMap;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.ajax4jsf.model.DataComponentState;
-import org.richfaces.component.SortOrder;
+import org.richfaces.component.UIDataTableBase;
import org.richfaces.component.UIExtendedDataTable;
import org.richfaces.model.Filter;
-import org.richfaces.model.SortMode;
import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.ColumnSortingMap;
import org.richfaces.tests.metamer.model.Employee;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,7 +60,15 @@
private boolean state = true;
// sorting
- private Map<String, ColumnSorting> sorting = new ColumnSortingMap();
+ private ColumnSortingMap sorting = new ColumnSortingMap() {
+ private static final long serialVersionUID = 1L;
+ protected UIDataTableBase getBinding() {
+ return binding;
+ }
+ protected Attributes getAttributes() {
+ return attributes;
+ }
+ };
// filtering
private Map<String, Object> filtering = new HashMap<String, Object>();
@@ -216,7 +222,7 @@
return facets;
}
- public Map<String, ColumnSorting> getSorting() {
+ public ColumnSortingMap getSorting() {
return sorting;
}
@@ -224,62 +230,7 @@
return filtering;
}
- public class ColumnSortingMap extends TreeMap<String, ColumnSorting> {
- private static final long serialVersionUID = 1L;
+
- public ColumnSorting get(Object key) {
- if (key instanceof String && !containsKey(key)) {
- String columnName = (String) key;
- put(columnName, new ColumnSorting(columnName));
- }
- return super.get(key);
- }
- }
-
- public class ColumnSorting {
- private String columnName;
- private SortOrder order = SortOrder.unsorted;
-
- public ColumnSorting(String key) {
- this.columnName = key;
- }
-
- public SortOrder getOrder() {
- return order;
- }
-
- public void setOrder(SortOrder order) {
- this.order = order;
- }
-
- @SuppressWarnings("unchecked")
- public void reverseOrder() {
- SortMode mode = binding.getSortMode();
-
- Object sortOrderObject = getAttributes().get("sortPriority").getValue();
- Collection<String> sortPriority;
- if (sortOrderObject instanceof Collection) {
- sortPriority = (Collection<String>) sortOrderObject;
- } else {
- throw new IllegalStateException("sortOrder attribute have to be Collection");
- }
-
- if (SortMode.single.equals(mode)) {
- sorting.clear();
- sorting.put(columnName, this);
-
- sortPriority.clear();
- } else {
- sortPriority.remove(columnName);
- }
-
- sortPriority.add(columnName);
-
- if (SortOrder.ascending.equals(order)) {
- order = SortOrder.descending;
- } else {
- order = SortOrder.ascending;
- }
- }
- }
+
}
15 years, 5 months
JBoss Rich Faces SVN: r20295 - modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-02 06:05:12 -0500 (Thu, 02 Dec 2010)
New Revision: 20295
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml
Log:
https://jira.jboss.org/browse/RFPL-676
* sample modified because attribute ZIndex was renamed
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml 2010-12-02 11:03:33 UTC (rev 20294)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richPopupPanel/simple.xhtml 2010-12-02 11:05:12 UTC (rev 20295)
@@ -45,7 +45,6 @@
</h:commandButton>
<rich:popupPanel id="popupPanel"
- ZIndex="#{richPopupPanelBean.attributes['ZIndex'].value}"
autosized="#{richPopupPanelBean.attributes['autosized'].value}"
controlsClass="#{richPopupPanelBean.attributes['controlsClass'].value}"
domElementAttachment="#{richPopupPanelBean.attributes['domElementAttachment'].value}"
@@ -85,6 +84,7 @@
trimOverlayedElements="#{richPopupPanelBean.attributes['trimOverlayedElements'].value}"
visualOptions="#{richPopupPanelBean.attributes['visualOptions'].value}"
width="#{richPopupPanelBean.attributes['width'].value}"
+ zIndex="#{richPopupPanelBean.attributes['zIndex'].value}"
>
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('popupPanel')}.hide(); return false;">X</h:outputLink>
15 years, 5 months
JBoss Rich Faces SVN: r20294 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-02 06:03:33 -0500 (Thu, 02 Dec 2010)
New Revision: 20294
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTogglePanelItem/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTogglePanelItem/TestRichTogglePanelItem.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanelItem/simple.xhtml
Log:
https://jira.jboss.org/browse/RFPL-739
* added 21 tests for rich:togglePanelItem
* unnecessary attributes removed from sample
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanelItem/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanelItem/simple.xhtml 2010-12-02 11:02:09 UTC (rev 20293)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanelItem/simple.xhtml 2010-12-02 11:03:33 UTC (rev 20294)
@@ -52,16 +52,17 @@
<h:commandLink id="tcLink3" value="Toggle Panel Item 3">
<rich:toggleControl targetPanel="richTogglePanel" targetItem="item3" />
</h:commandLink>
+ <h:outputText value=" | " />
+ <h:commandLink id="tcLinkCustom" value="Toggle Panel Custom (#{richTogglePanelItemBean.attributes['name'].value})">
+ <rich:toggleControl targetPanel="richTogglePanel" targetItem="#{richTogglePanelItemBean.attributes['name'].value}" />
+ </h:commandLink>
<br/><br/>
- <rich:togglePanel id="richTogglePanel" activeItem="item1" switchType="client">
+ <rich:togglePanel id="richTogglePanel" activeItem="item1" switchType="ajax">
<rich:togglePanelItem id="item1"
- active="#{richTogglePanelItemBean.attributes['active'].value}"
- converter="#{richTogglePanelItemBean.attributes['converter'].value}"
dir="#{richTogglePanelItemBean.attributes['dir'].value}"
lang="#{richTogglePanelItemBean.attributes['lang'].value}"
- localValue="#{richTogglePanelItemBean.attributes['localValue'].value}"
name="#{richTogglePanelItemBean.attributes['name'].value}"
onclick="#{richTogglePanelItemBean.attributes['onclick'].value}"
ondblclick="#{richTogglePanelItemBean.attributes['ondblclick'].value}"
@@ -77,7 +78,7 @@
styleClass="#{richTogglePanelItemBean.attributes['styleClass'].value}"
switchType="#{richTogglePanelItemBean.attributes['switchType'].value}"
title="#{richTogglePanelItemBean.attributes['title'].value}"
- value="#{richTogglePanelItemBean.attributes['value'].value}">
+ >
<p>content of panel 1</p>
</rich:togglePanelItem>
<rich:togglePanelItem id="item2" name="item2">
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTogglePanelItem/TestRichTogglePanelItem.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTogglePanelItem/TestRichTogglePanelItem.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTogglePanelItem/TestRichTogglePanelItem.java 2010-12-02 11:03:33 UTC (rev 20294)
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * 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.tests.metamer.ftest.richTogglePanelItem;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/richTogglePanelItem/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichTogglePanelItem extends AbstractMetamerTest {
+
+ private JQueryLocator item1 = pjq("div[id$=item1]");
+ private JQueryLocator item2 = pjq("div[id$=item2]");
+ private JQueryLocator item3 = pjq("div[id$=item3]");
+ private JQueryLocator link1 = pjq("a[id$=tcLink1]");
+ private JQueryLocator link2 = pjq("a[id$=tcLink2]");
+ private JQueryLocator link3 = pjq("a[id$=tcLink3]");
+ private JQueryLocator linkCustom = pjq("a[id$=tcLinkCustom]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richTogglePanelItem/simple.xhtml");
+ }
+
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isElementPresent(item1), "Item 1 should be present on the page.");
+ assertTrue(selenium.isElementPresent(item2), "Item 2 should be present on the page.");
+ assertTrue(selenium.isElementPresent(item3), "Item 3 should be present on the page.");
+
+ assertTrue(selenium.isVisible(item1), "Item 1 should be visible.");
+ assertFalse(selenium.isVisible(item2), "Item 2 should not be visible.");
+ assertFalse(selenium.isVisible(item3), "Item 3 should not be visible.");
+ }
+
+ @Test
+ public void testDir() {
+ testDir(item1);
+ }
+
+ @Test
+ public void testLang() {
+ testLang(item1);
+ }
+
+ @Test
+ public void testName() {
+ selenium.type(pjq("input[type=text][id$=nameInput]"), "metamer");
+ selenium.waitForPageToLoad();
+
+ selenium.click(link3);
+ waitGui.failWith("Item 3 was not displayed.").until(isDisplayed.locator(item3));
+
+ selenium.click(linkCustom);
+ waitGui.failWith("Item 1 was not displayed.").until(isDisplayed.locator(item1));
+ }
+
+ @Test
+ public void testOnclick() {
+ testFireEvent(Event.CLICK, item1);
+ }
+
+ @Test
+ public void testOndblclick() {
+ testFireEvent(Event.DBLCLICK, item1);
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9895")
+ public void testOnenter() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+
+ selenium.type(pjq("input[type=text][id$=onenterInput]"), "metamerEvents += \"enter \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+ String time1Value = selenium.getText(time);
+
+ guardXhr(selenium).click(link2);
+ waitGui.failWith("Page was not updated").waitForChange(time1Value, retrieveText.locator(time));
+ guardXhr(selenium).click(link1);
+ waitGui.failWith("Page was not updated").waitForChange(time1Value, retrieveText.locator(time));
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events.length, 1, "Exactly one event should be fired.");
+ assertEquals(events[0], "enter", "Attribute onenter doesn't work");
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9895")
+ public void testOnleave() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+
+ selenium.type(pjq("input[type=text][id$=onleaveInput]"), "metamerEvents += \"leave \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+ String time1Value = selenium.getText(time);
+
+ guardXhr(selenium).click(link3);
+ waitGui.failWith("Page was not updated").waitForChange(time1Value, retrieveText.locator(time));
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events.length, 1, "Exactly one event should be fired.");
+ assertEquals(events[0], "leave", "Attribute onleave doesn't work");
+ }
+
+ @Test
+ public void testOnmousedown() {
+ testFireEvent(Event.MOUSEDOWN, item1);
+ }
+
+ @Test
+ public void testOnmousemove() {
+ testFireEvent(Event.MOUSEMOVE, item1);
+ }
+
+ @Test
+ public void testOnmouseout() {
+ testFireEvent(Event.MOUSEOUT, item1);
+ }
+
+ @Test
+ public void testOnmouseover() {
+ testFireEvent(Event.MOUSEOVER, item1);
+ }
+
+ @Test
+ public void testOnmouseup() {
+ testFireEvent(Event.MOUSEUP, item1);
+ }
+
+ @Test
+ @IssueTracking("https://jira.jboss.org/browse/RF-9894")
+ public void testRendered() {
+ JQueryLocator input = pjq("input[type=radio][name$=renderedInput][value=false]");
+ selenium.click(input);
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(item1), "Tab should not be rendered when rendered=false.");
+ selenium.click(link2);
+ waitGui.failWith("Item 2 was not displayed.").until(isDisplayed.locator(item2));
+ selenium.click(link3);
+ waitGui.failWith("Item 3 was not displayed.").until(isDisplayed.locator(item3));
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(item1, "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ testStyleClass(item1, "styleClass");
+ }
+
+ @Test
+ public void testSwitchTypeNull() {
+ guardXhr(selenium).click(link2);
+ waitGui.failWith("Item 2 is not displayed.").until(isDisplayed.locator(item2));
+
+ guardXhr(selenium).click(link1);
+ waitGui.failWith("Item 1 is not displayed.").until(isDisplayed.locator(item1));
+ }
+
+ @Test
+ public void testSwitchTypeAjax() {
+ JQueryLocator selectOption = pjq("input[name$=switchTypeInput][value=ajax]");
+ selenium.click(selectOption);
+ selenium.waitForPageToLoad();
+
+ testSwitchTypeNull();
+ }
+
+ @Test
+ public void testSwitchTypeClient() {
+ JQueryLocator selectOption = pjq("input[name$=switchTypeInput][value=client]");
+ selenium.click(selectOption);
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(link2);
+ waitGui.failWith("Item 2 is not displayed.").until(isDisplayed.locator(item2));
+
+ guardNoRequest(selenium).click(link1);
+ waitGui.failWith("Item 1 is not displayed.").until(isDisplayed.locator(item1));
+ }
+
+ @Test
+ public void testSwitchTypeServer() {
+ JQueryLocator selectOption = pjq("input[name$=switchTypeInput][value=server]");
+ selenium.click(selectOption);
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(link2);
+ waitGui.failWith("Item 2 is not displayed.").until(isDisplayed.locator(item2));
+
+ guardHttp(selenium).click(link1);
+ waitGui.failWith("Item 1 is not displayed.").until(isDisplayed.locator(item1));
+ }
+
+ @Test
+ public void testTitle() {
+ testTitle(item1);
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTogglePanelItem/TestRichTogglePanelItem.java
___________________________________________________________________
Name: svn:keywords
+ Revision
15 years, 5 months
JBoss Rich Faces SVN: r20293 - in modules/tests/metamer/trunk/application/src/main: resources/org/richfaces/tests/metamer/bean and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-02 06:02:09 -0500 (Thu, 02 Dec 2010)
New Revision: 20293
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.properties
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.java
Log:
https://jira.jboss.org/browse/RFPL-739
* added select options for dir and switchType
* bean modified to use new implementation of attributes
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.java 2010-12-02 10:35:22 UTC (rev 20292)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.java 2010-12-02 11:02:09 UTC (rev 20293)
@@ -54,7 +54,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getUIComponentAttributes(HtmlTogglePanelItem.class, getClass());
+ attributes = Attributes.getUIComponentAttributes(HtmlTogglePanelItem.class, getClass(), false);
attributes.setAttribute("name", "item1");
attributes.setAttribute("rendered", true);
Added: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.properties (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTogglePanelItemBean.properties 2010-12-02 11:02:09 UTC (rev 20293)
@@ -0,0 +1,8 @@
+attr.dir.ltr=ltr
+attr.dir.rtl=rtl
+attr.dir.null=
+
+attr.switchType.client=client
+attr.switchType.server=server
+attr.switchType.ajax=ajax
+attr.switchType.null=
\ No newline at end of file
15 years, 5 months