Author: andrei_exadel
Date: 2008-02-28 11:23:01 -0500 (Thu, 28 Feb 2008)
New Revision: 6423
Modified:
trunk/framework/api/src/main/java/org/richfaces/event/UploadEvent.java
Log:
Add bytes property to event
Modified: trunk/framework/api/src/main/java/org/richfaces/event/UploadEvent.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/event/UploadEvent.java 2008-02-28
16:14:36 UTC (rev 6422)
+++ trunk/framework/api/src/main/java/org/richfaces/event/UploadEvent.java 2008-02-28
16:23:01 UTC (rev 6423)
@@ -31,15 +31,31 @@
private static final long serialVersionUID = -7645197191376210068L;
private File file = null;
+ private byte [] data= null;
private String fileName = null;
- public UploadEvent(UIComponent component, File file, String fileName) {
+ public UploadEvent(UIComponent component, Object file, String fileName) {
super(component);
- this.file = file;
this.fileName = fileName;
+ init(file);
}
+ private void init (Object file) {
+ if (null == file) {
+ return;
+ }
+ if (file.getClass().isAssignableFrom(File.class)) {
+ this.file = (File)file;
+ }else if (file.getClass().isAssignableFrom(byte[].class)) {
+ this.data = (byte[])file;
+ }
+ }
+ public boolean isFile () {
+ return (null != file);
+ }
+
+
public boolean isAppropriateListener(FacesListener listener) {
return false;
}
@@ -57,5 +73,12 @@
public String getFileName() {
return fileName;
}
-
+
+ /**
+ * @return the fileData
+ */
+ public byte[] getData() {
+ return data;
+ }
+
}