JBoss Rich Faces SVN: r20145 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-11-23 06:33:21 -0500 (Tue, 23 Nov 2010)
New Revision: 20145
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCalendarBean.java
Log:
* scope of bean changed to view
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCalendarBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCalendarBean.java 2010-11-23 10:22:00 UTC (rev 20144)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCalendarBean.java 2010-11-23 11:33:21 UTC (rev 20145)
@@ -26,7 +26,7 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
import org.richfaces.component.UICalendar;
import org.richfaces.tests.metamer.Attributes;
@@ -40,7 +40,7 @@
* @version $Revision$
*/
@ManagedBean(name = "richCalendarBean")
-@SessionScoped
+@ViewScoped
public class RichCalendarBean implements Serializable {
private static final long serialVersionUID = -1L;
14 years, 1 month
JBoss Rich Faces SVN: r20144 - trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-11-23 05:22:00 -0500 (Tue, 23 Nov 2010)
New Revision: 20144
Modified:
trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml
trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
Log:
https://jira.jboss.org/browse/RFPL-924 - corrections in web.xml for GAE (production set) and appengine-web.xml(name correction)
Modified: trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml 2010-11-23 09:48:04 UTC (rev 20143)
+++ trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/appengine-web.xml 2010-11-23 10:22:00 UTC (rev 20144)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
- <application>richfaces-showcase-gae</application>
+ <application>richfaces-showcase</application>
<version>11</version>
<sessions-enabled>true</sessions-enabled>
Modified: trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-11-23 09:48:04 UTC (rev 20143)
+++ trunk/examples/richfaces-showcase/src/main/webapp-gae/WEB-INF/web.xml 2010-11-23 10:22:00 UTC (rev 20144)
@@ -30,7 +30,7 @@
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
- <param-value>Development</param-value>
+ <param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
14 years, 1 month
JBoss Rich Faces SVN: r20143 - trunk/examples/richfaces-showcase/src/main/webapp/templates.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-11-23 04:48:04 -0500 (Tue, 23 Nov 2010)
New Revision: 20143
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml
Log:
https://jira.jboss.org/browse/RFPL-926
new analytics account created for (richfaces-showcase.appspot.com) and identificator update in script performed.
Modified: trunk/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml 2010-11-23 06:02:55 UTC (rev 20142)
+++ trunk/examples/richfaces-showcase/src/main/webapp/templates/main.xhtml 2010-11-23 09:48:04 UTC (rev 20143)
@@ -12,17 +12,15 @@
<title>Components Gallery</title>
<script type="text/javascript">
var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-7306415-3']);
+ _gaq.push(['_setAccount', 'UA-7306415-4']);
_gaq.push(['_trackPageview']);
+
(function() {
- if (window.location.hostname.indexOf("appspot.com") != -1) {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- }
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
-
-</script>
+</script>
</h:head>
<h:body>
<h:outputStylesheet library="org.richfaces.showcase" name="page.ecss" />
14 years, 1 month
JBoss Rich Faces SVN: r20142 - modules/docs/trunk/Component_Reference/src/main/docbook/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-11-23 01:02:55 -0500 (Tue, 23 Nov 2010)
New Revision: 20142
Modified:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
Log:
Updated inplaceSelect based on tech review
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-11-23 00:29:47 UTC (rev 20141)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-11-23 06:02:55 UTC (rev 20142)
@@ -606,10 +606,34 @@
By default, the event to switch the component to the "edit" state is a single mouse click. This can be changed using the <varname>editEvent</varname> attribute to specify a different event. When switching to "edit" mode, the drop-down list of possible values will automatically be displayed; this can be deactivated by setting <code><varname>openOnEdit</varname>="false"</code>.
</para>
<para>
- Once the user selects an option from the drop-down list, the item becomes the new value for the component and the state is switched to the "changed" state. Alternatively, buttons for confirming or canceling can be added to the component by setting <code>showControls="true"</code>. These buttons can be positioned using the <varname>controlsHorizontalPosition</varname> attribute with settings of <literal>left</literal>, <literal>right</literal>, or <literal>center</literal>, and the <varname>controlsVerticalPosition</varname> attribute with settings <literal>bottom</literal>, <literal>center</literal>, or <literal>top</literal>. The confirmation control icons can be altered using the <varname>saveControlIcon</varname> and <varname>cancelControlIcon</varname>. Further customization is possible through the use of facets.
+ Once a new value for the control is saved, the state switches to the "changed" state. Saving a new value for the control can be performed in three different ways:
</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Once the user selects an item from the drop-down list, the item is saved as the new control value. This is the default setting.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If <code>saveOnBlur="true"</code> is set, the selected item is saved as the new control value when the control loses focus.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If <code>showControls="true"</code> is set, buttons are added to the control to confirm or cancel the selection. The new control value is only saved once the user confirms the selection using the button.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <!-- TODO not in M4 -->
+ <!--
+ <para>
+ These buttons can be positioned using the <varname>controlsHorizontalPosition</varname> attribute with settings of <literal>left</literal>, <literal>right</literal>, or <literal>center</literal>, and the <varname>controlsVerticalPosition</varname> attribute with settings <literal>bottom</literal>, <literal>center</literal>, or <literal>top</literal>. The confirmation control icons can be altered using the <varname>saveControlIcon</varname> and <varname>cancelControlIcon</varname>. Further customization is possible through the use of facets.
+ </para>
+ -->
</section>
-
+
+ <!--
<section id="sect-Component_Reference-richinplaceInput-richinplaceSelect_events">
<title><sgmltag><rich:inplaceSelect></sgmltag> events</title>
<para>
@@ -638,6 +662,7 @@
</listitem>
</itemizedlist>
</section>
+ -->
<section id="sect-Component_Reference-richinplaceSelect-Reference_data">
<title>Reference data</title>
@@ -847,18 +872,18 @@
<example id="exam-Component_Reference-richselect-Selection_items">
<title>Selection items</title>
<variablelist>
- <varlistentry>
- <term>Using multiple <sgmltag><f:selectItem></sgmltag> tags</term>
- <listitem>
- <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richselect-Selection_items-0.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>Using a single <sgmltag><f:selectItems></sgmltag> tag</term>
- <listitem>
- <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richselect-Selection_items-1.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- </listitem>
- </varlistentry>
+ <varlistentry>
+ <term>Using multiple <sgmltag><f:selectItem></sgmltag> tags</term>
+ <listitem>
+ <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richselect-Selection_items-0.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Using a single <sgmltag><f:selectItems></sgmltag> tag</term>
+ <listitem>
+ <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richselect-Selection_items-1.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ </listitem>
+ </varlistentry>
</variablelist>
</example>
<para>
@@ -872,7 +897,7 @@
Use the <varname>defaultLabel</varname> attribute to set a place-holder label, such as <code>defaultLabel="select an option"</code>.
</para>
<para>
- Server-side processing occurs in the same manner as for an <sgmltag><h:selectOneMenu></sgmltag> component. As such, custom objects used for selection items should use the same converters as for an <sgmltag><h:selectOneMenu></sgmltag> component.
+ Server-side processing occurs in the same manner as for an <sgmltag><h:selectOneMenu></sgmltag> component. As such, custom objects used for selection items should use the same converters as for an <sgmltag><h:selectOneMenu></sgmltag> component.
</para>
</section>
14 years, 1 month
JBoss Rich Faces SVN: r20141 - in branches/RF-8742-1: ui/input/ui/src/main/java/org/richfaces/utils and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-11-22 19:29:47 -0500 (Mon, 22 Nov 2010)
New Revision: 20141
Modified:
branches/RF-8742-1/
branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
branches/RF-8742-1/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
Log:
Merged revisions 20135-20136 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r20135 | amarkhel | 2010-11-22 11:18:00 -0800 (Mon, 22 Nov 2010) | 1 line
https://jira.jboss.org/browse/RF-9685 Calendar component: client-side events
.......
r20136 | amarkhel | 2010-11-22 11:20:23 -0800 (Mon, 22 Nov 2010) | 1 line
https://jira.jboss.org/browse/RF-9685 Calendar component: client-side events
.......
Property changes on: branches/RF-8742-1
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-20132
+ /trunk:1-20140
Modified: branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java 2010-11-22 23:44:11 UTC (rev 20140)
+++ branches/RF-8742-1/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java 2010-11-23 00:29:47 UTC (rev 20141)
@@ -33,6 +33,7 @@
import javax.faces.FacesException;
import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
@@ -126,7 +127,9 @@
return result;
}
- public static Locale getAsLocale(FacesContext facesContext, AbstractCalendar calendar) {
+ public static Locale getAsLocale(FacesContext facesContext, UIComponent component) {
+ AbstractCalendar calendar=(AbstractCalendar) component;
+
if (calendar == null || facesContext == null) {
return null;
}
Modified: branches/RF-8742-1/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
===================================================================
--- branches/RF-8742-1/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-11-22 23:44:11 UTC (rev 20140)
+++ branches/RF-8742-1/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-11-23 00:29:47 UTC (rev 20141)
@@ -267,6 +267,10 @@
var defaultLabels = {apply:'Apply', today:'Today', clean:'Clean', ok:'OK', cancel:'Cancel', close:'x'};
+ var eventHandlerNames = ["change", "dateselect", "dateselected", "currentdateselect",
+ "currentdateselected", "currentdateselect", "clean", "complete", "collapse",
+ "datemouseout", "datemouseover", "expand", "timeselect", "timeselected"];
+
// Constructor definition
rf.ui.Calendar = function(componentId, locale, options, markups) {
@@ -497,8 +501,13 @@
//alert(new Date().getTime()-_d.getTime());
//define isAjaxMode variable
- "ajax" == this.params.mode ? this.isAjaxMode = true : this.isAjaxMode = false;
-
+ "ajax" == this.params.mode ? this.isAjaxMode = true : this.isAjaxMode = false;
+
+ //events handler binding
+ for (var i in eventHandlerNames) {
+ var handler = this.params["on"+eventHandlerNames[i]];
+ if (handler) rf.Event.bindById(this.id, eventHandlerNames[i], handler, this);
+ }
};
// Extend component class and add protected methods from parent class to our container
@@ -963,7 +972,7 @@
if (field.value!=dateStr)
{
field.value=dateStr;
- this.invokeEvent("changed",field, event, this.selectedDate);
+ this.invokeEvent("change",field, event, this.selectedDate);
}
},
@@ -1122,7 +1131,7 @@
}
},
- indexData: function(daysData, isAjaxMode) {
+ indexData:function(daysData, isAjaxMode) {
var dateYear = daysData.startDate.year;
var dateMonth = daysData.startDate.month;
@@ -1668,7 +1677,7 @@
this.invokeEvent("dateselected", null, null, null);
this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
-
+ this.invokeEvent("clean", null, null, null);
this.renderHF();
if (!this.params.showApplyButton)
{
14 years, 1 month
JBoss Rich Faces SVN: r20140 - branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-11-22 18:44:11 -0500 (Mon, 22 Nov 2010)
New Revision: 20140
Modified:
branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/DynamicResourcesScanner.java
branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java
Log:
CODING IN PROGRESS - issue RF-9799: CSV code review
https://jira.jboss.org/browse/RF-9799
Modified: branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/DynamicResourcesScanner.java
===================================================================
--- branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/DynamicResourcesScanner.java 2010-11-22 20:13:07 UTC (rev 20139)
+++ branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/DynamicResourcesScanner.java 2010-11-22 23:44:11 UTC (rev 20140)
@@ -54,7 +54,7 @@
@Override
public ResourceKey apply(Class<?> from) {
- ResourceKey key = new ResourceKey(from.getName());
+ ResourceKey key = ResourceKey.create(from.getName());
return key;
}
Modified: branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java
===================================================================
--- branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java 2010-11-22 20:13:07 UTC (rev 20139)
+++ branches/RF-8742-1/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java 2010-11-22 23:44:11 UTC (rev 20140)
@@ -52,7 +52,7 @@
Collection<VirtualFile> children = file.getChildren();
for (VirtualFile child : children) {
if (child.isFile()) {
- resources.add(new ResourceKey(child.getName()));
+ resources.add(ResourceKey.create(child.getName()));
} else {
String libraryName = child.getName();
VirtualFile libraryDir = ResourceUtil.getLatestVersion(child, true);
14 years, 1 month
JBoss Rich Faces SVN: r20139 - sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-11-22 15:13:07 -0500 (Mon, 22 Nov 2010)
New Revision: 20139
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java
Log:
RF-9497
Modified: sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java 2010-11-22 20:07:38 UTC (rev 20138)
+++ sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java 2010-11-22 20:13:07 UTC (rev 20139)
@@ -53,7 +53,7 @@
super.decode(context);
Object request = context.getExternalContext().getRequest();
if (request instanceof MultipartRequest) {
- queueEvent(new UploadEvent(this, ((MultipartRequest)request).getUploadItems()));
+ queueEvent(new UploadEvent(this, ((MultipartRequest) request).getUploadItems()));
}
}
@@ -62,14 +62,15 @@
}
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
-// Map<String, UIComponent> facets = getFacets();
-// UIComponent component = facets.get("progress");
-// if (component == null) {
-// FacesContext context = getFacesContext();
-// UIComponent pb = context.getApplication().createComponent(context, AbstractProgressBar.COMPONENT_TYPE, "org.richfaces.ProgressBarRenderer");
-// pb.setId(getId() + "_pb");
-// facets.put("progress", pb);
-// }
+ Map<String, UIComponent> facets = getFacets();
+ UIComponent component = facets.get("progress");
+ if (component == null) {
+ FacesContext context = getFacesContext();
+ UIComponent pb = context.getApplication().createComponent(context, AbstractProgressBar.COMPONENT_TYPE,
+ "org.richfaces.ProgressBarRenderer");
+ pb.setId(getId() + "_pb");
+ facets.put("progress", pb);
+ }
}
/**
* <p>Add a new {@link FileUploadListener} to the set of listeners
14 years, 1 month
JBoss Rich Faces SVN: r20138 - sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-11-22 15:07:38 -0500 (Mon, 22 Nov 2010)
New Revision: 20138
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
Log:
RF-9496
Modified: sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-11-22 20:03:49 UTC (rev 20137)
+++ sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-11-22 20:07:38 UTC (rev 20138)
@@ -110,7 +110,7 @@
this.form.attr("encoding", "multipart/form-data");
this.form.attr("enctype", "multipart/form-data");
this.iframe.load(jQuery.proxy(this.__load, this));
- richfaces.submitForm(this.form, null, this.id);
+ richfaces.submitForm(this.form, {"org.richfaces.ajax.component": this.id}, this.id);
} finally {
this.form.attr("action", originalAction);
this.form.attr("encoding", originalEncoding);
@@ -120,14 +120,23 @@
},
__load: function(event) {
- var result = event.target.contentDocument.documentElement.id.split(":");
- if (this.loadableItem && UID + 1 == result[0]) {
- if ("done" == result[1]) {
- this.loadableItem.finishUploading();
- this.loadableItem = null;
- this.__updateButtons();
- }
- }
+ if (this.loadableItem) {
+ var contentDocument = event.target.contentWindow.document;
+ contentDocument = contentDocument.XMLDocument || contentDocument;
+ var documentElement = contentDocument.documentElement;
+ if (documentElement.tagName.toUpperCase() != "HTML") {
+ jsf.ajax.response({responseXML: contentDocument}, {});
+ this.loadableItem.finishUploading();
+ this.loadableItem = null;
+ this.__updateButtons();
+ } else {
+ var result = documentElement.id.split(":");
+ if (UID + 1 == result[0]) {
+ if ("done" == result[1]) {
+ }
+ }
+ }
+ }
}
});
14 years, 1 month
JBoss Rich Faces SVN: r20137 - in sandbox/trunk/ui/fileupload/ui/src/main: java/org/richfaces/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-11-22 15:03:49 -0500 (Mon, 22 Nov 2010)
New Revision: 20137
Added:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
Removed:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/application/
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/request/MultipartRequest.java
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/fileupload.faces-config.xml
sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
Log:
RF-9499
Modified: sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java 2010-11-22 19:20:23 UTC (rev 20136)
+++ sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java 2010-11-22 20:03:49 UTC (rev 20137)
@@ -62,14 +62,14 @@
}
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
- Map<String, UIComponent> facets = getFacets();
- UIComponent component = facets.get("progress");
- if (component == null) {
- FacesContext context = getFacesContext();
- UIComponent pb = context.getApplication().createComponent(context, AbstractProgressBar.COMPONENT_TYPE, "org.richfaces.ProgressBarRenderer");
- pb.setId(getId() + "_pb");
- facets.put("progress", pb);
- }
+// Map<String, UIComponent> facets = getFacets();
+// UIComponent component = facets.get("progress");
+// if (component == null) {
+// FacesContext context = getFacesContext();
+// UIComponent pb = context.getApplication().createComponent(context, AbstractProgressBar.COMPONENT_TYPE, "org.richfaces.ProgressBarRenderer");
+// pb.setId(getId() + "_pb");
+// facets.put("progress", pb);
+// }
}
/**
* <p>Add a new {@link FileUploadListener} to the set of listeners
Added: sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java (rev 0)
+++ sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-11-22 20:03:49 UTC (rev 20137)
@@ -0,0 +1,181 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.context;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLDecoder;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.PartialViewContextFactory;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.richfaces.exception.FileUploadException;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.request.MultipartRequest;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class FileUploadPartialViewContextFactory extends PartialViewContextFactory {
+
+ private static final Logger LOGGER = RichfacesLogger.APPLICATION.getLogger();
+
+ private static final Pattern AMPERSAND = Pattern.compile("&+");
+
+ private static final String UID_KEY = "rf_fu_uid";
+
+ private PartialViewContextFactory parentFactory;
+
+ /** Flag indicating whether a temporary file should be used to cache the uploaded file */
+ private boolean createTempFiles = false;
+
+ private String tempFilesDirectory;
+
+ /** The maximum size of a file upload request. 0 means no limit. */
+ private int maxRequestSize = 0;
+
+ public FileUploadPartialViewContextFactory(PartialViewContextFactory parentFactory) {
+ this.parentFactory = parentFactory;
+ ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
+ String param = context.getInitParameter("createTempFiles");
+ if (param != null) {
+ this.createTempFiles = Boolean.parseBoolean(param);
+ } else {
+ this.createTempFiles = true;
+ }
+
+ this.tempFilesDirectory = context.getInitParameter("tempFilesDirectory");
+
+ param = context.getInitParameter("maxRequestSize");
+ if (param != null) {
+ this.maxRequestSize = Integer.parseInt(param);
+ }
+ }
+
+ @Override
+ public PartialViewContext getPartialViewContext(FacesContext facesContext) {
+ ExternalContext externalContext = facesContext.getExternalContext();
+ HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
+ Map<String, String> queryParamMap = parseQueryString(request.getQueryString());
+ String uid = queryParamMap.get(UID_KEY);
+ if (uid != null) {
+ if (maxRequestSize != 0 && externalContext.getRequestContentLength() > maxRequestSize) {
+ printResponse(facesContext, "<html id=\"" + UID_KEY + uid + ":size_restricted\"/>");
+ } else if (!checkFileCount(externalContext, queryParamMap.get("id"))) {
+ printResponse(facesContext, "<html id=\"" + UID_KEY + uid + ":forbidden\"/>");
+ } else {
+ MultipartRequest multipartRequest = new MultipartRequest(request, createTempFiles,
+ tempFilesDirectory, maxRequestSize, uid);
+ try {
+ multipartRequest.parseRequest();
+ if (!multipartRequest.isDone()) {
+ printResponse(facesContext, "<html id=\"" + UID_KEY + uid + ":stopped\"/>");
+ } else {
+ externalContext.setRequest(multipartRequest);
+ }
+ } catch (FileUploadException e) {
+ printResponse(facesContext, "<html id=\"" + UID_KEY + uid + ":server_error\"/>");
+ throw e; // TODO remove it
+ } finally {
+ multipartRequest.clearRequestData();
+ }
+ }
+ }
+ return parentFactory.getPartialViewContext(facesContext);
+ }
+
+ private boolean checkFileCount(ExternalContext externalContext, String idParameter) {
+ // TODO implement this method
+ // HttpSession session = externalContext.getSession(false);
+ //
+ // if (session != null) {
+ // Map<String, Integer> map = (Map<String, Integer>) session
+ // .getAttribute(FileUploadConstants.UPLOADED_COUNTER);
+ //
+ // if (map != null) {
+ // String id = idParameter;
+ // if (id != null) {
+ // Integer i = map.get(id);
+ // if (i != null && i == 0) {
+ // return false;
+ // }
+ // }
+ // }
+ // }
+ return true;
+ }
+
+ private Map<String, String> parseQueryString(String queryString) {
+ if (queryString != null) {
+ Map<String, String> parameters = new HashMap<String, String>();
+ String[] nvPairs = AMPERSAND.split(queryString);
+ for (String nvPair : nvPairs) {
+ if (nvPair.length() == 0) {
+ continue;
+ }
+
+ int eqIdx = nvPair.indexOf('=');
+ if (eqIdx >= 0) {
+ try {
+ String name = URLDecoder.decode(nvPair.substring(0, eqIdx), "UTF-8");
+ if (!parameters.containsKey(name)) {
+ String value = URLDecoder.decode(nvPair.substring(eqIdx + 1), "UTF-8");
+
+ parameters.put(name, value);
+ }
+ } catch (UnsupportedEncodingException e) {
+ // log warning and skip this parameter
+ LOGGER.warn(e.getLocalizedMessage(), e);
+ }
+ }
+ }
+ return parameters;
+ } else {
+ return Collections.emptyMap();
+ }
+ }
+
+ private void printResponse(FacesContext facesContext, String message) {
+ facesContext.responseComplete();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ externalContext.setResponseStatus(HttpServletResponse.SC_OK);
+ externalContext.setResponseContentType(MultipartRequest.TEXT_HTML);
+ try {
+ Writer writer = externalContext.getResponseOutputWriter();
+ writer.write(message);
+ writer.close();
+ } catch (IOException e) {
+ LOGGER.error(e);
+ }
+ }
+}
Modified: sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/request/MultipartRequest.java
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/request/MultipartRequest.java 2010-11-22 19:20:23 UTC (rev 20136)
+++ sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/request/MultipartRequest.java 2010-11-22 20:03:49 UTC (rev 20137)
@@ -637,10 +637,12 @@
@Override
public String getHeader(String name) {
- if (!"Accept".equals(name)) {
+ if ("Accept".equals(name)) {
+ return TEXT_HTML;
+ } else if ("Faces-Request".equals(name)) {
+ return "partial/ajax";
+ } else {
return super.getHeader(name);
- } else {
- return TEXT_HTML;
}
}
Modified: sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/fileupload.faces-config.xml
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/fileupload.faces-config.xml 2010-11-22 19:20:23 UTC (rev 20136)
+++ sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/fileupload.faces-config.xml 2010-11-22 20:03:49 UTC (rev 20137)
@@ -27,7 +27,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <lifecycle>
- <phase-listener>org.richfaces.application.FileUploadPhaselistener</phase-listener>
- </lifecycle>
+ <factory>
+ <partial-view-context-factory>org.richfaces.context.FileUploadPartialViewContextFactory</partial-view-context-factory>
+ </factory>
</faces-config>
Modified: sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-11-22 19:20:23 UTC (rev 20136)
+++ sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-11-22 20:03:49 UTC (rev 20137)
@@ -32,6 +32,7 @@
<cdk:component-family>org.richfaces.FileUpload</cdk:component-family>
<cdk:renderer-type>org.richfaces.FileUploadRenderer</cdk:renderer-type>
<cdk:resource-dependency library="org.richfaces" name="fileupload.ecss" />
+ <cdk:resource-dependency library="org.richfaces" name="ajax.reslib" />
<cdk:resource-dependency library="org.richfaces" name="base-component.reslib" />
<cdk:resource-dependency library="org.richfaces" name="fileupload.js" />
</cc:interface>
14 years, 1 month
JBoss Rich Faces SVN: r20136 - trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-11-22 14:20:23 -0500 (Mon, 22 Nov 2010)
New Revision: 20136
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
Log:
https://jira.jboss.org/browse/RF-9685 Calendar component: client-side events
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-11-22 19:18:00 UTC (rev 20135)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-11-22 19:20:23 UTC (rev 20136)
@@ -267,6 +267,10 @@
var defaultLabels = {apply:'Apply', today:'Today', clean:'Clean', ok:'OK', cancel:'Cancel', close:'x'};
+ var eventHandlerNames = ["change", "dateselect", "dateselected", "currentdateselect",
+ "currentdateselected", "currentdateselect", "clean", "complete", "collapse",
+ "datemouseout", "datemouseover", "expand", "timeselect", "timeselected"];
+
// Constructor definition
rf.ui.Calendar = function(componentId, locale, options, markups) {
@@ -497,8 +501,13 @@
//alert(new Date().getTime()-_d.getTime());
//define isAjaxMode variable
- "ajax" == this.params.mode ? this.isAjaxMode = true : this.isAjaxMode = false;
-
+ "ajax" == this.params.mode ? this.isAjaxMode = true : this.isAjaxMode = false;
+
+ //events handler binding
+ for (var i in eventHandlerNames) {
+ var handler = this.params["on"+eventHandlerNames[i]];
+ if (handler) rf.Event.bindById(this.id, eventHandlerNames[i], handler, this);
+ }
};
// Extend component class and add protected methods from parent class to our container
@@ -963,7 +972,7 @@
if (field.value!=dateStr)
{
field.value=dateStr;
- this.invokeEvent("changed",field, event, this.selectedDate);
+ this.invokeEvent("change",field, event, this.selectedDate);
}
},
@@ -1122,7 +1131,7 @@
}
},
- indexData: function(daysData, isAjaxMode) {
+ indexData:function(daysData, isAjaxMode) {
var dateYear = daysData.startDate.year;
var dateMonth = daysData.startDate.month;
@@ -1668,7 +1677,7 @@
this.invokeEvent("dateselected", null, null, null);
this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, "rf-ca-sel", (this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
-
+ this.invokeEvent("clean", null, null, null);
this.renderHF();
if (!this.params.showApplyButton)
{
14 years, 1 month