[richfaces-svn-commits] JBoss Rich Faces SVN: r6254 - in trunk/sandbox/samples/fileUploadDemo/src/main: webapp/pages and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Feb 21 10:35:23 EST 2008


Author: andrei_exadel
Date: 2008-02-21 10:35:22 -0500 (Thu, 21 Feb 2008)
New Revision: 6254

Modified:
   trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
   trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
Log:
demo site upgrade

Modified: trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java	2008-02-21 15:33:07 UTC (rev 6253)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java	2008-02-21 15:35:22 UTC (rev 6254)
@@ -24,8 +24,11 @@
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -49,25 +52,12 @@
 	}
 
 	public void setFlag(boolean flag) {
-		System.out.println(flag);
 		this.flag = flag;
 	}
 	
 	public void listener(UploadEvent event) throws IOException{
-	    
 	    File file = event.getFile();
-	    System.out.println("File name : " + file.getName());
-	    FileInputStream stream = new FileInputStream(file);
-	    ByteArrayOutputStream buffer = new ByteArrayOutputStream(4096);
-	    byte [] bytes = new byte[4096];
-	    int read;
-	    while ((read = stream.read(bytes)) != -1) {
-		buffer.write(bytes, 0 , read);
-	    }
-	    stream.close();
-	    file.delete();
-	    System.out.println(buffer.toString());
-	    
+	    System.out.println("File name : " + file.getAbsolutePath());
 	}
 
 	public void action(ActionEvent event) {
@@ -111,4 +101,5 @@
 	}
 	
 	
-}
\ No newline at end of file
+}
+

Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp	2008-02-21 15:33:07 UTC (rev 6253)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp	2008-02-21 15:35:22 UTC (rev 6254)
@@ -7,6 +7,15 @@
 <html>
 <head>
 <title></title>
+<style>
+	.list {background-color: white;}
+	.list_disabled { background-color: #f1f1f1;}
+	.entry {color: Brown; font-weight: bold;}
+	.entry_disabled { background-color: #f1f1f1; color: gray; }
+	.entry_control {text-decoration: none; color: Brown; font-weight: bold;}
+	.entry_control_disabled { background-color: #f1f1f1; color: #BCDEFF; text-decoration: none; color: gray;}
+
+</style>
 </head>
 <body>
 <f:view>
@@ -20,16 +29,26 @@
 	
 	<h:messages />
 
-<fu:fileUpload data="#{bean.data}" fileUploadListener="#{bean.listener}" maxFiles="5">
+<fu:fileUpload data="#{bean.data}" fileUploadListener="#{bean.listener}" listWidth="600px" listHeight="150px"
+		uploadListClass="list"
+		uploadListClassDisabled="list_disabled"
+		fileEntryClass="entry"
+		fileEntryClassDisabled="entry_disabled"
+		fileEntryControlClass="entry_control"
+		fileEntryControlClassDisabled="entry_control_disabled"
+		maxFilesQuantity="4">
 	<f:facet name="progress">
 		<progressBar:progressBar style="height: 10px; width: 300px;">
 		</progressBar:progressBar>
 	</f:facet>
 	<f:facet name="label">
-		<h:outputText value="{_MB}MB from {MB}MB uploaded --- {mm}:{ss}"></h:outputText>
+		<h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"></h:outputText>
 	</f:facet>
 </fu:fileUpload><br/><br/><br/>
 <h:commandButton actionListener="#{bean.action}" style="font-weight: bold; width: 300px;" value="Print file content in console"></h:commandButton>
+<br/>
+<input type="button" onclick="$('j_id_jsp_223736782_1:j_id_jsp_223736782_7').component.enable();" value="Enable" />
+<input type="button" onclick="$('j_id_jsp_223736782_1:j_id_jsp_223736782_7').component.disable();" value="Disable" /><br/>
 </h:form>
 </f:view>
 </body>




More information about the richfaces-svn-commits mailing list