Author: konstantin.mishin
Date: 2010-11-30 13:55:37 -0500 (Tue, 30 Nov 2010)
New Revision: 20244
Modified:
sandbox/trunk/examples/fileupload-demo/src/main/java/org/richfaces/demo/FileUploadBean.java
sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml
Log:
RF-9501
Modified:
sandbox/trunk/examples/fileupload-demo/src/main/java/org/richfaces/demo/FileUploadBean.java
===================================================================
---
sandbox/trunk/examples/fileupload-demo/src/main/java/org/richfaces/demo/FileUploadBean.java 2010-11-30
18:54:31 UTC (rev 20243)
+++
sandbox/trunk/examples/fileupload-demo/src/main/java/org/richfaces/demo/FileUploadBean.java 2010-11-30
18:55:37 UTC (rev 20244)
@@ -35,7 +35,9 @@
@SessionScoped
public class FileUploadBean {
+ private String acceptedTypes;
private boolean enabled = true;
+ private boolean noDuplicate = false;
private UploadItem item;
public UploadItem getItem() {
@@ -47,8 +49,10 @@
// }
public void listener(UploadEvent event) throws Exception {
- item.getFile().delete();
item = event.getUploadItem();
+ if (item != null) {
+ item.getFile().delete();
+ }
}
public void setEnabled(boolean enabled) {
@@ -57,6 +61,22 @@
public boolean isEnabled() {
return enabled;
+ }
+
+ public void setNoDuplicate(boolean noDuplicate) {
+ this.noDuplicate = noDuplicate;
+ }
+
+ public boolean isNoDuplicate() {
+ return noDuplicate;
+ }
+
+ public void setAcceptedTypes(String acceptedTypes) {
+ this.acceptedTypes = acceptedTypes;
+ }
+
+ public String getAcceptedTypes() {
+ return acceptedTypes;
}
}
Modified: sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml
===================================================================
--- sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml 2010-11-30
18:54:31 UTC (rev 20243)
+++ sandbox/trunk/examples/fileupload-demo/src/main/webapp/fileupload.xhtml 2010-11-30
18:55:37 UTC (rev 20244)
@@ -58,15 +58,27 @@
};
//-->
</script>
- <fu:fileUpload id="fu" enabled="#{fileUploadBean.enabled}"
fileUploadListener="#{fileUploadBean.listener}"
onfilesubmit="onfilesubmit(event)"
onuploadcomplete="onuploadcomplete(event)"/>
+ <fu:fileUpload id="fu"
acceptedTypes="#{fileUploadBean.acceptedTypes}"
enabled="#{fileUploadBean.enabled}"
+ fileUploadListener="#{fileUploadBean.listener}"
noDuplicate="#{fileUploadBean.noDuplicate}"
+ onfilesubmit="onfilesubmit(event)"
onuploadcomplete="onuploadcomplete(event)"/>
<h:outputText value="File name:" />
<a4j:outputPanel
ajaxRendered="true">#{fileUploadBean.item.fileName}</a4j:outputPanel>
<br />
+ <h:outputText value="AcceptedTypes: " />
+ <h:inputText value="#{fileUploadBean.acceptedTypes}">
+ <f:ajax render="fu"/>
+ </h:inputText>
+ <br />
<h:outputText value="Enabled: " />
<h:selectBooleanCheckbox value="#{fileUploadBean.enabled}">
<f:ajax render="fu"/>
</h:selectBooleanCheckbox>
<br />
+ <h:outputText value="NoDuplicate: " />
+ <h:selectBooleanCheckbox
value="#{fileUploadBean.noDuplicate}">
+ <f:ajax render="fu"/>
+ </h:selectBooleanCheckbox>
+ <br />
<input type="submit" />
<a4j:log />
</h:form>
Show replies by date