Author: andrei_exadel
Date: 2008-03-03 08:29:07 -0500 (Mon, 03 Mar 2008)
New Revision: 6487
Modified:
trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
trunk/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
Log:
update demo site
Modified: trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2008-03-03 13:28:57
UTC (rev 6486)
+++ trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2008-03-03 13:29:07
UTC (rev 6487)
@@ -32,6 +32,7 @@
import java.util.Set;
import org.richfaces.event.UploadEvent;
+import org.richfaces.model.UploadItem;
/**
* @author $Autor$
@@ -39,7 +40,7 @@
*/
public class Bean {
- private Map data = new HashMap();
+ private List data = new ArrayList();
private boolean flag;
@@ -56,7 +57,7 @@
}
public List getFileList () {
- return data != null ? new ArrayList(data.keySet()) : null;
+ return data;
}
@@ -65,28 +66,30 @@
}
public void listener(UploadEvent event) throws IOException{
- System.out.println("File : '" + event.getFileName() + "' was
uploaded");
- if (event.isFile()) {
- File file = event.getFile();
+ UploadItem item = event.getUploadItem();
+ System.out.println("File : '" + item.getFileName() + "' was
uploaded");
+ if (item.isFile()) {
+ File file = item.getFile();
System.out.println("Absolute Path : '" + file.getAbsolutePath() +
"'!");
}else {
ByteArrayOutputStream b = new ByteArrayOutputStream();
- b.write(event.getData());
+ b.write(item.getData());
System.out.println(b.toString());
}
}
+
/**
* @return the data
*/
- public Map<String, InputStream> getData() {
+ public List getData() {
return data;
}
/**
* @param data the data to set
*/
- public void setData(Map<String, InputStream> data) {
+ public void setData(List data) {
this.data = data;
}
Modified: trunk/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2008-03-03 13:28:57 UTC
(rev 6486)
+++ trunk/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2008-03-03 13:29:07 UTC
(rev 6487)
@@ -42,16 +42,12 @@
<h:form>
<fu:fileUpload
id="upload1"
- data="#{bean.data}"
+ uploadData="#{bean.data}"
fileUploadListener="#{bean.listener}"
listWidth="#{bean.width}px"
listHeight="#{bean.height}px"
maxFilesQuantity="#{bean.maxFiles}"
acceptedTypes="#{bean.fileTypes}">
- <f:facet name="progress">
- <progressBar:progressBar style="height: 5px; width: 250px;">
- </progressBar:progressBar>
- </f:facet>
<f:facet name="label">
<h:outputText value="{_KB}KB from {KB}KB uploaded ---
{mm}:{ss}"></h:outputText>
</f:facet>
@@ -59,7 +55,7 @@
<a4j:commandLink style="font-weight: bold; width: 200px;" value="Show
files uploaded:"
reRender="files_list"></a4j:commandLink><br/><br/>
<h:dataTable value="#{bean.fileList}" var="file"
id="files_list" style="width: 500px">
<h:column>
- <h:outputText value="#{file}"></h:outputText>
+ <h:outputText value="#{file.fileName}"></h:outputText>
</h:column>
</h:dataTable>
Show replies by date