JBoss Rich Faces SVN: r20496 - trunk/ui/input/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-10 09:08:47 -0500 (Fri, 10 Dec 2010)
New Revision: 20496
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
Log:
https://issues.jboss.org/browse/RF-9916 calendar datamodel: add all the methods from 3.3.x back
Optimization AJAX response from server: excluding default values
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-10 14:04:18 UTC (rev 20495)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-10 14:08:47 UTC (rev 20496)
@@ -552,7 +552,7 @@
HashMap<String, Object> args = new HashMap<String, Object>();
args.put("startDate", formatStartDate(preloadDateRange[0]));
- args.put("days", calendarDataModelItems);
+ args.put("days", deleteEmptyPropeties(calendarDataModelItems));
return args;
}
}
@@ -568,6 +568,23 @@
return hashDate;
}
+ public ArrayList<Object> deleteEmptyPropeties(CalendarDataModelItem[] calendarDataModelItems) {
+ ArrayList<Object> hashItems = new ArrayList<Object>();
+ for (CalendarDataModelItem item : calendarDataModelItems) {
+ HashMap<String, Object> itemPropertiesMap = new HashMap<String, Object>();
+ if (null != item) {
+ if (!item.isEnabled()) {
+ itemPropertiesMap.put("enabled", item.isEnabled());
+ }
+ if (null != item.getStyleClass() && !item.getStyleClass().equalsIgnoreCase("")) {
+ itemPropertiesMap.put("styleClass", item.getStyleClass());
+ }
+ }
+ hashItems.add(itemPropertiesMap);
+ }
+ return hashItems;
+ }
+
public Date[] getPreloadDateRange() {
FacesContext facesContext = FacesContext.getCurrentInstance();
14 years, 1 month
JBoss Rich Faces SVN: r20494 - modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-10 06:39:02 -0500 (Fri, 10 Dec 2010)
New Revision: 20494
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml
Log:
* attribute oncollapse was renamed to onhide
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml 2010-12-10 10:45:10 UTC (rev 20493)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml 2010-12-10 11:39:02 UTC (rev 20494)
@@ -114,12 +114,12 @@
onbeforetimeselect="#{richCalendarBean.attributes['onbeforetimeselect'].value}"
onchange="#{richCalendarBean.attributes['onchange'].value}"
onclean="#{richCalendarBean.attributes['onclean'].value}"
- oncollapse="#{richCalendarBean.attributes['oncollapse'].value}"
oncomplete="#{richCalendarBean.attributes['oncomplete'].value}"
oncurrentdateselect="#{richCalendarBean.attributes['oncurrentdateselect'].value}"
ondatemouseout="#{richCalendarBean.attributes['ondatemouseout'].value}"
ondatemouseover="#{richCalendarBean.attributes['ondatemouseover'].value}"
ondateselect="#{richCalendarBean.attributes['ondateselect'].value}"
+ onhide="#{richCalendarBean.attributes['ondateselect'].value}"
oninputblur="#{richCalendarBean.attributes['oninputblur'].value}"
oninputchange="#{richCalendarBean.attributes['oninputchange'].value}"
oninputclick="#{richCalendarBean.attributes['oninputclick'].value}"
14 years, 1 month
JBoss Rich Faces SVN: r20493 - in trunk/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-12-10 05:45:10 -0500 (Fri, 10 Dec 2010)
New Revision: 20493
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
Log:
http://jira.jboss.com/jira/browse/RF-9835
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-12-10 10:38:18 UTC (rev 20492)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-12-10 10:45:10 UTC (rev 20493)
@@ -45,8 +45,8 @@
import javax.servlet.jsp.jstl.sql.Result;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
import org.richfaces.component.MetaComponentResolver;
@@ -208,9 +208,8 @@
ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement(HtmlConstants.SCRIPT_ELEM, component);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, "text/javascript", null);
- StringBuilder sb = new StringBuilder("\njQuery(RichFaces.getDomElement('");
- sb.append(component.getClientId(facesContext)).append("Items')).data({componentData:").append(ScriptUtils.toScript(fetchValues)).append("});\n");
- writer.write(sb.toString());
+ JSObject script = new JSObject("RichFaces.ui.Autocomplete.setData", component.getClientId(facesContext)+"Items", fetchValues);
+ writer.writeText(script, null);
writer.endElement(HtmlConstants.SCRIPT_ELEM);
}
}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-12-10 10:38:18 UTC (rev 20492)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-12-10 10:45:10 UTC (rev 20493)
@@ -465,4 +465,11 @@
}
};
})());
+
+ $.extend(rf.ui.Autocomplete, {
+ setData: function (id, data) {
+ $(rf.getDomElement(id)).data({componentData:data});
+ }
+ });
+
})(jQuery, RichFaces);
\ No newline at end of file
14 years, 1 month
JBoss Rich Faces SVN: r20492 - in modules/tests/metamer/trunk/application/src/main: resources/org/richfaces/tests/metamer/bean and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-10 05:38:18 -0500 (Fri, 10 Dec 2010)
New Revision: 20492
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/sideMenu.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/topMenu.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
https://issues.jboss.org/browse/RF-9795
* added two samples for rich:dropDownMenu
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-10 10:09:03 UTC (rev 20491)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-10 10:38:18 UTC (rev 20492)
@@ -127,6 +127,7 @@
components.put("richDataGrid", "Rich Data Grid");
components.put("richDataScroller", "Rich Data Scroller");
components.put("richDataTable", "Rich Data Table");
+ components.put("richDropDownMenu", "Rich Drop Down Menu");
components.put("richExtendedDataTable", "Rich Extended Data Table");
components.put("richFileUpload", "Rich File Upload");
components.put("richFunctions", "Rich Functions");
Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.java (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.java 2010-12-10 10:38:18 UTC (rev 20492)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.bean;
+
+import java.io.Serializable;
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import org.richfaces.component.UIDropDownMenu;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:dropDownMenu.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richDropDownMenuBean")
+@ViewScoped
+public class RichDropDownMenuBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static Logger logger;
+ private Attributes attributes;
+ private String current;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getUIComponentAttributes(UIDropDownMenu.class, getClass(), false);
+
+ attributes.setAttribute("mode", "ajax");
+ attributes.setAttribute("rendered", true);
+
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public String getCurrent() {
+ return this.current;
+ }
+
+ public void setCurrent(String current) {
+ this.current = current;
+ }
+
+ public String doNew() {
+ this.current = "New";
+ return null;
+ }
+
+ public String doOpen() {
+ this.current = "Open";
+ return null;
+ }
+
+ public String doClose() {
+ this.current = "Close";
+ return null;
+ }
+
+ public String doSave() {
+ this.current = "Save";
+ return null;
+ }
+
+ public String doSaveAll() {
+ this.current = "Save All";
+ return null;
+ }
+
+ public String doExit() {
+ this.current = "Exit";
+ return null;
+ }
+}
Property changes on: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.properties (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichDropDownMenuBean.properties 2010-12-10 10:38:18 UTC (rev 20492)
@@ -0,0 +1,3 @@
+attr.dir.ltr=ltr
+attr.dir.rtl=rtl
+attr.dir.null=
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml 2010-12-10 10:38:18 UTC (rev 20492)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Calendar</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="topMenu" outcome="topMenu" value="Top Menu">
+ Simple page containing a toolbar with several <b>rich:dropDownMenu</b>s and inputs for all attributes.
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="sideMenu" outcome="sideMenu" value="Side Menu">
+ Page containing several <b>rich:dropDownMenu</b>s and inputs for all attributes.
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/sideMenu.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/sideMenu.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/sideMenu.xhtml 2010-12-10 10:38:18 UTC (rev 20492)
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer" xmlns:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <style type="text/css">
+ .rf-ddm-lbl-unsel {
+ border:1px solid #{a4jSkin.panelBorderColor} !important;
+ }
+
+ .optionList {
+ height: 22px;
+ }
+
+ .vertical-menu-cell {
+ padding: 0px 4px 0px 4px;
+ }
+ </style>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <h:panelGrid styleClass="vertical-menu-cell" columnClasses="optionList" columns="1" cellspacing="0" cellpadding="0">
+ <rich:dropDownMenu id="menu1"
+ dir="#{richDropDownMenuBean.attributes['dir'].value}"
+ disabled="#{richDropDownMenuBean.attributes['disabled'].value}"
+ hideDelay="#{richDropDownMenuBean.attributes['hideDelay'].value}"
+ lang="#{richDropDownMenuBean.attributes['lang'].value}"
+ mode="#{richDropDownMenuBean.attributes['mode'].value}"
+ onclick="#{richDropDownMenuBean.attributes['onclick'].value}"
+ ondblclick="#{richDropDownMenuBean.attributes['ondblclick'].value}"
+ ongrouphide="#{richDropDownMenuBean.attributes['ongrouphide'].value}"
+ ongroupshow="#{richDropDownMenuBean.attributes['ongroupshow'].value}"
+ onhide="#{richDropDownMenuBean.attributes['onhide'].value}"
+ onitemclick="#{richDropDownMenuBean.attributes['onitemclick'].value}"
+ onkeydown="#{richDropDownMenuBean.attributes['onkeydown'].value}"
+ onkeypress="#{richDropDownMenuBean.attributes['onkeypress'].value}"
+ onkeyup="#{richDropDownMenuBean.attributes['onkeyup'].value}"
+ onmousedown="#{richDropDownMenuBean.attributes['onmousedown'].value}"
+ onmousemove="#{richDropDownMenuBean.attributes['onmousemove'].value}"
+ onmouseout="#{richDropDownMenuBean.attributes['onmouseout'].value}"
+ onmouseover="#{richDropDownMenuBean.attributes['onmouseover'].value}"
+ onmouseup="#{richDropDownMenuBean.attributes['onmouseup'].value}"
+ onshow="#{richDropDownMenuBean.attributes['onshow'].value}"
+ popupWith="#{richDropDownMenuBean.attributes['popupWith'].value}"
+ rendered="#{richDropDownMenuBean.attributes['rendered'].value}"
+ showDelay="#{richDropDownMenuBean.attributes['showDelay'].value}"
+ showEvent="#{richDropDownMenuBean.attributes['showEvent'].value}"
+ style="#{richDropDownMenuBean.attributes['style'].value}"
+ styleClass="#{richDropDownMenuBean.attributes['styleClass'].value}"
+ title="#{richDropDownMenuBean.attributes['title'].value}"
+ >
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage library="images/icons" name="copy.gif" styleClass="pic" />
+ <h:outputText value="File" />
+ </h:panelGroup>
+ </f:facet>
+
+ <rich:menuItem label="New" action="#{richDropDownMenuBean.doNew}" icon="/resources/images/icons/create_doc.gif"/>
+
+ <rich:menuItem label="Open" action="#{richDropDownMenuBean.doOpen}" icon="/resources/images/icons/open.gif" />
+
+ <rich:menuGroup label="Open Recent..." disabled="true">
+ <rich:menuItem label="Save" action="#{richDropDownMenuBean.doSave}" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ </rich:menuGroup>
+
+ <rich:menuSeparator id="menuSeparator11" />
+
+ <rich:menuGroup label="Save As...">
+ <rich:menuItem label="Save" action="#{richDropDownMenuBean.doSave}" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
+ </rich:menuGroup>
+
+ <rich:menuItem label="Print" action="#{richDropDownMenuBean.doPrint}" disabled="true"/>
+
+ <rich:menuItem label="Close" action="#{richDropDownMenuBean.doClose}" />
+
+ <rich:menuSeparator id="menuSeparator12" />
+
+ <rich:menuItem label="Exit" action="#{richDropDownMenuBean.doExit}" />
+
+ </rich:dropDownMenu>
+
+ <rich:dropDownMenu id="menu2" mode="ajax">
+ <f:facet name="label">
+ <h:panelGrid cellpadding="0" cellspacing="0" columns="2" style="vertical-align:middle">
+ Links
+ </h:panelGrid>
+ </f:facet>
+ <rich:menuItem submitMode="none" onclick="document.location.href='http://jboss.org/richfaces'">
+ <h:outputLink value="http://jboss.org/richfaces">
+ <h:outputText value="RichFaces Home Page"></h:outputText>
+ </h:outputLink>
+ </rich:menuItem>
+ <rich:menuItem submitMode="none" onclick="document.location.href='http://community.jboss.org/en/richfaces?view=discussions'">
+ <h:outputLink value="http://community.jboss.org/en/richfaces?view=discussions">RichFaces Forum</h:outputLink>
+ </rich:menuItem>
+ </rich:dropDownMenu>
+
+
+ <rich:dropDownMenu id="menu3" label="Search" direction="bottom-left" jointPoint="br" styleClass="search" mode="client">
+ <rich:menuItem>
+ <h:inputText id="searchinput" />
+ <button type="button">Search</button>
+ </rich:menuItem>
+ <rich:menuItem label="Enter your search criteria here" disabled="true"/>
+ </rich:dropDownMenu>
+
+ </h:panelGrid>
+
+ <br /><br />
+
+ <a4j:outputPanel ajaxRendered="true">
+ Current Selection:
+ <h:outputText id="output" style="font-weight:bold" value="#{richDropDownMenuBean.current}"></h:outputText>
+ </a4j:outputPanel>
+
+ <br /><br />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ Settings for first drop down menu:
+ <metamer:attributes value="#{richDropDownMenuBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/topMenu.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/topMenu.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/topMenu.xhtml 2010-12-10 10:38:18 UTC (rev 20492)
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer" xmlns:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j" xmlns:h="http://java.sun.com/jsf/html">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <style type="text/css">
+ .pic {
+ margin-bottom: -4px;
+ margin-right: 2px;
+ }
+
+ .search .rf-ddm-itm-sel {
+ background-color: transparent;
+ background-image:none;
+ border-color: transparent;
+ cursor: default;
+ }
+ </style>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:toolbar id="toolbar" height="26px">
+ <rich:dropDownMenu id="menu1"
+ dir="#{richDropDownMenuBean.attributes['dir'].value}"
+ disabled="#{richDropDownMenuBean.attributes['disabled'].value}"
+ hideDelay="#{richDropDownMenuBean.attributes['hideDelay'].value}"
+ lang="#{richDropDownMenuBean.attributes['lang'].value}"
+ mode="#{richDropDownMenuBean.attributes['mode'].value}"
+ onclick="#{richDropDownMenuBean.attributes['onclick'].value}"
+ ondblclick="#{richDropDownMenuBean.attributes['ondblclick'].value}"
+ ongrouphide="#{richDropDownMenuBean.attributes['ongrouphide'].value}"
+ ongroupshow="#{richDropDownMenuBean.attributes['ongroupshow'].value}"
+ onhide="#{richDropDownMenuBean.attributes['onhide'].value}"
+ onitemclick="#{richDropDownMenuBean.attributes['onitemclick'].value}"
+ onkeydown="#{richDropDownMenuBean.attributes['onkeydown'].value}"
+ onkeypress="#{richDropDownMenuBean.attributes['onkeypress'].value}"
+ onkeyup="#{richDropDownMenuBean.attributes['onkeyup'].value}"
+ onmousedown="#{richDropDownMenuBean.attributes['onmousedown'].value}"
+ onmousemove="#{richDropDownMenuBean.attributes['onmousemove'].value}"
+ onmouseout="#{richDropDownMenuBean.attributes['onmouseout'].value}"
+ onmouseover="#{richDropDownMenuBean.attributes['onmouseover'].value}"
+ onmouseup="#{richDropDownMenuBean.attributes['onmouseup'].value}"
+ onshow="#{richDropDownMenuBean.attributes['onshow'].value}"
+ popupWith="#{richDropDownMenuBean.attributes['popupWith'].value}"
+ rendered="#{richDropDownMenuBean.attributes['rendered'].value}"
+ showDelay="#{richDropDownMenuBean.attributes['showDelay'].value}"
+ showEvent="#{richDropDownMenuBean.attributes['showEvent'].value}"
+ style="#{richDropDownMenuBean.attributes['style'].value}"
+ styleClass="#{richDropDownMenuBean.attributes['styleClass'].value}"
+ title="#{richDropDownMenuBean.attributes['title'].value}"
+ >
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage library="images/icons" name="copy.gif" styleClass="pic" />
+ <h:outputText value="File" />
+ </h:panelGroup>
+ </f:facet>
+
+ <rich:menuItem label="New" action="#{richDropDownMenuBean.doNew}" icon="/resources/images/icons/create_doc.gif"/>
+
+ <rich:menuItem label="Open" action="#{richDropDownMenuBean.doOpen}" icon="/resources/images/icons/open.gif" />
+
+ <rich:menuGroup label="Open Recent..." disabled="true">
+ <rich:menuItem label="Save" action="#{richDropDownMenuBean.doSave}" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ </rich:menuGroup>
+
+ <rich:menuSeparator id="menuSeparator11" />
+
+ <rich:menuGroup label="Save As...">
+ <rich:menuItem label="Save" action="#{richDropDownMenuBean.doSave}" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem label="Save All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
+ </rich:menuGroup>
+
+ <rich:menuItem label="Print" action="#{richDropDownMenuBean.doPrint}" disabled="true"/>
+
+ <rich:menuItem label="Close" action="#{richDropDownMenuBean.doClose}" />
+
+ <rich:menuSeparator id="menuSeparator12" />
+
+ <rich:menuItem label="Exit" action="#{richDropDownMenuBean.doExit}" />
+
+ </rich:dropDownMenu>
+
+ <rich:dropDownMenu id="menu2" mode="ajax">
+ <f:facet name="label">
+ <h:panelGrid cellpadding="0" cellspacing="0" columns="2" style="vertical-align:middle">
+ Links
+ </h:panelGrid>
+ </f:facet>
+ <rich:menuItem submitMode="none" onclick="document.location.href='http://jboss.org/richfaces'">
+ <h:outputLink value="http://jboss.org/richfaces">
+ <h:outputText value="RichFaces Home Page"></h:outputText>
+ </h:outputLink>
+ </rich:menuItem>
+ <rich:menuItem submitMode="none" onclick="document.location.href='http://community.jboss.org/en/richfaces?view=discussions'">
+ <h:outputLink value="http://community.jboss.org/en/richfaces?view=discussions">RichFaces Forum</h:outputLink>
+ </rich:menuItem>
+ </rich:dropDownMenu>
+
+ <rich:toolbarGroup id="rightGroup" location="right">
+ <rich:dropDownMenu id="menu3" label="Search" direction="bottom-left" jointPoint="br" styleClass="search" mode="client">
+ <rich:menuItem>
+ <h:inputText id="searchinput" />
+ <button type="button">Search</button>
+ </rich:menuItem>
+ <rich:menuItem label="Enter your search criteria here" disabled="true"/>
+ </rich:dropDownMenu>
+ </rich:toolbarGroup>
+ </rich:toolbar>
+
+ <br /><br />
+
+ <a4j:outputPanel ajaxRendered="true">
+ Current Selection:
+ <h:outputText id="output" style="font-weight:bold" value="#{richDropDownMenuBean.current}"></h:outputText>
+ </a4j:outputPanel>
+
+ <br /><br />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ Settings for first drop down menu:
+ <metamer:attributes value="#{richDropDownMenuBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
14 years, 1 month
JBoss Rich Faces SVN: r20491 - trunk/ui/input/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-10 05:09:03 -0500 (Fri, 10 Dec 2010)
New Revision: 20491
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
Log:
https://issues.jboss.org/browse/RF-9983 Calendar: events collapse, complete and inputchange not fired
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-10 02:25:27 UTC (rev 20490)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-10 10:09:03 UTC (rev 20491)
@@ -292,7 +292,7 @@
public abstract String getOncomplete();
@Attribute(events = @EventName("hide"))
- public abstract String getOncollapse();
+ public abstract String getOnhide();
@Attribute(events = @EventName("datemouseout"))
public abstract String getOndatemouseout();
@@ -558,7 +558,7 @@
}
return null;
}
-
+
public static Object formatStartDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
14 years, 1 month
JBoss Rich Faces SVN: r20490 - in branches/RF-8742-1/ui/validator: api/src/main/java/org/richfaces/validator and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-09 21:25:27 -0500 (Thu, 09 Dec 2010)
New Revision: 20490
Added:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
Modified:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
Log:
RESOLVED - issue RF-9217: CSV: development tests for client side(qunit)
https://jira.jboss.org/browse/RF-9217
Added: branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
===================================================================
--- branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java (rev 0)
+++ branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -0,0 +1,47 @@
+/**
+ *
+ */
+package org.richfaces.javascript;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author asmirnov
+ *
+ */
+public final class Message {
+
+ private final int severity;
+ private final String detail;
+ private final String summary;
+
+ public Message(int severity,String detail,String summary) {
+ this.severity = severity;
+ this.detail = detail;
+ this.summary = summary;
+ }
+ public Message(FacesMessage msg) {
+ this.severity = msg.getSeverity().getOrdinal();
+ this.summary = msg.getSummary();
+ this.detail = msg.getDetail();
+ }
+ /**
+ * @return the severity
+ */
+ public int getSeverity() {
+ return severity;
+ }
+ /**
+ * @return the detail
+ */
+ public String getDetail() {
+ return detail;
+ }
+ /**
+ * @return the summary
+ */
+ public String getSummary() {
+ return summary;
+ }
+
+}
Property changes on: branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java
===================================================================
--- branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -2,8 +2,9 @@
import java.util.Map;
-import javax.faces.application.FacesMessage;
+import org.richfaces.javascript.Message;
+
/**
* <p class="changed_added_4_0">
* Inmlementations of this interface describe JSF or JSR-303 validators. Because JSF supports 2 types of validators,
@@ -40,5 +41,5 @@
*
* @return
*/
- FacesMessage getMessage();
+ Message getMessage();
}
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -45,6 +45,7 @@
import javax.faces.event.BehaviorEvent;
import javax.faces.render.ClientBehaviorRenderer;
import javax.faces.render.RenderKit;
+import javax.faces.validator.BeanValidator;
import javax.faces.validator.Validator;
import org.richfaces.application.ServiceTracker;
@@ -274,15 +275,18 @@
FacesValidatorService facesValidatorService = ServiceTracker.getService(facesContext,
FacesValidatorService.class);
for (Validator validator : facesValidators) {
- validators.add(facesValidatorService.getValidatorDescription(facesContext, validator));
+ if (validator instanceof BeanValidator) {
+ ValueExpression valueExpression = component.getValueExpression(VALUE);
+ if (null != valueExpression) {
+ BeanValidatorService beanValidatorService = ServiceTracker.getService(facesContext,
+ BeanValidatorService.class);
+ validators.addAll(beanValidatorService.getConstrains(facesContext, valueExpression, getGroups()));
+ }
+ } else {
+ validators.add(facesValidatorService.getValidatorDescription(facesContext, validator));
+ }
}
}
- ValueExpression valueExpression = component.getValueExpression(VALUE);
- if (null != valueExpression) {
- BeanValidatorService beanValidatorService = ServiceTracker.getService(facesContext,
- BeanValidatorService.class);
- validators.addAll(beanValidatorService.getConstrains(facesContext, valueExpression, getGroups()));
- }
return validators;
} else {
throw new FacesException("Component " + component.getClass().getName()
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -13,7 +13,7 @@
protected static final String EVENT = "event";
protected static final JSReference EVENT_LITERAL = new JSReference(EVENT);
protected static final String DISABLE_AJAX = "disableAjax";
- protected static final String EOL = "\n;";
+ protected static final String EOL = ";\n";
protected static final String CLIENT_ID = "clientId";
protected static final JSReference CLIENT_ID_LITERAL = new JSReference(CLIENT_ID);
protected static final String SOURCE_ID = "sourceId";
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -4,6 +4,8 @@
import javax.faces.application.FacesMessage;
+import org.richfaces.javascript.Message;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
@@ -11,12 +13,12 @@
private final Class<? extends T> converterClass;
private Map<String, Object> parameters = Maps.newHashMap();
- private final FacesMessage message;
+ private final Message message;
public BaseFacesObjectDescriptor(Class<? extends T> converterClass, FacesMessage message) {
this.converterClass = converterClass;
- this.message = message;
+ this.message = new Message(message);
}
public Class<?> getImplementationClass() {
@@ -27,7 +29,7 @@
return parameters;
}
- public FacesMessage getMessage() {
+ public Message getMessage() {
return message;
}
Modified: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml 2010-12-10 02:25:27 UTC (rev 20490)
@@ -6,10 +6,6 @@
<name>csv.reslib</name>
<library>org.richfaces</library>
</resource>
- <resource>
- <name>number-converter.js</name>
- <library>org.richfaces</library>
- </resource>
<function>RichFaces.csv.convertNumber</function>
</component>
<component>
@@ -18,10 +14,6 @@
<name>csv.reslib</name>
<library>org.richfaces</library>
</resource>
- <resource>
- <name>length-validator.js</name>
- <library>org.richfaces</library>
- </resource>
<function>RichFaces.csv.validateLength</function>
</component>
</scripts>
\ No newline at end of file
Modified: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-10 02:25:27 UTC (rev 20490)
@@ -2,38 +2,38 @@
rf.csv = rf.csv || {};
- var _messages = {};
var RE_MESSAGE_PATTERN = /\{(\d+)\}/g;
+ function _interpolateMessage(customMessage, values) {
+ var message = customMessage || "";
+ if (message) {
+ var msgObject = message.replace(RE_MESSAGE_PATTERN,"\n$1\n").split("\n");
+ var value;
+ for (var i=1; i<msgObject.length; i+=2) {
+ value = values[msgObject[i]];
+ msgObject[i] = typeof value == "undefined" ? "" : value;
+ }
+ message = msgObject.join('');
+ }
+ return message;
+ }
+
$.extend(rf.csv, {
RE_DIGITS: /^-?\d+$/,
RE_FLOAT: /^(-?\d+)?(\.(\d+)?(e[+-]?\d+)?)?$/,
MESSAGE_EVENT_NAME: "onmessage."+rf.Event.RICH_NAMESPACE,
// Messages API
- addMessage: function (messagesObject) {
- $.extend(_messages, messagesObject);
+ getMessage :function(facesMessage,values){
+ return {detail:_interpolateMessage(facesMessage.detail,values),summary:_interpolateMessage(facesMessage.summary,values)};
},
- getMessage: function(customMessage, messageId, values) {
- var message = customMessage || _messages[messageId] || "";
- if (message) {
- var msgObject = message.replace(RE_MESSAGE_PATTERN,"\n$1\n").split("\n");
- var value;
- for (var i=1; i<msgObject.length; i+=2) {
- value = values[msgObject[i]];
- msgObject[i] = typeof value == "undefined" ? "" : value;
- }
- message = msgObject.join('');
- }
- return {message:message};
- },
sendMessage: function (componentId, message) {
- rf.Event.fireById(document, MESSAGE_EVENT_NAME, message);
- rf.Event.fireById(componentId, MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(document, rf.csv.MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(componentId, rf.csv.MESSAGE_EVENT_NAME, message);
},
clearMessage: function (componentId) {
- rf.Event.fireById(document, MESSAGE_EVENT_NAME, message);
- rf.Event.fireById(componentId, MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(document, rf.csv.MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(componentId, rf.csv.MESSAGE_EVENT_NAME, message);
},
getValue: function (clientId, element){
var value;
@@ -82,6 +82,16 @@
result = value=='true' ? true : value.length<1 ? null : false;
return result;
},
+ // Validators
+ validateLength: function(value,message,params){
+ if (params.maximum && value.length > params.maximum) {
+ throw rf.csv.getMessage(message, [params.minimum,params.maximum]);
+ }
+ if (params.minimum && value.length < params.minimum) {
+ throw rf.csv.getMessage(message, [params.minimum,params.maximum]);
+ }
+
+ },
addFormValidators: function (formId, callValidatorFunctions) {
}
Modified: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties 2010-12-10 02:25:27 UTC (rev 20490)
@@ -1 +1 @@
-resources=jquery.js, richfaces.js, richfaces-event.js, org.richfaces:richfaces-csv.js
\ No newline at end of file
+resources=jquery.js, richfaces.js, richfaces-event.js, org.richfaces:csv.js
\ No newline at end of file
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -5,10 +5,11 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
import java.util.Collection;
import javax.el.ValueExpression;
-import javax.faces.application.FacesMessage;
+import javax.faces.validator.BeanValidator;
import javax.faces.validator.Validator;
import javax.validation.groups.Default;
@@ -20,6 +21,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.javascript.Message;
import org.richfaces.validator.BeanValidatorService;
import org.richfaces.validator.FacesValidatorService;
import org.richfaces.validator.ValidatorDescriptor;
@@ -39,7 +41,7 @@
@RunWith(MockTestRunner.class)
public class BehaviorGetValidatorTest extends BehaviorTestBase {
- private static final FacesMessage VALIDATION_ERROR = new FacesMessage("Validation Error");
+ private static final Message VALIDATION_ERROR = new Message(3,"Error","Validation Error");
private static final Class<?>[] DEFAULT_GROUP = { Default.class };
@@ -96,6 +98,7 @@
}
private void setupBeanValidator(ValidatorDescriptor... validators) {
+ expect(input.getValidators()).andStubReturn(new Validator[]{new BeanValidator()});
expect(validatorService.getConstrains(environment.getFacesContext(), expression, DEFAULT_GROUP)).andStubReturn(
Lists.newArrayList(validators));
@@ -133,7 +136,6 @@
@Test
public void testBeanValidators() throws Exception {
- setupComponentValidator();
setupBeanValidator(beanValidatorDescriptor);
Collection<ValidatorDescriptor> validators = checkValidator();
assertEquals(1, validators.size());
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -12,6 +12,7 @@
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.richfaces.javascript.Message;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
@@ -34,11 +35,17 @@
@Before
public void setUp() {
- this.facesEnvironment = MockFacesEnvironment.createEnvironment();
+ this.facesEnvironment = MockFacesEnvironment.createEnvironment().withApplication().resetToNice();
component = facesEnvironment.createMock(UIComponent.class);
+ recordMocks();
facesEnvironment.replay();
}
+ protected void recordMocks() {
+ // template method to record mock objects
+
+ }
+
@After
public void tearDown() {
this.facesEnvironment.verify();
@@ -46,8 +53,8 @@
this.facesEnvironment = null;
}
- protected Object getErrorMessage() {
- return ImmutableMap.of("detail","error");
+ protected Message getErrorMessage() {
+ return new Message(2,"error","script error");
}
protected Object getJavaScriptOptions() {
Added: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java (rev 0)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -0,0 +1,63 @@
+/**
+ *
+ */
+package org.richfaces.javascript.client.validator;
+
+import static org.easymock.EasyMock.anyObject;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.validator.LengthValidator;
+import javax.faces.validator.Validator;
+
+import org.junit.runners.Parameterized.Parameters;
+import org.richfaces.javascript.client.TestCriteria;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LengthValidatorTest extends ValidatorTestBase {
+
+ private static final String MINIMUM = "minimum";
+ private static final String MAXIMUM = "maximum";
+ /**
+ * @param criteria
+ */
+ public LengthValidatorTest(TestCriteria criteria) {
+ super(criteria);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.javascript.client.validator.ValidatorTestBase#createValidator()
+ */
+ @Override
+ protected Validator createValidator() {
+ LengthValidator validator = new LengthValidator();
+ Map<String, Object> options = criteria.getOptions();
+ if(options.containsKey(MINIMUM)){
+ validator.setMinimum((Integer) options.get(MINIMUM));
+ }
+ if(options.containsKey(MAXIMUM)){
+ validator.setMaximum((Integer) options.get(MAXIMUM));
+ }
+ return validator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.javascript.client.MockTestBase#getJavaScriptFunctionName()
+ */
+ @Override
+ protected String getJavaScriptFunctionName() {
+ return "validateLength";
+ }
+
+ @Parameters
+ public static List<TestCriteria[]> parameters() {
+ return options(pass(""),pass("aaa"),pass("123"),
+ pass("",MINIMUM,2),pass("vv",MINIMUM,2),pass("vvv",MINIMUM,2),
+ pass("",MAXIMUM,2),pass("vv",MAXIMUM,2),pass("123",MAXIMUM,2),
+ pass("",MINIMUM,3,MAXIMUM,5),pass("ddd",MINIMUM,3,MAXIMUM,5),pass("dddd",MINIMUM,3,MAXIMUM,5),pass("abcdefg",MINIMUM,3,MAXIMUM,5));
+ }
+}
Property changes on: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -1,17 +1,42 @@
package org.richfaces.javascript.client.validator;
+import static org.easymock.EasyMock.expect;
import static org.junit.Assert.*;
+import java.util.Collections;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import javax.validation.ValidationException;
+
+import net.sourceforge.htmlunit.corejs.javascript.JavaScriptException;
+import net.sourceforge.htmlunit.corejs.javascript.NativeObject;
+
+import org.ajax4jsf.javascript.JSFunction;
import org.junit.Test;
import org.richfaces.javascript.client.MockTestBase;
import org.richfaces.javascript.client.TestCriteria;
+import com.gargoylesoftware.htmlunit.ScriptException;
+
public abstract class ValidatorTestBase extends MockTestBase {
+ private static final Converter NUMBER_CONVERTER = new Converter() {
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+
+ return String.valueOf(value);
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ return Double.valueOf(value);
+ }
+ };
+
public ValidatorTestBase(TestCriteria criteria) {
super(criteria);
}
@@ -28,15 +53,31 @@
try {
validateOnClient();
assertFalse("JSF validator throws exception for value: "+criteria.getValue(),true);
- } catch (Exception e2) {
+ } catch (ScriptException e2) {
// both methods throws exceptions - it's ok.
+ e2.printStackTrace();
+ Throwable cause = e2.getCause();
+ assertTrue(cause instanceof JavaScriptException);
+ NativeObject value = (NativeObject) ((JavaScriptException)cause).getValue();
+ assertEquals(getErrorMessage().getDetail(), value.get("detail"));
}
}
}
- protected void validateOnClient() throws ValidationException {
-
+ protected Object validateOnClient() throws ValidationException {
+ JSFunction clientSideFunction = new JSFunction("RichFaces.csv." + getJavaScriptFunctionName(),criteria.getValue(),getErrorMessage(),getJavaScriptOptions());
+ return qunit.runScript(clientSideFunction.toScript());
+
}
protected abstract Validator createValidator();
+
+
+ @Override
+ protected void recordMocks() {
+ super.recordMocks();
+ expect(component.getAttributes()).andStubReturn(Collections.EMPTY_MAP);
+ expect(component.getClientId(facesEnvironment.getFacesContext())).andStubReturn("testComponent");
+ expect(facesEnvironment.getApplication().createConverter("javax.faces.Number")).andStubReturn(NUMBER_CONVERTER);
+ }
}
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -200,11 +200,11 @@
}
private LibraryScriptFunction createValidatorFunction() {
- return createFunction(REGEX_VALIDATOR, ClientValidatorRenderer.CONVERTED_VALUE_VAR, VALIDATOR_MESSAGE);
+ return createFunction(REGEX_VALIDATOR, ClientValidatorRenderer.CONVERTED_VALUE_VAR, FACES_VALIDATOR_MESSAGE);
}
private LibraryScriptFunction createConverterFunction() {
- return createFunction(NUMBER_CONVERTER, ClientValidatorRenderer.VALUE_VAR, VALIDATOR_MESSAGE);
+ return createFunction(NUMBER_CONVERTER, ClientValidatorRenderer.VALUE_VAR, FACES_VALIDATOR_MESSAGE);
}
private LibraryScriptFunction createFunction(final String name, String var, FacesMessage validatorMessage) {
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-12-10 01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-12-10 02:25:27 UTC (rev 20490)
@@ -8,6 +8,7 @@
import org.jboss.test.faces.mock.Mock;
import org.richfaces.component.behavior.BehaviorTestBase;
import org.richfaces.component.behavior.ClientValidatorBehavior;
+import org.richfaces.javascript.Message;
import org.richfaces.resource.ResourceKey;
import com.google.common.collect.ImmutableMap;
@@ -17,7 +18,8 @@
protected static final String CLIENT_VALIDATORS_JS = "clientValidators.js";
protected static final String ORG_RICHFACES = "org.richfaces";
protected static final String REGEX_VALIDATOR = "regexValidator";
- protected static final FacesMessage VALIDATOR_MESSAGE = new FacesMessage("Validator Message");
+ protected static final FacesMessage FACES_VALIDATOR_MESSAGE = new FacesMessage("Validator Message");
+ protected static final Message VALIDATOR_MESSAGE = new Message(FACES_VALIDATOR_MESSAGE);
protected static final Map<String, ? extends Object> VALIDATOR_PARAMS = ImmutableMap.of("foo", "value", "bar", 10);
protected static final Iterable<ResourceKey> CLIENT_VALIDATOR_LIBRARY = Collections.singleton(ResourceKey.create(CLIENT_VALIDATORS_JS,ORG_RICHFACES));
14 years, 1 month
JBoss Rich Faces SVN: r20489 - in trunk: core/impl/src/main/java/org/richfaces/application and 15 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-09 20:00:49 -0500 (Thu, 09 Dec 2010)
New Revision: 20489
Added:
trunk/core/api/src/main/java/org/richfaces/resource/AbstractJSONResource.java
trunk/core/api/src/main/java/org/richfaces/resource/ContentProducerResource.java
trunk/core/impl/src/main/java/org/richfaces/context/SkinningExternalContextFactory.java
trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarResource.java
Removed:
trunk/core/api/src/main/java/org/richfaces/resource/Java2DUserResourceWrapper.java
trunk/core/api/src/main/java/org/richfaces/resource/UserResourceWrapper.java
trunk/core/impl/src/main/java/org/richfaces/application/SkinningExternalContextFactory.java
trunk/ui/core/ui/src/main/resources/META-INF/org.richfaces.resource.PushResource.resource.properties
Modified:
trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
trunk/core/api/src/main/java/org/richfaces/resource/UserResource.java
trunk/core/impl/src/main/java/org/richfaces/resource/Java2DUserResourceWrapperImpl.java
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
trunk/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
trunk/core/impl/src/main/java/org/richfaces/resource/UserResourceWrapperImpl.java
trunk/core/impl/src/main/java/org/richfaces/util/Util.java
trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml
trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
trunk/core/impl/src/test/java/org/richfaces/resource/UserResourcesTestCase.java
trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java
trunk/ui/core/ui/src/main/java/org/richfaces/resource/PushResource.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/NumberUtils.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
trunk/ui/output/ui/src/main/templates/progressBar.template.xml
Log:
Resources refactoring:
- Added ContentProducerResource + handling
- Dynamic resources updated to use encode() instead of getInputStream()
- Removed wrapper interfaces & added factory methods for creation of wrappers for dynamic resources
- Removed PushResource marker file (not necessary)
- Added JSONResource
SkinningExternalContextFactory:
- Moved to 'context' package
- Changed mime-type for *.ecss files to vendor-specific
richfaces.js
- Added richfaces.parseJSON method
progress bar component:
- Added handling for 'resource' attribute + demo
Added: trunk/core/api/src/main/java/org/richfaces/resource/AbstractJSONResource.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/AbstractJSONResource.java (rev 0)
+++ trunk/core/api/src/main/java/org/richfaces/resource/AbstractJSONResource.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -0,0 +1,47 @@
+/*
+ * 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.resource;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.javascript.ScriptUtils;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@DynamicResource
+public abstract class AbstractJSONResource extends AbstractUserResource {
+
+ public String getContentType() {
+ return "text/javascript; charset=utf-8";
+ }
+
+ public void encode(FacesContext context) throws IOException {
+ ScriptUtils.appendScript(context.getExternalContext().getResponseOutputWriter(), getData(context));
+ }
+
+ protected abstract Object getData(FacesContext context);
+
+}
Added: trunk/core/api/src/main/java/org/richfaces/resource/ContentProducerResource.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/ContentProducerResource.java (rev 0)
+++ trunk/core/api/src/main/java/org/richfaces/resource/ContentProducerResource.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -0,0 +1,36 @@
+/*
+ * 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.resource;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ContentProducerResource {
+
+ public void encode(FacesContext context) throws IOException;
+
+}
Deleted: trunk/core/api/src/main/java/org/richfaces/resource/Java2DUserResourceWrapper.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/Java2DUserResourceWrapper.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/api/src/main/java/org/richfaces/resource/Java2DUserResourceWrapper.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -1,35 +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.resource;
-
-import javax.faces.FacesWrapper;
-
-
-/**
- * @author Nick Belaevski
- *
- */
-public interface Java2DUserResourceWrapper extends FacesWrapper<Java2DUserResource> {
-
- public Java2DUserResource getWrapped();
-
-}
Modified: trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -44,4 +44,8 @@
public abstract Resource createResource(FacesContext context, ResourceRequestData resourceData);
+ public abstract Resource createResource(UserResource resource);
+
+ public abstract Resource createResource(Java2DUserResource resource);
+
}
Modified: trunk/core/api/src/main/java/org/richfaces/resource/UserResource.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/UserResource.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/api/src/main/java/org/richfaces/resource/UserResource.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -21,8 +21,6 @@
*/
package org.richfaces.resource;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.Date;
import java.util.Map;
@@ -30,15 +28,12 @@
* @author Nick Belaevski
*
*/
-//TODO nick - add abstract class
-public interface UserResource {
+public interface UserResource extends ContentProducerResource {
public Map<String, String> getResponseHeaders();
public Date getLastModified();
- public InputStream getInputStream() throws IOException;
-
public String getContentType();
public int getContentLength();
Deleted: trunk/core/api/src/main/java/org/richfaces/resource/UserResourceWrapper.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/UserResourceWrapper.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/api/src/main/java/org/richfaces/resource/UserResourceWrapper.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -1,34 +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.resource;
-
-import javax.faces.FacesWrapper;
-
-/**
- * @author Nick Belaevski
- *
- */
-public interface UserResourceWrapper extends FacesWrapper<UserResource> {
-
- public UserResource getWrapped();
-
-}
Deleted: trunk/core/impl/src/main/java/org/richfaces/application/SkinningExternalContextFactory.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/SkinningExternalContextFactory.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/java/org/richfaces/application/SkinningExternalContextFactory.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -1,88 +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.application;
-
-import javax.faces.FacesException;
-import javax.faces.FacesWrapper;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.ExternalContextFactory;
-import javax.faces.context.ExternalContextWrapper;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class SkinningExternalContextFactory extends ExternalContextFactory implements FacesWrapper<ExternalContextFactory> {
-
- private ExternalContextFactory factory;
-
- private static final class ExternalContextWrapperImpl extends ExternalContextWrapper {
-
- private ExternalContext externalContext;
-
- public ExternalContextWrapperImpl(ExternalContext externalContext) {
- super();
- this.externalContext = externalContext;
- }
-
- @Override
- public String getMimeType(String file) {
- String mimeType;
-
- if (file != null && file.endsWith(".ecss")) {
- mimeType = "text/plain";
- } else {
- mimeType = super.getMimeType(file);
- }
-
- return mimeType;
- }
-
- @Override
- public ExternalContext getWrapped() {
- return externalContext;
- }
-
- }
-
- public SkinningExternalContextFactory(ExternalContextFactory factory) {
- super();
- this.factory = factory;
- }
-
- @Override
- public ExternalContextFactory getWrapped() {
- return factory;
- }
-
- @Override
- public ExternalContext getExternalContext(Object context, Object request, Object response) throws FacesException {
- ExternalContext externalContext = factory.getExternalContext(context, request, response);
-
- return wrap(externalContext);
- }
-
- private ExternalContext wrap(ExternalContext externalContext) {
- return new ExternalContextWrapperImpl(externalContext);
- }
-
-}
Copied: trunk/core/impl/src/main/java/org/richfaces/context/SkinningExternalContextFactory.java (from rev 20481, trunk/core/impl/src/main/java/org/richfaces/application/SkinningExternalContextFactory.java)
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/context/SkinningExternalContextFactory.java (rev 0)
+++ trunk/core/impl/src/main/java/org/richfaces/context/SkinningExternalContextFactory.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -0,0 +1,88 @@
+/*
+ * 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.context;
+
+import javax.faces.FacesException;
+import javax.faces.FacesWrapper;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.ExternalContextFactory;
+import javax.faces.context.ExternalContextWrapper;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class SkinningExternalContextFactory extends ExternalContextFactory implements FacesWrapper<ExternalContextFactory> {
+
+ private ExternalContextFactory factory;
+
+ private static final class ExternalContextWrapperImpl extends ExternalContextWrapper {
+
+ private ExternalContext externalContext;
+
+ public ExternalContextWrapperImpl(ExternalContext externalContext) {
+ super();
+ this.externalContext = externalContext;
+ }
+
+ @Override
+ public String getMimeType(String file) {
+ String mimeType;
+
+ if (file != null && file.endsWith(".ecss")) {
+ mimeType = "text/vnd.richfaces.css";
+ } else {
+ mimeType = super.getMimeType(file);
+ }
+
+ return mimeType;
+ }
+
+ @Override
+ public ExternalContext getWrapped() {
+ return externalContext;
+ }
+
+ }
+
+ public SkinningExternalContextFactory(ExternalContextFactory factory) {
+ super();
+ this.factory = factory;
+ }
+
+ @Override
+ public ExternalContextFactory getWrapped() {
+ return factory;
+ }
+
+ @Override
+ public ExternalContext getExternalContext(Object context, Object request, Object response) throws FacesException {
+ ExternalContext externalContext = factory.getExternalContext(context, request, response);
+
+ return wrap(externalContext);
+ }
+
+ private ExternalContext wrap(ExternalContext externalContext) {
+ return new ExternalContextWrapperImpl(externalContext);
+ }
+
+}
Modified: trunk/core/impl/src/main/java/org/richfaces/resource/Java2DUserResourceWrapperImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/resource/Java2DUserResourceWrapperImpl.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/java/org/richfaces/resource/Java2DUserResourceWrapperImpl.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -24,8 +24,6 @@
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
@@ -35,25 +33,34 @@
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageOutputStream;
+import org.ajax4jsf.io.ByteBuffer;
+import org.ajax4jsf.io.FastBufferInputStream;
+import org.ajax4jsf.io.FastBufferOutputStream;
import org.ajax4jsf.util.HtmlColor;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
import org.richfaces.renderkit.util.HtmlDimensions;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
+import com.google.common.io.Closeables;
+
/**
* @author Nick Belaevski
*
*/
-public class Java2DUserResourceWrapperImpl extends BaseResourceWrapper<Java2DUserResource>
- implements Java2DUserResourceWrapper {
+public class Java2DUserResourceWrapperImpl extends BaseResourceWrapper<Java2DUserResource> {
+ private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
+
public Java2DUserResourceWrapperImpl(Java2DUserResource resourceObject, boolean cacheable, boolean versioned) {
super(resourceObject, cacheable, versioned);
}
public InputStream getInputStream() throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(baos);
+ FastBufferOutputStream fbos = new FastBufferOutputStream();
+
+ ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(fbos);
try {
paintAndWrite(imageOutputStream);
} finally {
@@ -61,12 +68,16 @@
try {
imageOutputStream.close();
} catch (IOException e) {
- // TODO: handle exception
- e.printStackTrace();
+ LOGGER.debug(e.getMessage(), e);
}
+
+ Closeables.closeQuietly(fbos);
}
}
- return new ByteArrayInputStream(baos.toByteArray());
+ ByteBuffer buffer = fbos.getFirstBuffer();
+ buffer.compact();
+
+ return new FastBufferInputStream(buffer);
}
protected void write(BufferedImage image, String formatName, ImageOutputStream imageOutputStream) throws IOException {
Modified: trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -207,18 +207,24 @@
}
}
+ private boolean isCacheableSet(Class<?> c) {
+ DynamicUserResource annotation = c.getAnnotation(DynamicUserResource.class);
+ return annotation != null && annotation.cacheable();
+ }
+
+ private boolean isVersionedSet(Class<?> c) {
+ DynamicUserResource annotation = c.getAnnotation(DynamicUserResource.class);
+ return annotation != null && annotation.versioned();
+ }
+
private Resource createDynamicUserResourceInstance(Class<?> loadedClass) throws Exception, LinkageError {
String resourceName = loadedClass.getName();
boolean checkResult = false;
- boolean cacheable = false;
- boolean versioned = false;
DynamicUserResource dynamicUserResource = loadedClass.getAnnotation(DynamicUserResource.class);
if (dynamicUserResource != null) {
- cacheable = dynamicUserResource.cacheable();
- versioned = dynamicUserResource.versioned();
checkResult = true;
LOGGER.debug(MessageFormat.format("Dynamic resource annotation is present on resource class {0}",
@@ -246,17 +252,14 @@
return null;
}
- BaseResourceWrapper<?> result = null;
+ Resource result = null;
- if (Java2DAnimatedUserResource.class.isAssignableFrom(loadedClass)) {
- Java2DAnimatedUserResource java2DAnimatedUserResource = (Java2DAnimatedUserResource) loadedClass.newInstance();
- result = new Java2DAnimatedUserResourceWrapperImpl(java2DAnimatedUserResource, cacheable, versioned);
- } else if (Java2DUserResource.class.isAssignableFrom(loadedClass)) {
+ if (Java2DUserResource.class.isAssignableFrom(loadedClass)) {
Java2DUserResource java2DUserResource = (Java2DUserResource) loadedClass.newInstance();
- result = new Java2DUserResourceWrapperImpl(java2DUserResource, cacheable, versioned);
+ result = createResource(java2DUserResource);
} else if (UserResource.class.isAssignableFrom(loadedClass)) {
UserResource userResource = (UserResource) loadedClass.newInstance();
- result = new UserResourceWrapperImpl(userResource, cacheable, versioned);
+ result = createResource(userResource);
}
return result;
@@ -472,4 +475,23 @@
public Collection<ResourceKey> getMappedDynamicResourceKeys() {
return Collections.unmodifiableSet(mappedResourceDataMap.keySet());
}
+
+ public Resource createResource(Java2DUserResource resource) {
+ boolean cacheable = isCacheableSet(resource.getClass());
+ boolean versioned = isVersionedSet(resource.getClass());
+
+ if (resource instanceof Java2DAnimatedUserResource) {
+ Java2DAnimatedUserResource java2DAnimatedUserResource = (Java2DAnimatedUserResource) resource;
+ return new Java2DAnimatedUserResourceWrapperImpl(java2DAnimatedUserResource, cacheable, versioned);
+ } else {
+ return new Java2DUserResourceWrapperImpl(resource, cacheable, versioned);
+ }
+ }
+
+ public Resource createResource(UserResource resource) {
+ boolean cacheable = isCacheableSet(resource.getClass());
+ boolean versioned = isVersionedSet(resource.getClass());
+
+ return new UserResourceWrapperImpl(resource, cacheable, versioned);
+ }
}
Modified: trunk/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -35,7 +35,6 @@
import javax.faces.application.ResourceHandlerWrapper;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.richfaces.application.ServiceTracker;
@@ -222,16 +221,14 @@
externalContext.setResponseContentType(contentType);
}
- // TODO - portlets
- HttpServletRequest httpServletRequest = (HttpServletRequest) externalContext.getRequest();
-
- if (!"HEAD".equals(httpServletRequest.getMethod())) {
-
- // TODO 'HEAD' HTTP method resources - ?
+ if (resource instanceof ContentProducerResource) {
+ ContentProducerResource contentProducerResource = (ContentProducerResource) resource;
+ contentProducerResource.encode(context);
+ } else {
// TODO setup output buffer size according to configuration parameter
InputStream is = resource.getInputStream();
OutputStream os = externalContext.getResponseOutputStream();
-
+
try {
Util.copyStreamContent(is, os);
} finally {
@@ -244,11 +241,12 @@
}
}
}
-
+
// TODO flush resource
// TODO dispose resource
}
}
+
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Resource succesfully encoded");
Modified: trunk/core/impl/src/main/java/org/richfaces/resource/UserResourceWrapperImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/resource/UserResourceWrapperImpl.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/java/org/richfaces/resource/UserResourceWrapperImpl.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -21,26 +21,152 @@
*/
package org.richfaces.resource;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
import java.util.Date;
import java.util.Map;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.ExternalContextWrapper;
import javax.faces.context.FacesContext;
+import javax.faces.context.FacesContextWrapper;
+import org.ajax4jsf.io.ByteBuffer;
+import org.ajax4jsf.io.FastBufferInputStream;
+import org.ajax4jsf.io.FastBufferOutputStream;
+import org.richfaces.util.Util;
+
/**
* @author Nick Belaevski
*
*/
-public class UserResourceWrapperImpl extends BaseResourceWrapper<UserResource> implements UserResourceWrapper {
+public class UserResourceWrapperImpl extends BaseResourceWrapper<UserResource> implements ContentProducerResource {
+ private static final InputStream EMPTY_STREAM = new ByteArrayInputStream(new byte[0]);
+
+ private static final class FacesContextWrapperImpl extends FacesContextWrapper {
+
+ private FacesContext facesContext;
+
+ private ExternalContextWrapperImpl externalContext;
+
+ private FacesContextWrapperImpl(FacesContext facesContext, ExternalContextWrapperImpl externalContextWrapper) {
+ super();
+
+ this.facesContext = facesContext;
+ this.externalContext = externalContextWrapper;
+ }
+
+ @Override
+ public FacesContext getWrapped() {
+ return facesContext;
+ }
+
+ @Override
+ public ExternalContextWrapperImpl getExternalContext() {
+ return externalContext;
+ }
+
+ public static FacesContextWrapperImpl wrap(Charset charset) {
+ FacesContext originalFacesContext = FacesContext.getCurrentInstance();
+
+ ExternalContextWrapperImpl externalContextWrapper = new ExternalContextWrapperImpl(originalFacesContext.getExternalContext(), charset);
+ FacesContextWrapperImpl facesContextWrapper = new FacesContextWrapperImpl(originalFacesContext, externalContextWrapper);
+
+ setCurrentInstance(facesContextWrapper);
+ return facesContextWrapper;
+ }
+
+ public static void unwrap() {
+ FacesContext originalContext = ((FacesContextWrapper) FacesContext.getCurrentInstance()).getWrapped();
+ setCurrentInstance(originalContext);
+ }
+
+ public InputStream getWrittenDataAsStream() throws IOException {
+ return externalContext.getWrittenDataAsStream();
+ }
+ }
+
+ private static final class ExternalContextWrapperImpl extends ExternalContextWrapper {
+
+ private FastBufferOutputStream stream = null;
+
+ private Writer writer = null;
+
+ private ExternalContext externalContext;
+
+ private Charset charset;
+
+ public ExternalContextWrapperImpl(ExternalContext externalContext, Charset charset) {
+ super();
+
+ this.externalContext = externalContext;
+ this.charset = charset;
+ }
+
+ @Override
+ public ExternalContext getWrapped() {
+ return externalContext;
+ }
+
+ @Override
+ public FastBufferOutputStream getResponseOutputStream() {
+ if (stream == null) {
+ stream = new FastBufferOutputStream();
+ }
+
+ return stream;
+ }
+
+ @Override
+ public Writer getResponseOutputWriter() {
+ if (writer == null) {
+ writer = new OutputStreamWriter(getResponseOutputStream(), charset);
+ }
+
+ return writer;
+ }
+
+ public InputStream getWrittenDataAsStream() throws IOException {
+ flushBuffers();
+
+ if (stream != null) {
+ ByteBuffer firstBuffer = stream.getFirstBuffer();
+ firstBuffer.compact();
+ return new FastBufferInputStream(firstBuffer);
+ } else {
+ return EMPTY_STREAM;
+ }
+ }
+
+ private void flushBuffers() throws IOException {
+ if (writer != null) {
+ writer.flush();
+ } else if (stream != null) {
+ stream.flush();
+ }
+ }
+ }
+
public UserResourceWrapperImpl(UserResource resourceObject, boolean cacheable, boolean versioned) {
super(resourceObject, cacheable, versioned);
}
@Override
public InputStream getInputStream() throws IOException {
- return getWrapped().getInputStream();
+ Charset charset = Util.getCharsetFromContentType(getContentType());
+ FacesContextWrapperImpl wrappedContext = FacesContextWrapperImpl.wrap(charset);
+ try {
+ encode(wrappedContext);
+
+ return wrappedContext.getWrittenDataAsStream();
+ } finally {
+ FacesContextWrapperImpl.unwrap();
+ }
}
@Override
@@ -62,5 +188,9 @@
protected Date getLastModified(FacesContext context) {
return getWrapped().getLastModified();
}
+
+ public void encode(FacesContext context) throws IOException {
+ getWrapped().encode(context);
+ }
}
Modified: trunk/core/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/util/Util.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/java/org/richfaces/util/Util.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -85,6 +85,8 @@
import org.richfaces.log.RichfacesLogger;
import org.richfaces.resource.StateHolderResource;
+import com.google.common.base.Strings;
+
/**
* @author Nick Belaevski
* @since 4.0
@@ -115,6 +117,8 @@
private static final String QUESTION_SIGN = "?";
private static final String EQUALS_SIGN = "=";
+ private static final Pattern CHARSET_IN_CONTENT_TYPE_PATTERN = Pattern.compile(";\\s*charset\\s*=\\s*([^\\s;]+)", Pattern.CASE_INSENSITIVE);
+
static {
SimpleDateFormat format = new SimpleDateFormat(RFC1123_DATE_PATTERN, Locale.US);
@@ -616,4 +620,16 @@
stateHolder.restoreState(context, state);
}
}
+
+ public static Charset getCharsetFromContentType(String contentType) {
+ String charsetName = null;
+
+ Matcher matcher = CHARSET_IN_CONTENT_TYPE_PATTERN.matcher(contentType);
+ if (matcher.find()) {
+ charsetName = matcher.group(1);
+ }
+
+ return Strings.isNullOrEmpty(charsetName) ? Charset.defaultCharset() : Charset.forName(charsetName);
+ }
+
}
Modified: trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml 2010-12-10 01:00:49 UTC (rev 20489)
@@ -4,7 +4,7 @@
version="2.0">
<factory>
- <external-context-factory>org.richfaces.application.SkinningExternalContextFactory</external-context-factory>
+ <external-context-factory>org.richfaces.context.SkinningExternalContextFactory</external-context-factory>
<partial-view-context-factory>org.richfaces.context.PartialViewContextFactoryImpl</partial-view-context-factory>
</factory>
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-12-10 01:00:49 UTC (rev 20489)
@@ -331,9 +331,7 @@
var JSON_STRING_START = /^\s*(\[|\{)/;
- var getJSONData = function(extensionElement, elementName) {
- var dataString = jQuery.trim(extensionElement.children(elementName).text());
- extensionElement.end();
+ richfaces.parseJSON = function(dataString) {
try {
if (dataString) {
if (JSON_STRING_START.test(dataString)) {
@@ -346,7 +344,14 @@
} catch (e) {
richfaces.log.warn("Error evaluating JSON data from element <" + elementName + ">: " + e.message);
}
+
return null;
+ }
+
+ var getJSONData = function(extensionElement, elementName) {
+ var dataString = jQuery.trim(extensionElement.children(elementName).text());
+ extensionElement.end();
+ return richfaces.parseJSON(dataString);
};
richfaces.createJSFEventsAdapter = function(handlers) {
Modified: trunk/core/impl/src/test/java/org/richfaces/resource/UserResourcesTestCase.java
===================================================================
--- trunk/core/impl/src/test/java/org/richfaces/resource/UserResourcesTestCase.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/core/impl/src/test/java/org/richfaces/resource/UserResourcesTestCase.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -27,7 +27,6 @@
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Date;
import java.util.Map;
@@ -41,9 +40,7 @@
import org.junit.Before;
import org.junit.Test;
-import com.google.common.io.ByteStreams;
-
/**
* @author Nick Belaevski
*
@@ -52,10 +49,10 @@
protected static class BaseUserResource extends AbstractUserResource {
- public InputStream getInputStream() throws IOException {
- return ByteStreams.newInputStreamSupplier(getClass().getSimpleName().getBytes("US-ASCII")).getInput();
+ public void encode(FacesContext facesContext) throws IOException {
+ facesContext.getResponseWriter().write(getClass().getSimpleName());
}
-
+
public String getContentType() {
return "text/plain";
}
Added: trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarResource.java
===================================================================
--- trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarResource.java (rev 0)
+++ trunk/examples/output-demo/src/main/java/org/richfaces/ProgressBarResource.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -0,0 +1,54 @@
+/*
+ * 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;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.AbstractJSONResource;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ProgressBarResource extends AbstractJSONResource {
+
+ private static final String ATTRIBUTE_NAME = ProgressBarResource.class.getName();
+
+ @Override
+ protected Object getData(FacesContext context) {
+ Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
+
+ Integer value = (Integer) sessionMap.get(ATTRIBUTE_NAME);
+ if (value == null) {
+ value = Integer.valueOf(0);
+ } else {
+ value = Integer.valueOf(value.intValue() + 5);
+ }
+
+ sessionMap.put(ATTRIBUTE_NAME, value);
+
+ return value;
+ }
+
+}
Modified: trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/examples/output-demo/src/main/webapp/examples/progressbar.xhtml 2010-12-10 01:00:49 UTC (rev 20489)
@@ -114,6 +114,26 @@
<a4j:commandLink value="re-render progress bar" render="progressBar" />
</h:form>
+
+ <h:form id="ajaxExtResourcePBForm">
+ Ajax mode with GET requests:
+ <rich:progressBar id="progressBar" mode="ajax" interval="2000" resource="#{resource['org.richfaces.ProgressBarResource']}"
+ maxValue="#{progressBarBean.maxValue}" minValue="#{progressBarBean.minValue}"
+ enabled="#{progressBarBean.enabled}">
+
+ <f:facet name="initial">
+ <h:panelGroup rendered="#{progressBarBean.initialFacetRendered}">
+ <h:outputText value="initial" />
+ </h:panelGroup>
+ </f:facet>
+
+ <f:facet name="finish">
+ <h:panelGroup rendered="#{progressBarBean.finishFacetRendered}">
+ <h:outputText value="finish" />
+ </h:panelGroup>
+ </f:facet>
+ </rich:progressBar>
+ </h:form>
</ui:define>
</ui:composition>
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -28,12 +28,11 @@
import javax.el.MethodExpression;
import javax.faces.application.Resource;
-import javax.faces.application.ResourceHandler;
import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import org.ajax4jsf.resource.ResourceComponent2;
+import org.richfaces.application.ServiceTracker;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
@@ -42,7 +41,7 @@
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.resource.MediaOutputResource;
-import org.richfaces.resource.UserResourceWrapper;
+import org.richfaces.resource.ResourceFactory;
/**
* @author shura
@@ -120,14 +119,12 @@
}
public Resource getResource() {
- FacesContext facesContext = getFacesContext();
- ResourceHandler resourceHandler = facesContext.getApplication().getResourceHandler();
- Resource resource = resourceHandler.createResource(MediaOutputResource.class.getName());
+ ResourceFactory factory = ServiceTracker.getService(ResourceFactory.class);
- MediaOutputResource mediaResource = (MediaOutputResource) ((UserResourceWrapper) resource).getWrapped();
- mediaResource.initialize(this);
-
- return resource;
+ MediaOutputResource mediaOutputResource = new MediaOutputResource();
+ mediaOutputResource.initialize(this);
+
+ return factory.createResource(mediaOutputResource);
}
@Attribute
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -23,12 +23,9 @@
package org.richfaces.resource;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Date;
-import java.util.Map;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
@@ -43,7 +40,7 @@
* @since 4.0
*/
@DynamicResource
-public class MediaOutputResource implements StateHolder, UserResource, CacheableResource {
+public class MediaOutputResource extends AbstractUserResource implements StateHolder, CacheableResource {
private String contentType;
@@ -62,15 +59,11 @@
private ValueExpression timeToLiveExpression;
private Object userData;
- public InputStream getInputStream() throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- contentProducer.invoke(facesContext.getELContext(), new Object[] {baos, userData});
-
- return new ByteArrayInputStream(baos.toByteArray());
+ public void encode(FacesContext facesContext) throws IOException {
+ OutputStream outStream = facesContext.getExternalContext().getResponseOutputStream();
+ contentProducer.invoke(facesContext.getELContext(), new Object[] {outStream, userData});
}
-
+
public boolean isTransient() {
return false;
}
@@ -135,14 +128,6 @@
return null;
}
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
public String getContentType() {
return contentType;
}
@@ -151,7 +136,4 @@
this.contentType = contentType;
}
- public int getContentLength() {
- return -1;
- }
}
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/resource/PushResource.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/resource/PushResource.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/resource/PushResource.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -21,17 +21,13 @@
*/
package org.richfaces.resource;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Date;
+import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
-import javax.faces.FacesException;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -47,31 +43,12 @@
*
*/
@DynamicResource
-public class PushResource implements UserResource {
+public class PushResource extends AbstractUserResource {
private static final String PUSH_TOPIC_PARAM = "pushTopic";
private static final String FORGET_PUSH_SESSION_ID_PARAM = "forgetPushSessionId";
- private static final InputStream EMPTY_INPUT_STREAM = new ByteArrayInputStream(new byte[0]);
-
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
- private InputStream mapToScript(Map<String, Object> map) {
- try {
- byte[] bs = ScriptUtils.toScript(map).getBytes("UTF-8");
- return new ByteArrayInputStream(bs);
- } catch (UnsupportedEncodingException e) {
- throw new FacesException(e.getMessage(), e);
- }
- }
-
private Map<String, String> getFailuresMap(Map<TopicKey, String> failedSubscriptions) {
Map<String,String> result = new HashMap<String, String>();
@@ -82,15 +59,14 @@
return result;
}
- public InputStream getInputStream() throws IOException {
- FacesContext facesContext = FacesContext.getCurrentInstance();
+ public void encode(FacesContext facesContext) throws IOException {
ExternalContext externalContext = facesContext.getExternalContext();
PushContextFactory pushContextFactory = ServiceTracker.getService(PushContextFactory.class);
//resource plugin stub
if (pushContextFactory == null) {
- return EMPTY_INPUT_STREAM;
+ return;
}
PushContext pushContext = pushContextFactory.getPushContext();
@@ -119,15 +95,12 @@
Map<TopicKey, String> failedSubscriptions = session.getFailedSubscriptions();
subscriptionData.put("failures", getFailuresMap(failedSubscriptions));
- return mapToScript(subscriptionData);
+ Writer outWriter = facesContext.getExternalContext().getResponseOutputWriter();
+ ScriptUtils.appendScript(outWriter, subscriptionData);
}
-
+
public String getContentType() {
- return "application/javascript; charset=utf-8";
+ return "text/javascript; charset=utf-8";
}
- public int getContentLength() {
- return -1;
- }
-
}
Deleted: trunk/ui/core/ui/src/main/resources/META-INF/org.richfaces.resource.PushResource.resource.properties
===================================================================
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/NumberUtils.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/NumberUtils.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/NumberUtils.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -2,7 +2,13 @@
import java.math.BigDecimal;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+
public final class NumberUtils {
+
+ private static final Logger LOGGER = RichfacesLogger.COMPONENTS.getLogger();
+
private NumberUtils() {
}
@@ -31,7 +37,7 @@
}
}
} catch (Exception e) {
- e.getMessage();
+ LOGGER.error(e.getMessage(), e);
}
return result;
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-12-10 01:00:49 UTC (rev 20489)
@@ -93,7 +93,11 @@
* @param component
* @return
*/
- public boolean isAjaxMode(UIComponent component) {
+ protected boolean isAjaxMode(UIComponent component) {
+ if (isResourceMode(component)) {
+ return false;
+ }
+
SwitchType mode = (SwitchType) component.getAttributes().get("mode");
if (mode == SwitchType.server) {
@@ -103,19 +107,27 @@
return SwitchType.ajax == mode;
}
+ protected boolean isResourceMode(UIComponent component) {
+ return component.getAttributes().get("resource") != null;
+ }
+
protected ProgressBarState getCurrentState(FacesContext context, UIComponent component){
- Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue"));
- Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue"));
- Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
-
ProgressBarState result;
- if (value.doubleValue() < minValue.doubleValue()) {
+ if (isResourceMode(component)) {
result = ProgressBarState.initialState;
- } else if (value.doubleValue() >= maxValue.doubleValue()) {
- result = ProgressBarState.finishState;
} else {
- result = ProgressBarState.progressState;
+ Number minValue = NumberUtils.getNumber(component.getAttributes().get("minValue"));
+ Number maxValue = NumberUtils.getNumber(component.getAttributes().get("maxValue"));
+ Number value = NumberUtils.getNumber(component.getAttributes().get("value"));
+
+ if (value.doubleValue() < minValue.doubleValue()) {
+ result = ProgressBarState.initialState;
+ } else if (value.doubleValue() >= maxValue.doubleValue()) {
+ result = ProgressBarState.finishState;
+ } else {
+ result = ProgressBarState.progressState;
+ }
}
if (result == ProgressBarState.initialState || result == ProgressBarState.finishState) {
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-12-10 01:00:49 UTC (rev 20489)
@@ -23,9 +23,12 @@
this.enabled = this.options.enabled;
this.minValue = this.options.minValue;
this.maxValue = this.options.maxValue;
- this.__setValue(this.options.value);
- if (this.options.submitFunction) {
+ this.__setValue(this.options.value || this.options.minValue /* TODO - check with Ilya */);
+
+ if (this.options.resource) {
+ this.__poll();
+ } else if (this.options.submitFunction) {
this.submitFunction = new Function("beforeUpdateHandler", "afterUpdateHandler", "params", "event", this.options.submitFunction);
this.__poll();
}
@@ -67,9 +70,22 @@
this.__poll();
},
+ __onResourceDataAvailable: function(data) {
+ var parsedData = rf.parseJSON(data);
+ if (parsedData instanceof Number || typeof parsedData == 'number') {
+ this.setValue(parsedData);
+ }
+
+ this.__poll();
+ },
+
__submit: function() {
- this.submitFunction.call(this, $.proxy(this.__beforeUpdate, this), $.proxy(this.__afterUpdate, this),
- this.__params || {});
+ if (this.submitFunction) {
+ this.submitFunction.call(this, $.proxy(this.__beforeUpdate, this), $.proxy(this.__afterUpdate, this),
+ this.__params || {});
+ } else {
+ $.get(this.options.resource, this.__params || {}, $.proxy(this.__onResourceDataAvailable, this), 'text');
+ }
},
__poll: function(immediate) {
@@ -158,7 +174,7 @@
},
isAjaxMode: function () {
- return !!this.submitFunction;
+ return !!this.submitFunction || !!this.options.resource;
},
disable: function () {
Modified: trunk/ui/output/ui/src/main/templates/progressBar.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/progressBar.template.xml 2010-12-09 20:26:00 UTC (rev 20488)
+++ trunk/ui/output/ui/src/main/templates/progressBar.template.xml 2010-12-10 01:00:49 UTC (rev 20489)
@@ -38,7 +38,7 @@
<cdk:scriptOption name="minValue" value="#{component.attributes['minValue']}" defaultValue="0" />
<cdk:scriptOption name="maxValue" value="#{component.attributes['maxValue']}" defaultValue="100" />
- <cdk:scriptOption attributes="interval enabled value onfinish" />
+ <cdk:scriptOption attributes="interval enabled value onfinish resource" />
</cdk:scriptObject>
new RichFaces.ui.ProgressBar(#{toScriptArgs(clientId, options)});
14 years, 1 month
JBoss Rich Faces SVN: r20487 - in trunk: ui/input/ui/src/main/java/org/richfaces/context and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-09 13:53:59 -0500 (Thu, 09 Dec 2010)
New Revision: 20487
Modified:
trunk/examples/input-demo/src/main/java/org/richfaces/demo/FileUploadBean.java
trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java
Log:
RF-9972
Modified: trunk/examples/input-demo/src/main/java/org/richfaces/demo/FileUploadBean.java
===================================================================
--- trunk/examples/input-demo/src/main/java/org/richfaces/demo/FileUploadBean.java 2010-12-09 18:51:56 UTC (rev 20486)
+++ trunk/examples/input-demo/src/main/java/org/richfaces/demo/FileUploadBean.java 2010-12-09 18:53:59 UTC (rev 20487)
@@ -53,9 +53,6 @@
public void listener(UploadEvent event) throws Exception {
item = event.getUploadItem();
- if (item != null) {
- item.getFile().delete();
- }
}
public void setEnabled(boolean enabled) {
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-09 18:51:56 UTC (rev 20486)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-09 18:53:59 UTC (rev 20487)
@@ -34,6 +34,8 @@
import javax.faces.context.FacesContext;
import javax.faces.context.PartialViewContext;
import javax.faces.context.PartialViewContextFactory;
+import javax.faces.context.PartialViewContextWrapper;
+import javax.faces.event.PhaseId;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -85,6 +87,7 @@
@Override
public PartialViewContext getPartialViewContext(FacesContext facesContext) {
+ PartialViewContext partialViewContext = parentFactory.getPartialViewContext(facesContext);
ExternalContext externalContext = facesContext.getExternalContext();
HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
Map<String, String> queryParamMap = parseQueryString(request.getQueryString());
@@ -93,9 +96,35 @@
if (maxRequestSize != 0 && externalContext.getRequestContentLength() > maxRequestSize) {
printResponse(facesContext, uid, ResponseState.sizeExceeded);
} else {
- MultipartRequest multipartRequest = new MultipartRequest(request, createTempFiles, tempFilesDirectory,
- uid);
+ final MultipartRequest multipartRequest = new MultipartRequest(request, createTempFiles,
+ tempFilesDirectory, uid);
try {
+ final PartialViewContext viewContext = partialViewContext;
+ partialViewContext = new PartialViewContextWrapper() {
+ @Override
+ public void processPartial(PhaseId phaseId) {
+ try {
+ super.processPartial(phaseId);
+ } finally {
+ if (PhaseId.RENDER_RESPONSE.equals(phaseId)) {
+ multipartRequest.cancel();
+ //TODO PartialViewContext.release isn't invoked by JSF. Maybe it's a bug.
+ //So we should use PartialViewContext.processPartial instead of.
+ }
+ }
+ };
+
+ //TODO This method can be removed from here when PartialViewContextWrapper will implement it.
+ @Override
+ public void setPartialRequest(boolean isPartialRequest) {
+ viewContext.setPartialRequest(isPartialRequest);
+ }
+
+ @Override
+ public PartialViewContext getWrapped() {
+ return viewContext;
+ }
+ };
multipartRequest.parseRequest();
if (!multipartRequest.isDone()) {
printResponse(facesContext, uid, ResponseState.stopped);
@@ -109,7 +138,7 @@
}
}
}
- return parentFactory.getPartialViewContext(facesContext);
+ return partialViewContext;
}
private Map<String, String> parseQueryString(String queryString) {
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java 2010-12-09 18:51:56 UTC (rev 20486)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/request/FileParam.java 2010-12-09 18:53:59 UTC (rev 20487)
@@ -87,6 +87,7 @@
dir = new File(tempFilesDirectory);
}
tempFile = File.createTempFile(UUID.randomUUID().toString(), ".upload", dir);
+ tempFile.deleteOnExit();
fOut = new FileOutputStream(tempFile);
} catch (IOException ex) {
if (fOut != null) {
14 years, 1 month
JBoss Rich Faces SVN: r20486 - branches/RF-8742-1/ui/validator/ui.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-09 13:51:56 -0500 (Thu, 09 Dec 2010)
New Revision: 20486
Modified:
branches/RF-8742-1/ui/validator/ui/pom.xml
Log:
CODING IN PROGRESS - issue RF-9217: CSV: development tests for client side(qunit)
https://jira.jboss.org/browse/RF-9217
Modified: branches/RF-8742-1/ui/validator/ui/pom.xml
===================================================================
--- branches/RF-8742-1/ui/validator/ui/pom.xml 2010-12-09 18:45:48 UTC (rev 20485)
+++ branches/RF-8742-1/ui/validator/ui/pom.xml 2010-12-09 18:51:56 UTC (rev 20486)
@@ -102,8 +102,27 @@
<dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-jetty</artifactId>
+ <version>1.0.6-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-test-stage</artifactId>
+ <version>1.0.6-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-mock</artifactId>
+ <version>1.0.6-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>htmlunit-client</artifactId>
+ <version>1.0.6-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.test-jsf</groupId>
<artifactId>jsf-test-qunit</artifactId>
14 years, 1 month
JBoss Rich Faces SVN: r20485 - modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-09 13:45:48 -0500 (Thu, 09 Dec 2010)
New Revision: 20485
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml
Log:
* changed listener for collapsible panel
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml 2010-12-09 17:53:09 UTC (rev 20484)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml 2010-12-09 18:45:48 UTC (rev 20485)
@@ -73,7 +73,7 @@
styleClass="#{richCollapsiblePanelBean.attributes['styleClass'].value}"
switchType="#{richCollapsiblePanelBean.attributes['switchType'].value}"
title="#{richCollapsiblePanelBean.attributes['title'].value}"
- toggleListener="#{richCollapsiblePanelBean.toggleListener}"
+ toggleListener="#{richCollapsiblePanelBean.panelToggleListener}"
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus a neque turpis, at cursus nunc.
14 years, 1 month