Author: nbelaevski
Date: 2010-12-10 14:12:15 -0500 (Fri, 10 Dec 2010)
New Revision: 20511
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UploadedImage.java
Removed:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java
Log:
Renamed UplocadedImage to UploadedImage
Made UploadedImage Serializable
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java 2010-12-10
18:21:31 UTC (rev 20510)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/FileUploadBean.java 2010-12-10
19:12:15 UTC (rev 20511)
@@ -19,7 +19,7 @@
@SessionScoped
public class FileUploadBean implements Serializable {
- private ArrayList<UplocadedImage> files = new
ArrayList<UplocadedImage>();
+ private ArrayList<UploadedImage> files = new ArrayList<UploadedImage>();
private int uploadsAvailable = 5;
private boolean autoUpload = false;
private boolean useFlash = false;
@@ -38,7 +38,7 @@
public void listener(UploadEvent event) throws Exception {
UploadItem item = event.getUploadItem();
- UplocadedImage file = new UplocadedImage();
+ UploadedImage file = new UploadedImage();
file.setLength(item.getData().length);
file.setName(item.getFileName());
file.setData(item.getData());
@@ -56,11 +56,11 @@
return System.currentTimeMillis();
}
- public ArrayList<UplocadedImage> getFiles() {
+ public ArrayList<UploadedImage> getFiles() {
return files;
}
- public void setFiles(ArrayList<UplocadedImage> files) {
+ public void setFiles(ArrayList<UploadedImage> files) {
this.files = files;
}
Copied:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UploadedImage.java
(from rev 20506,
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java)
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UploadedImage.java
(rev 0)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UploadedImage.java 2010-12-10
19:12:15 UTC (rev 20511)
@@ -0,0 +1,55 @@
+package org.richfaces.demo.fileupload;
+
+import java.io.Serializable;
+
+public class UploadedImage implements Serializable {
+
+ private static final long serialVersionUID = -8192553629588066292L;
+
+ private String name;
+ private String mime;
+ private long length;
+ private byte[] data;
+
+ public byte[] getData() {
+ return data;
+ }
+
+ public void setData(byte[] data) {
+ this.data = data;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ int extDot = name.lastIndexOf('.');
+ if (extDot > 0) {
+ String extension = name.substring(extDot + 1);
+ if ("bmp".equals(extension)) {
+ mime = "image/bmp";
+ } else if ("jpg".equals(extension)) {
+ mime = "image/jpeg";
+ } else if ("gif".equals(extension)) {
+ mime = "image/gif";
+ } else if ("png".equals(extension)) {
+ mime = "image/png";
+ } else {
+ mime = "image/unknown";
+ }
+ }
+ }
+
+ public long getLength() {
+ return length;
+ }
+
+ public void setLength(long length) {
+ this.length = length;
+ }
+
+ public String getMime() {
+ return mime;
+ }
+}
Deleted:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java 2010-12-10
18:21:31 UTC (rev 20510)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/fileupload/UplocadedImage.java 2010-12-10
19:12:15 UTC (rev 20511)
@@ -1,52 +0,0 @@
-package org.richfaces.demo.fileupload;
-
-public class UplocadedImage {
-
- private String name;
- private String mime;
- private long length;
- private byte[] data;
-
- public byte[] getData() {
- return data;
- }
-
- public void setData(byte[] data) {
- this.data = data;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- name = name;
- int extDot = name.lastIndexOf('.');
- if (extDot > 0) {
- String extension = name.substring(extDot + 1);
- if ("bmp".equals(extension)) {
- mime = "image/bmp";
- } else if ("jpg".equals(extension)) {
- mime = "image/jpeg";
- } else if ("gif".equals(extension)) {
- mime = "image/gif";
- } else if ("png".equals(extension)) {
- mime = "image/png";
- } else {
- mime = "image/unknown";
- }
- }
- }
-
- public long getLength() {
- return length;
- }
-
- public void setLength(long length) {
- this.length = length;
- }
-
- public String getMime() {
- return mime;
- }
-}