Author: konstantin.mishin
Date: 2011-02-24 12:45:09 -0500 (Thu, 24 Feb 2011)
New Revision: 21926
Modified:
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/FileUploadHandler.java
Log:
RF-10595
Modified:
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/FileUploadHandler.java
===================================================================
---
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/FileUploadHandler.java 2011-02-24
17:18:45 UTC (rev 21925)
+++
branches/4.0.0.CR1/ui/input/ui/src/main/java/org/richfaces/view/facelets/FileUploadHandler.java 2011-02-24
17:45:09 UTC (rev 21926)
@@ -21,7 +21,10 @@
*/
package org.richfaces.view.facelets;
+import java.io.Serializable;
+
import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
import javax.faces.view.facelets.ComponentConfig;
import javax.faces.view.facelets.ComponentHandler;
import javax.faces.view.facelets.FaceletContext;
@@ -41,6 +44,20 @@
*/
public class FileUploadHandler extends ComponentHandler {
+ public static final class FileUploadListenerImpl implements FileUploadListener,
Serializable {
+
+ private static final long serialVersionUID = -3824721864533652683L;
+ private MethodExpression expression;
+
+ public FileUploadListenerImpl(MethodExpression expression) {
+ this.expression = expression;
+ }
+
+ public void processUpload(FileUploadEvent event) {
+ expression.invoke(FacesContext.getCurrentInstance().getELContext(), new
Object[] {event});
+ }
+ }
+
public FileUploadHandler(ComponentConfig config) {
super(config);
}
@@ -58,11 +75,7 @@
@Override
public void applyMetadata(final FaceletContext ctx, Object
instance) {
final MethodExpression expression =
getMethodExpression(ctx);
- ((AbstractFileUpload) instance).addFileUploadListener(new
FileUploadListener(){
- public void processUpload(FileUploadEvent event) {
-
expression.invoke(ctx.getFacesContext().getELContext(), new Object[] {event});
- }
- });
+ ((AbstractFileUpload) instance).addFileUploadListener(new
FileUploadListenerImpl(expression));
}
};
}
Show replies by date