JBoss Rich Faces SVN: r7598 - trunk/samples/progressBarDemo/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-04-04 06:17:52 -0400 (Fri, 04 Apr 2008)
New Revision: 7598
Modified:
trunk/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml
Log:
dynamic skinning for fileupload and progressbar demos added
Modified: trunk/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml 2008-04-04 08:29:46 UTC (rev 7597)
+++ trunk/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml 2008-04-04 10:17:52 UTC (rev 7598)
@@ -7,6 +7,10 @@
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
+ <context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
17 years, 5 months
JBoss Rich Faces SVN: r7597 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-04-04 04:29:46 -0400 (Fri, 04 Apr 2008)
New Revision: 7597
Modified:
trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
trunk/docs/userguide/en/src/main/docbook/included/contextMenu.xml
Log:
RF-1943 - corrected names of functions for <rich:contextMenu> and updated example of usage for <rich:calendar>
Modified: trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-04-04 07:20:13 UTC (rev 7596)
+++ trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-04-04 08:29:46 UTC (rev 7597)
@@ -364,13 +364,13 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <a4j:form id="form">
- <rich:calendar popup="true" rendered="#{!bean.check}" value="#{bean.date}" id="c"/>
- <!--The link which is used to call a calendar popup externally-->
- <a onclick="$('form:c').component.Expand()" href="#">Show</a>
- </a4j:form>
-...
-]]></programlisting>
+ <rich:calendar value="#{calendarBean.selectedDate}" id="calendarID"
+ locale="#{calendarBean.locale}"
+ popup="#{calendarBean.popup}"
+ datePattern="#{calendarBean.pattern}"
+ showApplyButton="#{calendarBean.showApply}" style="width:200px"/>
+ <h:commandButton value="Show next year" onclick="#{rich:component('calendarID')}.nextYear();"/>
+...]]></programlisting>
<para>Also the discussion about this problem can be found on the <ulink
url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078301#..."
Modified: trunk/docs/userguide/en/src/main/docbook/included/contextMenu.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/contextMenu.xml 2008-04-04 07:20:13 UTC (rev 7596)
+++ trunk/docs/userguide/en/src/main/docbook/included/contextMenu.xml 2008-04-04 08:29:46 UTC (rev 7597)
@@ -415,12 +415,12 @@
<tbody>
<!--Sorting API -->
<row>
- <entry>Hide()</entry>
+ <entry>hide()</entry>
<entry>Hide component or group</entry>
<entry>Component, group</entry>
</row>
<row>
- <entry>Show()</entry>
+ <entry>show()</entry>
<entry>Show component or group</entry>
<entry>Component, group</entry>
</row>
17 years, 5 months
JBoss Rich Faces SVN: r7594 - in branches/3.1.x/samples/suggestionbox-sample: src/main/java/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-03 20:19:05 -0400 (Thu, 03 Apr 2008)
New Revision: 7594
Modified:
branches/3.1.x/samples/suggestionbox-sample/pom.xml
branches/3.1.x/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java
branches/3.1.x/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp
Log:
http://jira.jboss.com/jira/browse/RF-2699
http://jira.jboss.com/jira/browse/RF-1565
Modified: branches/3.1.x/samples/suggestionbox-sample/pom.xml
===================================================================
--- branches/3.1.x/samples/suggestionbox-sample/pom.xml 2008-04-04 00:18:56 UTC (rev 7593)
+++ branches/3.1.x/samples/suggestionbox-sample/pom.xml 2008-04-04 00:19:05 UTC (rev 7594)
@@ -16,11 +16,6 @@
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-ui</artifactId>
- <version>3.1.5-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
<artifactId>suggestionbox</artifactId>
<version>3.1.5-SNAPSHOT</version>
</dependency>
Modified: branches/3.1.x/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java
===================================================================
--- branches/3.1.x/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java 2008-04-04 00:18:56 UTC (rev 7593)
+++ branches/3.1.x/samples/suggestionbox-sample/src/main/java/org/richfaces/SuggestionBox.java 2008-04-04 00:19:05 UTC (rev 7594)
@@ -28,6 +28,9 @@
import java.util.List;
import java.io.Serializable;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
public class SuggestionBox implements Serializable {
private String property;
@@ -67,7 +70,10 @@
}
public List autocomplete(Object suggest) {
- String pref = (String)suggest;
+ FacesContext context = FacesContext.getCurrentInstance();
+ context.addMessage(null, new FacesMessage("SuggestionBox.autocomplete() " + suggest));
+
+ String pref = (String)suggest;
ArrayList result = new ArrayList();
Iterator iterator = getAllData().iterator();
Modified: branches/3.1.x/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp
===================================================================
--- branches/3.1.x/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp 2008-04-04 00:18:56 UTC (rev 7593)
+++ branches/3.1.x/samples/suggestionbox-sample/src/main/webapp/pages/index.jsp 2008-04-04 00:19:05 UTC (rev 7594)
@@ -18,6 +18,13 @@
<br/>
<br/>
+<a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+</a4j:outputPanel>
+
+<br/>
+<br/>
+
<h:outputText
value="Simple richfaces Suggestion Box test web application."
style="font: 18px;font-weight: bold;"/>
17 years, 5 months
JBoss Rich Faces SVN: r7593 - in branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces: renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-03 20:18:56 -0400 (Thu, 03 Apr 2008)
New Revision: 7593
Modified:
branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java
branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-2699
http://jira.jboss.com/jira/browse/RF-1565
Modified: branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java
===================================================================
--- branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java 2008-04-04 00:04:53 UTC (rev 7592)
+++ branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java 2008-04-04 00:18:56 UTC (rev 7593)
@@ -293,6 +293,9 @@
super.broadcast(event);
if (event instanceof AjaxEvent) {
FacesContext context = getFacesContext();
+
+ setupValue(context);
+
AjaxRendererUtils.addRegionsFromComponent(this, context);
AjaxRendererUtils.addRegionByName(context, this, this.getId());
setSubmitted(true);
Modified: branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
--- branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2008-04-04 00:04:53 UTC (rev 7592)
+++ branches/3.1.x/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2008-04-04 00:18:56 UTC (rev 7593)
@@ -252,7 +252,6 @@
throws IOException {
UISuggestionBox suggestionBox = (UISuggestionBox) component;
if (suggestionBox.isSubmitted()) {
- suggestionBox.setupValue(context);
body.encode(getTemplateContext(context, suggestionBox));
// Replace rendered area ID from component to suggestion table
suggestionBox.setRowIndex(-1);
17 years, 5 months
JBoss Rich Faces SVN: r7592 - trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-04-03 20:04:53 -0400 (Thu, 03 Apr 2008)
New Revision: 7592
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
Log:
Fix Java 5 generics warning.
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2008-04-03 21:53:56 UTC (rev 7591)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2008-04-04 00:04:53 UTC (rev 7592)
@@ -69,7 +69,7 @@
if(push.isEnabled()){
JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context, AJAX_PUSH_FUNCTION);
// Set dummy form id, if nessesary.
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, component);
options.put("dummyForm", component.getClientId(context)+RendererUtils.DUMMY_FORM_ID);
int interval = push.getInterval();
if(interval == Integer.MIN_VALUE){
17 years, 5 months
JBoss Rich Faces SVN: r7591 - in trunk/framework/impl/src/main/java/org/ajax4jsf: webapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-03 17:53:56 -0400 (Thu, 03 Apr 2008)
New Revision: 7591
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
Log:
http://jira.jboss.com/jira/browse/RF-2962
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java 2008-04-03 17:51:54 UTC (rev 7590)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java 2008-04-03 21:53:56 UTC (rev 7591)
@@ -21,217 +21,7 @@
package org.ajax4jsf;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.ajax4jsf.request.MultipartRequest;
-
public class FastFilter extends org.ajax4jsf.webapp.NekkoFilter {
- /** Multipart request start */
- public static final String MULTIPART = "multipart/";
-
- /** Session bean name where multipart requests map will be stored */
- public static final String REQUESTS_SESSIONS_BEAN_NAME = "_richfaces_upload_sessions";
-
- /** Session bean name where progress bar's percent map will be stored */
- public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
-
- /**
- * Request parameter that indicates if multipart request forced by rich file
- * upload component
- */
- public static final String UPLOAD_FILES_ID = "_richfaces_upload_uid";
-
- /**
- * Flag indicating whether a temporary file should be used to cache the
- * uploaded file
- */
- private boolean createTempFiles = false;
-
- /**
- * The maximum size of a file upload request. 0 means no limit.
- */
- private int maxRequestSize = 0;
-
- /***************************************************************************
- * Method catches upload files request. Request parameter
- * <b>org.ajax4jsf.Filter.UPLOAD_FILES_ID</b> indicates if request
- * generated by rich-upload component. If it was detected custom parsing
- * request should be done. Processing information about percent of
- * completion and file size will be put into session scope. In other case
- * super filter's method will be invoked for request processing.
- *
- * @param request
- * @param response
- * @param chain
- */
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
- if (!(response instanceof HttpServletResponse)) {
- chain.doFilter(request, response);
- return;
- }
-
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- String uid = httpRequest.getParameter(UPLOAD_FILES_ID);
- if (uid != null) {
- if (isMultipartRequest(httpRequest)) {
- MultipartRequest multipartRequest = new MultipartRequest(
- httpRequest, createTempFiles, maxRequestSize, uid);
-
- Map<String, MultipartRequest> sessionsMap = null;
- Map<String, Object> percentMap = null;
- try {
- if (isFileSizeRestricted(request, maxRequestSize)) {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
- } else if (!checkFileCount(httpRequest)) {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_forbidden\"></html>");
- } else {
- HttpSession session = httpRequest.getSession();
- synchronized (session) {
- sessionsMap = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
- percentMap = (Map<String, Object>) session
- .getAttribute(PERCENT_BEAN_NAME);
- if (sessionsMap == null) {
- sessionsMap = Collections
- .synchronizedMap(new HashMap<String, MultipartRequest>());
- session.setAttribute(
- REQUESTS_SESSIONS_BEAN_NAME,
- sessionsMap);
- }
- if (percentMap == null) {
- percentMap = new HashMap<String, Object>();
- session.setAttribute(PERCENT_BEAN_NAME,
- percentMap);
- }
- }
- percentMap.put(uid, 0); // associate percent value with
- // file
- // entry uid
- sessionsMap.put(uid, multipartRequest);
-
- if (multipartRequest.parseRequest()) {
- super.doFilter(multipartRequest, response, chain);
- } else {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_stopped\"></html>");
- }
- }
- } finally {
- if (sessionsMap != null) {
- sessionsMap.remove(uid);
- percentMap.remove(uid);
- }
- }
- } else {
- if ("stop".equals(httpRequest.getParameter("action"))) {
- HttpSession session = httpRequest.getSession();
- Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
-
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- multipartRequest.stop();
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse
- .setStatus(HttpServletResponse.SC_NO_CONTENT);
- httpResponse.getOutputStream().close();
- }
- }
- } else {
- super.doFilter(request, response, chain);
- }
- }
- } else {
- super.doFilter(request, response, chain);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.webapp.BaseFilter#init(javax.servlet.FilterConfig)
- */
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
- super.init(filterConfig);
- String param = filterConfig.getInitParameter("createTempFiles");
- if (param != null) {
- this.createTempFiles = Boolean.parseBoolean(param);
- }else {
- this.createTempFiles = true;
- }
- param = filterConfig.getInitParameter("maxRequestSize");
- if (param != null) {
- this.maxRequestSize = Integer.parseInt(param);
- }
- }
-
- private boolean isMultipartRequest(HttpServletRequest request) {
- if (!"post".equals(request.getMethod().toLowerCase())) {
- return false;
- }
-
- String contentType = request.getContentType();
- if (contentType == null) {
- return false;
- }
-
- if (contentType.toLowerCase().startsWith(MULTIPART)) {
- return true;
- }
-
- return false;
- }
-
- private boolean isFileSizeRestricted(ServletRequest request, int maxSize) {
- if (maxSize != 0 && request.getContentLength() > maxSize) {
- return true;
- }
- return false;
- }
-
- private boolean checkFileCount(HttpServletRequest request) {
- HttpSession session = request.getSession();
- Map<String, Integer> map = (Map<String, Integer>) session
- .getAttribute(Filter.UPLOADED_COUNTER);
- if (map != null) {
- String id = request.getParameter("id");
- if (id != null) {
- Integer i = map.get(id);
- if (i != null && i == 0) {
- return false;
- }
- }
- }
- return true;
- }
-
- private void printResponse(ServletResponse response, String message)
- throws IOException {
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse.setStatus(HttpServletResponse.SC_OK);
- httpResponse.setContentType("text/html");
- PrintWriter writer = httpResponse.getWriter();
- writer.write(message);
- writer.close();
- }
-
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java 2008-04-03 17:51:54 UTC (rev 7590)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java 2008-04-03 21:53:56 UTC (rev 7591)
@@ -21,22 +21,6 @@
package org.ajax4jsf;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.ajax4jsf.request.MultipartRequest;
import org.ajax4jsf.webapp.ConfigurableFilter;
/**
@@ -48,202 +32,4 @@
*/
public class Filter extends ConfigurableFilter {
- /** Multipart request start */
- public static final String MULTIPART = "multipart/";
-
- /** Session bean name where multipart requests map will be stored */
- public static final String REQUESTS_SESSIONS_BEAN_NAME = "_richfaces_upload_sessions";
-
- /** Session bean name where progress bar's percent map will be stored */
- public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
-
- /**
- * Request parameter that indicates if multipart request forced by rich file
- * upload component
- */
- public static final String UPLOAD_FILES_ID = "_richfaces_upload_uid";
-
- /** Session bean name to store max files count allowed to upload */
- public static final String UPLOADED_COUNTER = "_richfaces_uploaded_file_counter";
-
- /**
- * Flag indicating whether a temporary file should be used to cache the
- * uploaded file
- */
- private boolean createTempFiles = false;
-
- /**
- * The maximum size of a file upload request. 0 means no limit.
- */
- private int maxRequestSize = 0;
-
- /***************************************************************************
- * Method catches upload files request. Request parameter
- * <b>org.ajax4jsf.Filter.UPLOAD_FILES_ID</b> indicates if request
- * generated by rich-upload component. If it was detected custom parsing
- * request should be done. Processing information about percent of
- * completion and file size will be put into session scope. In other case
- * super filter's method will be invoked for request processing.
- *
- * @param request
- * @param response
- * @param chain
- */
- @Override
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
- if (!(response instanceof HttpServletResponse)) {
- chain.doFilter(request, response);
- return;
- }
-
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- String uid = httpRequest.getParameter(UPLOAD_FILES_ID);
- if (uid != null) {
- if (isMultipartRequest(httpRequest)) {
- MultipartRequest multipartRequest = new MultipartRequest(
- httpRequest, createTempFiles, maxRequestSize, uid);
-
- Map<String, MultipartRequest> sessionsMap = null;
- Map<String, Object> percentMap = null;
- try {
- if (isFileSizeRestricted(request, maxRequestSize)) {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
- } else if (!checkFileCount(httpRequest)) {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_forbidden\"></html>");
- } else {
- HttpSession session = httpRequest.getSession();
- synchronized (session) {
- sessionsMap = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
- percentMap = (Map<String, Object>) session
- .getAttribute(PERCENT_BEAN_NAME);
- if (sessionsMap == null) {
- sessionsMap = Collections
- .synchronizedMap(new HashMap<String, MultipartRequest>());
- session.setAttribute(
- REQUESTS_SESSIONS_BEAN_NAME,
- sessionsMap);
- }
- if (percentMap == null) {
- percentMap = new HashMap<String, Object>();
- session.setAttribute(PERCENT_BEAN_NAME,
- percentMap);
- }
- }
- percentMap.put(uid, 0); // associate percent value with
- // file
- // entry uid
- sessionsMap.put(uid, multipartRequest);
-
- if (multipartRequest.parseRequest()) {
- super.doFilter(multipartRequest, response, chain);
- } else {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_stopped\"></html>");
- }
- }
- } finally {
- if (sessionsMap != null) {
- sessionsMap.remove(uid);
- percentMap.remove(uid);
- }
- }
- } else {
- if ("stop".equals(httpRequest.getParameter("action"))) {
- HttpSession session = httpRequest.getSession();
- Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
-
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- multipartRequest.stop();
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse
- .setStatus(HttpServletResponse.SC_NO_CONTENT);
- httpResponse.getOutputStream().close();
- }
- }
- } else {
- super.doFilter(request, response, chain);
- }
- }
- } else {
- super.doFilter(request, response, chain);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.webapp.BaseFilter#init(javax.servlet.FilterConfig)
- */
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
- super.init(filterConfig);
- String param = filterConfig.getInitParameter("createTempFiles");
- if (param != null) {
- this.createTempFiles = Boolean.parseBoolean(param);
- } else {
- this.createTempFiles = true;
- }
- param = filterConfig.getInitParameter("maxRequestSize");
- if (param != null) {
- this.maxRequestSize = Integer.parseInt(param);
- }
- }
-
- private boolean isMultipartRequest(HttpServletRequest request) {
- if (!"post".equals(request.getMethod().toLowerCase())) {
- return false;
- }
-
- String contentType = request.getContentType();
- if (contentType == null) {
- return false;
- }
-
- if (contentType.toLowerCase().startsWith(MULTIPART)) {
- return true;
- }
-
- return false;
- }
-
- private boolean isFileSizeRestricted(ServletRequest request, int maxSize) {
- if (maxSize != 0 && request.getContentLength() > maxSize) {
- return true;
- }
- return false;
- }
-
- private boolean checkFileCount(HttpServletRequest request) {
- HttpSession session = request.getSession();
- Map<String, Integer> map = (Map<String, Integer>) session
- .getAttribute(UPLOADED_COUNTER);
- if (map != null) {
- String id = request.getParameter("id");
- if (id != null) {
- Integer i = map.get(id);
- if (i != null && i == 0) {
- return false;
- }
- }
- }
- return true;
- }
-
- private void printResponse(ServletResponse response, String message)
- throws IOException {
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse.setStatus(HttpServletResponse.SC_OK);
- httpResponse.setContentType("text/html");
- PrintWriter writer = httpResponse.getWriter();
- writer.write(message);
- writer.close();
- }
-
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-04-03 17:51:54 UTC (rev 7590)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-04-03 21:53:56 UTC (rev 7591)
@@ -22,9 +22,13 @@
package org.ajax4jsf.webapp;
import java.io.IOException;
+import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
+import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.application.ViewHandler;
import javax.servlet.Filter;
@@ -41,6 +45,7 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.renderkit.AjaxContainerRenderer;
+import org.ajax4jsf.request.MultipartRequest;
import org.ajax4jsf.resource.InternetResourceService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -108,6 +113,35 @@
protected PollEventsManager eventsManager;
/**
+ * Flag indicating whether a temporary file should be used to cache the
+ * uploaded file
+ */
+ private boolean createTempFiles = false;
+
+ /**
+ * The maximum size of a file upload request. 0 means no limit.
+ */
+ private int maxRequestSize = 0;
+
+ /** Multipart request start */
+ public static final String MULTIPART = "multipart/";
+
+ /** Session bean name where multipart requests map will be stored */
+ public static final String REQUESTS_SESSIONS_BEAN_NAME = "_richfaces_upload_sessions";
+
+ /** Session bean name where progress bar's percent map will be stored */
+ public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
+
+ /**
+ * Request parameter that indicates if multipart request forced by rich file
+ * upload component
+ */
+ public static final String UPLOAD_FILES_ID = "_richfaces_upload_uid";
+
+ /** Session bean name to store max files count allowed to upload */
+ public static final String UPLOADED_COUNTER = "_richfaces_uploaded_file_counter";
+
+ /**
* Initialize the filter.
*/
public void init(FilterConfig config) throws ServletException {
@@ -140,9 +174,193 @@
resourceService.init(filterConfig);
eventsManager = new PollEventsManager();
eventsManager.init(filterConfig.getServletContext());
+
+ String param = filterConfig.getInitParameter("createTempFiles");
+ if (param != null) {
+ this.createTempFiles = Boolean.parseBoolean(param);
+ } else {
+ this.createTempFiles = true;
+ }
+ param = filterConfig.getInitParameter("maxRequestSize");
+ if (param != null) {
+ this.maxRequestSize = Integer.parseInt(param);
+ }
}
+ private boolean isMultipartRequest(HttpServletRequest request) {
+ if (!"post".equals(request.getMethod().toLowerCase())) {
+ return false;
+ }
+
+ String contentType = request.getContentType();
+ if (contentType == null) {
+ return false;
+ }
+
+ if (contentType.toLowerCase().startsWith(MULTIPART)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean isFileSizeRestricted(ServletRequest request, int maxSize) {
+ if (maxSize != 0 && request.getContentLength() > maxSize) {
+ return true;
+ }
+ return false;
+ }
+
+ private boolean checkFileCount(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ Map<String, Integer> map = (Map<String, Integer>) session
+ .getAttribute(UPLOADED_COUNTER);
+ if (map != null) {
+ String id = request.getParameter("id");
+ if (id != null) {
+ Integer i = map.get(id);
+ if (i != null && i == 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ private void printResponse(ServletResponse response, String message)
+ throws IOException {
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ httpResponse.setStatus(HttpServletResponse.SC_OK);
+ httpResponse.setContentType("text/html");
+ PrintWriter writer = httpResponse.getWriter();
+ writer.write(message);
+ writer.close();
+ }
+
+ protected void handleRequest(HttpServletRequest request, HttpServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ // check ajax request parameter
+ // TODO - check for JSF page.
+ if (true) {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages
+ .getMessage(Messages.FILTER_XML_OUTPUT));
+ }
+
+ // Execute the rest of the filter chain, including the
+ // JSP
+ xmlFilter.doXmlFilter(chain, request,
+ response);
+ } else {
+ // normal request, execute chain ...
+ if (log.isDebugEnabled()) {
+ log.debug(Messages
+ .getMessage(Messages.FILTER_NO_XML_CHAIN));
+ }
+ chain.doFilter(request, response);
+
+ }
+
+ }
+
/**
+ * Method catches upload files request. Request parameter
+ * <b>org.ajax4jsf.Filter.UPLOAD_FILES_ID</b> indicates if request
+ * generated by rich-upload component. If it was detected custom parsing
+ * request should be done. Processing information about percent of
+ * completion and file size will be put into session scope.
+ *
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+ protected void processUploadsAndHandleRequest(HttpServletRequest request, HttpServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ String uid = httpRequest.getParameter(UPLOAD_FILES_ID);
+ if (uid != null) {
+ if (isMultipartRequest(httpRequest)) {
+ MultipartRequest multipartRequest = new MultipartRequest(
+ httpRequest, createTempFiles, maxRequestSize, uid);
+
+ Map<String, MultipartRequest> sessionsMap = null;
+ Map<String, Object> percentMap = null;
+ try {
+ if (isFileSizeRestricted(request, maxRequestSize)) {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
+ } else if (!checkFileCount(httpRequest)) {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_forbidden\"></html>");
+ } else {
+ HttpSession session = httpRequest.getSession();
+ synchronized (session) {
+ sessionsMap = (Map<String, MultipartRequest>) session
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
+ percentMap = (Map<String, Object>) session
+ .getAttribute(PERCENT_BEAN_NAME);
+ if (sessionsMap == null) {
+ sessionsMap = Collections
+ .synchronizedMap(new HashMap<String, MultipartRequest>());
+ session.setAttribute(
+ REQUESTS_SESSIONS_BEAN_NAME,
+ sessionsMap);
+ }
+ if (percentMap == null) {
+ percentMap = new HashMap<String, Object>();
+ session.setAttribute(PERCENT_BEAN_NAME,
+ percentMap);
+ }
+ }
+ percentMap.put(uid, 0); // associate percent value with
+ // file
+ // entry uid
+ sessionsMap.put(uid, multipartRequest);
+
+ if (multipartRequest.parseRequest()) {
+ handleRequest(multipartRequest, response, chain);
+ } else {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_stopped\"></html>");
+ }
+ }
+ } finally {
+ if (sessionsMap != null) {
+ sessionsMap.remove(uid);
+ percentMap.remove(uid);
+ }
+ }
+ } else {
+ if ("stop".equals(httpRequest.getParameter("action"))) {
+ HttpSession session = httpRequest.getSession();
+ Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
+
+ if (sessions != null) {
+ MultipartRequest multipartRequest = sessions.get(uid);
+ if (multipartRequest != null) {
+ multipartRequest.stop();
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ httpResponse
+ .setStatus(HttpServletResponse.SC_NO_CONTENT);
+ httpResponse.getOutputStream().close();
+ }
+ }
+
+ //TODO what's here?
+ } else {
+ handleRequest(request, response, chain);
+ }
+ }
+ } else {
+ handleRequest(request, response, chain);
+ }
+ }
+
+ /**
* @param httpServletRequest
* @throws UnsupportedEncodingException
*/
@@ -263,29 +481,9 @@
// first stage - detect/set encoding of request. Same as in
// Myfaces External Context.
setupRequestEncoding(httpServletRequest);
- // check ajax request parameter
- // TODO - check for JSF page.
- if (true) {
- if (log.isDebugEnabled()) {
- log.debug(Messages
- .getMessage(Messages.FILTER_XML_OUTPUT));
- }
-
- // Execute the rest of the filter chain, including the
- // JSP
- xmlFilter.doXmlFilter(chain, httpServletRequest,
- httpServletResponse);
- } else {
- // normal request, execute chain ...
- if (log.isDebugEnabled()) {
- log.debug(Messages
- .getMessage(Messages.FILTER_NO_XML_CHAIN));
- }
- chain.doFilter(request, response);
-
- }
+
+ processUploadsAndHandleRequest(httpServletRequest, httpServletResponse, chain);
}
-
} finally {
// Remove filter marker from response, to enable sequence calls ( for example, forward to error page )
request.removeAttribute(FILTER_PERFORMED);
17 years, 5 months
JBoss Rich Faces SVN: r7590 - in trunk/ui/inplaceSelect/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-04-03 13:51:54 -0400 (Thu, 03 Apr 2008)
New Revision: 7590
Modified:
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js
trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2814, http://jira.jboss.com/jira/browse/RF-2862, http://jira.jboss.com/jira/browse/RF-2857
Modified: trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
--- trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-04-03 14:20:11 UTC (rev 7589)
+++ trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-04-03 17:51:54 UTC (rev 7590)
@@ -8,8 +8,6 @@
this.inplaceSelect = $(clientId);
this.inplaceSelect.component = this;
- this.attrCloseOnSelect = true; //will be corrected in a future version (http://jira.jboss.com/jira/browse/RF-2814)
-
this.currentItemValue = this.value;
this.button.style.top = Richfaces.getBorderWidth(this.tempValueKeeper, "tb") + "px";
this["rich:destructor"] = "destroy";
@@ -76,39 +74,35 @@
},
tmpValueBlurHandler : function($super, event) {
+ if (!this.comboList.isList) {
+ //click somewhere out of the component area
+ if (this.comboList.activeItem) {
+ this.comboList.doNormalItem(this.comboList.activeItem);
+ }
+ /*if (!this.attributes.closeOnSelect && !this.attributes.showControls && this.comboList.isListOpened) {
+ this.comboList.hideWithDelay();
+ this.comboList.isList = false;
+ this.tempValueKeeper.focus();
+ return;
+ }*/
+ this.comboList.hideWithDelay();
+ }
- if (this.button.isClicked) {
- // click on arrow under IE
- this.button.isClicked = false;
- return;
- }
-
if (this.clickOnScroll) {
//click on scroll under IE
this.clickOnScroll = false;
this.tempValueKeeper.focus();
+ this.comboList.isList = false;
return;
}
- $super(event);
- if (!this.byTab) {
- if (!this.comboList.isList || this.clickOnBar) {
- if (this.comboList.activeItem) {
- this.comboList.doNormalItem(this.comboList.activeItem);
- }
- this.comboList.hideWithDelay();
- }
- if (!this.attributes.showControls) {
- this.save();
- } else {
- this.applyTmpValue();
- }
- this.comboList.isList = false;
- } else if(event.target != this.tabber) {
- this.comboList.hideWithDelay();
+ if (!this.attributes.showControls) {
+ this.save();
} else {
- this.byTab = false;
+ this.applyTmpValue();
}
+ this.comboList.isList = false;
+
},
listClickHandler : function(event) {
@@ -137,14 +131,6 @@
} else {
this.comboList.isList = true;
}
-
- if (this.attrCloseOnSelect) {
- //bug : http://jira.jboss.com/jira/browse/RF-2810,
- //will be corrected in a future version (http://jira.jboss.com/jira/browse/RF-2814)
- if (!this.attributes.showControls) {
- this.comboList.isList = false;
- }
- }
},
tmpValueKeyDownHandler : function(event) {
@@ -177,13 +163,14 @@
save : function($super) {
this.applyTmpValue();
- if (!this.comboList.isList || this.clickOnBar) {
+ if (((this.attributes.closeOnSelect && !this.attributes.showControls) && this.comboList.isList)
+ || (this.clickOnBar || !this.comboList.isList)) {
+ //bug : http://jira.jboss.com/jira/browse/RF-2810,
+ //will be corrected in a future version (http://jira.jboss.com/jira/browse/RF-2814)
this.saveValue(this.currentItemValue, this.tempValueKeeper.value);
}
- if (this.attributes.showControls) {
- this.comboList.hide();
- }
+ this.comboList.hide();
},
applyTmpValue : function() {
Modified: trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js
===================================================================
--- trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js 2008-04-03 14:20:11 UTC (rev 7589)
+++ trunk/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselectlist.js 2008-04-03 17:51:54 UTC (rev 7590)
@@ -3,6 +3,7 @@
initialize : function($super, listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId, shadowId, showDelay, hideDelay, value) {
$super(listId, parentListId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId, shadowId, showDelay, hideDelay);
this.wrappingItems(value);
+ this.isListOpened = false;
},
setPosition : function($super, fieldTop, fieldLeft, fieldHeight) {
@@ -32,6 +33,7 @@
},
show : function($super) {
+ this.isListOpened = true;
$super();
},
@@ -59,6 +61,7 @@
},
hide : function() {
+ this.isListOpened = false;
this.resetState();
if (this.iframe) {
this.iframe.hide();
Modified: trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-04-03 14:20:11 UTC (rev 7589)
+++ trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-04-03 17:51:54 UTC (rev 7590)
@@ -191,7 +191,8 @@
inputWidth : '#{component.attributes["selectWidth"]}',
minInputWidth : '#{component.attributes["minSelectWidth"]}',
maxInputWidth : '#{component.attributes["maxSelectWidth"]}',
- openOnEdit:#{component.attributes["openOnEdit"]}},
+ openOnEdit: #{component.attributes["openOnEdit"]},
+ closeOnSelect: true},
{oneditactivation : #{this:getAsEventHandler(context, component, "oneditactivation")},
onviewactivation : #{this:getAsEventHandler(context, component, "onviewactivation")},
oneditactivated : #{this:getAsEventHandler(context, component, "oneditactivated")},
17 years, 5 months
JBoss Rich Faces SVN: r7589 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: vsukhov
Date: 2008-04-03 10:20:11 -0400 (Thu, 03 Apr 2008)
New Revision: 7589
Added:
trunk/docs/userguide/en/src/main/resources/images/bg_table.gif
Log:
image reverted
Added: trunk/docs/userguide/en/src/main/resources/images/bg_table.gif
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/bg_table.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 5 months