Author: mvitenkov
Date: 2008-04-24 11:32:18 -0400 (Thu, 24 Apr 2008)
New Revision: 8132
Added:
trunk/test-applications/jsp/src/main/java/org/
trunk/test-applications/jsp/src/main/java/org/richfaces/
trunk/test-applications/jsp/src/main/java/org/richfaces/renderkit/
trunk/test-applications/jsp/src/main/java/org/richfaces/renderkit/fileUpload.properties
Modified:
trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java
trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml
trunk/test-applications/jsp/src/main/webapp/styles/styles.css
Log:
uploadData="#{fileUpload.data}"
acceptedTypes="#{fileUpload.acceptedTypes}"
disabled="#{fileUpload.disabled}"
autoclear="#{fileUpload.autoclear}"
required="#{fileUpload.required}"
requiredMessage="#{fileUpload.requiredMessage}"
rendered="#{fileUpload.rendered}"
listHeight="#{fileUpload.listHeight}"
listWidth="#{fileUpload.listWidth}"
maxFilesQuantity="#{fileUpload.maxFilesQuantity}"
fileUploadListener="#{fileUpload.fileUploadListener}"
onuploadcanceled="#{event.onuploadcanceled}"
onclear="#{event.onclear}"
onblur="#{event.onblur}"
onchange="#{event.onchange}"
onclick="#{event.onclick}"
ondblclick="#{event.ondblclick}"
onerror="#{event.onerror}"
onfocus="#{event.onfocus}"
onkeydown="#{event.onkeydown}"
onkeypress="#{event.onkeypress}"
onkeyup="#{event.onkeyup}"
onmousedown="#{event.onmousedown}"
onmousemove="#{event.onmousemove}"
onmouseout="#{event.onmousemout}"
onmouseover="#{event.onmouseover}"
onmouseup="#{event.onmouseup}"
onselect="#{event.onselect}"
onsizerejected="#{event.onsizerejected}"
ontyperejected="#{event.ontyperejected}"
onupload="#{event.onupload}"
onuploadcomplete="#{event.onuploadcomplete}"
accesskey="y" alt="alternative"
align="#{fileUpload.align}"
binding="#{fileUpload.myFileUpload}"
addButtonClass="#{fileUpload.addButtonClass}"
addButtonClassDisabled="#{fileUpload.addButtonClassDisabled}"
cancelButtonClass="#{fileUpload.cancelButtonClass}"
cancelButtonClassDisabled="#{fileUpload.cancelButtonClassDisabled}"
cleanButtonClass="#{fileUpload.cleanButtonClass}"
cleanButtonClassDisabled="#{fileUpload.cleanButtonClassDisabled}"
fileEntryClass="#{fileUpload.fileEntryClass}"
fileEntryControlClass="#{fileUpload.fileEntryControlClass}"
fileEntryControlClassDisabled="#{fileUpload.fileEntryControlClassDisabled}"
fileEntryClassDisabled="#{fileUpload.fileEntryControlClassDisabled}"
uploadButtonClass="#{fileUpload.uploadButtonClass}"
uploadButtonClassDisabled="#{fileUpload.uploadButtonClassDisabled}"
uploadListClass="#{fileUpload.uploadListClass}"
uploadListClassDisabled="#{fileUpload.uploadListClassDisabled}"
converter="fileUploadConverter"
immediateUpload="#{fileUpload.immediateUpload}"
locale="ru"
noDuplicate="#{fileUpload.noDuplicate}"
tabindex="222"
valueChangeListener="#{fileUpload.valueChangeListener}"
Modified: trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java 2008-04-24
15:02:45 UTC (rev 8131)
+++ trunk/test-applications/jsp/src/main/java/fileUpload/FileUpload.java 2008-04-24
15:32:18 UTC (rev 8132)
@@ -2,37 +2,99 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.IOException;
+//import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import java.io.InputStream;
+//import java.io.InputStream;
+import org.richfaces.component.html.HtmlFileUpload;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
+import javax.faces.event.ValueChangeEvent;
public class FileUpload {
private boolean disabled;
private boolean autoclear;
private boolean rendered;
private boolean required;
+ private boolean immediateUpload;
private String acceptedTypes;
private String requiredMessage;
private String listHeight;
private String listWidth;
+ private String align;
+ private String bindLabel;
+
+ private String addButtonClass;
+ private String addButtonClassDisabled;
+ private String cancelButtonClass;
+ private String cancelButtonClassDisabled;
+ private String cleanButtonClass;
+ private String cleanButtonClassDisabled;
+ private String fileEntryClass;
+ private String fileEntryControlClass;
+ private String fileEntryControlClassDisabled;
+ private String fileEntryClassDisabled;
+ private String uploadButtonClass;
+ private String uploadButtonClassDisabled;
+ private String uploadListClass;
+ private String uploadListClassDisabled;
+ private String changedLabel;
+
+
private List data;
private Integer maxFilesQuantity;
-
+ private HtmlFileUpload myFileUpload;
+ private boolean noDuplicate;
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+ public HtmlFileUpload getMyFileUpload() {
+ return myFileUpload;
+ }
+
+ public void setMyFileUpload(HtmlFileUpload myFileUpload) {
+ this.myFileUpload = myFileUpload;
+ }
+
public FileUpload() {
data = new ArrayList();
disabled = false;
autoclear = false;
rendered = true;
required = false;
+ immediateUpload = false;
acceptedTypes = "*";
requiredMessage = "requiredMessage";
listHeight = "200px";
listWidth = "150px";
maxFilesQuantity = 3;
+ align = "left";
+ bindLabel = "not ready";
+ changedLabel = "not ready";
+ addButtonClass="test";
+ addButtonClassDisabled="test";
+ cancelButtonClass="test";
+ cancelButtonClassDisabled="test";
+ cleanButtonClass="test";
+ cleanButtonClassDisabled="test";
+ fileEntryClass="test";
+ fileEntryControlClass="test";
+ fileEntryControlClassDisabled="test";
+ fileEntryClassDisabled="test";
+ uploadButtonClass="test";
+ uploadButtonClassDisabled="test";
+ uploadListClass="test";
+ uploadListClassDisabled="test";
+ noDuplicate = false;
}
public void fileUploadListener(UploadEvent event) throws Exception{
@@ -47,6 +109,11 @@
System.out.println("FileUpload.fileUploadListener()");
}
+ public void checkBinding(ActionEvent actionEvent){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = myFileUpload.getClientId(context);
+ }
+
public boolean isDisabled() {
return disabled;
}
@@ -128,4 +195,152 @@
public void setData(List data) {
this.data = data;
}
+
+ public String getAlign() {
+ return align;
+ }
+
+ public void setAlign(String align) {
+ this.align = align;
+ }
+
+ public String getAddButtonClass() {
+ return addButtonClass;
+ }
+
+ public void setAddButtonClass(String addButtonClass) {
+ this.addButtonClass = addButtonClass;
+ }
+
+ public String getAddButtonClassDisabled() {
+ return addButtonClassDisabled;
+ }
+
+ public void setAddButtonClassDisabled(String addButtonClassDisabled) {
+ this.addButtonClassDisabled = addButtonClassDisabled;
+ }
+
+ public String getCancelButtonClass() {
+ return cancelButtonClass;
+ }
+
+ public void setCancelButtonClass(String cancelButtonClass) {
+ this.cancelButtonClass = cancelButtonClass;
+ }
+
+ public String getCancelButtonClassDisabled() {
+ return cancelButtonClassDisabled;
+ }
+
+ public void setCancelButtonClassDisabled(String cancelButtonClassDisabled) {
+ this.cancelButtonClassDisabled = cancelButtonClassDisabled;
+ }
+
+ public String getCleanButtonClass() {
+ return cleanButtonClass;
+ }
+
+ public void setCleanButtonClass(String cleanButtonClass) {
+ this.cleanButtonClass = cleanButtonClass;
+ }
+
+ public String getCleanButtonClassDisabled() {
+ return cleanButtonClassDisabled;
+ }
+
+ public void setCleanButtonClassDisabled(String cleanButtonClassDisabled) {
+ this.cleanButtonClassDisabled = cleanButtonClassDisabled;
+ }
+
+ public String getFileEntryClass() {
+ return fileEntryClass;
+ }
+
+ public void setFileEntryClass(String fileEntryClass) {
+ this.fileEntryClass = fileEntryClass;
+ }
+
+ public String getFileEntryControlClass() {
+ return fileEntryControlClass;
+ }
+
+ public void setFileEntryControlClass(String fileEntryControlClass) {
+ this.fileEntryControlClass = fileEntryControlClass;
+ }
+
+ public String getFileEntryControlClassDisabled() {
+ return fileEntryControlClassDisabled;
+ }
+
+ public void setFileEntryControlClassDisabled(
+ String fileEntryControlClassDisabled) {
+ this.fileEntryControlClassDisabled = fileEntryControlClassDisabled;
+ }
+
+ public String getFileEntryClassDisabled() {
+ return fileEntryClassDisabled;
+ }
+
+ public void setFileEntryClassDisabled(String fileEntryClassDisabled) {
+ this.fileEntryClassDisabled = fileEntryClassDisabled;
+ }
+
+ public String getUploadButtonClass() {
+ return uploadButtonClass;
+ }
+
+ public void setUploadButtonClass(String uploadButtonClass) {
+ this.uploadButtonClass = uploadButtonClass;
+ }
+
+ public String getUploadButtonClassDisabled() {
+ return uploadButtonClassDisabled;
+ }
+
+ public void setUploadButtonClassDisabled(String uploadButtonClassDisabled) {
+ this.uploadButtonClassDisabled = uploadButtonClassDisabled;
+ }
+
+ public String getUploadListClass() {
+ return uploadListClass;
+ }
+
+ public void setUploadListClass(String uploadListClass) {
+ this.uploadListClass = uploadListClass;
+ }
+
+ public String getUploadListClassDisabled() {
+ return uploadListClassDisabled;
+ }
+
+ public void setUploadListClassDisabled(String uploadListClassDisabled) {
+ this.uploadListClassDisabled = uploadListClassDisabled;
+ }
+
+ public boolean isImmediateUpload() {
+ return immediateUpload;
+ }
+
+ public void setImmediateUpload(boolean immediateUpload) {
+ this.immediateUpload = immediateUpload;
+ }
+
+ public boolean isNoDuplicate() {
+ return noDuplicate;
+ }
+
+ public void setNoDuplicate(boolean noDuplicate) {
+ this.noDuplicate = noDuplicate;
+ }
+ public void valueChangeListener(ValueChangeEvent valueChangeEvent){
+ changedLabel = myFileUpload.getUploadData().toString();
+ }
+
+ public String getChangedLabel() {
+ return changedLabel;
+ }
+
+ public void setChangedLabel(String changedLabel) {
+ this.changedLabel = changedLabel;
+ }
}
Added:
trunk/test-applications/jsp/src/main/java/org/richfaces/renderkit/fileUpload.properties
===================================================================
---
trunk/test-applications/jsp/src/main/java/org/richfaces/renderkit/fileUpload.properties
(rev 0)
+++
trunk/test-applications/jsp/src/main/java/org/richfaces/renderkit/fileUpload.properties 2008-04-24
15:32:18 UTC (rev 8132)
@@ -0,0 +1,9 @@
+RICH_FILE_UPLOAD_CANCEL_LABEL=\u043D\u0435 \u043D\u0430\u0434\u0430
+RICH_FILE_UPLOAD_STOP_LABEL=\u0441\u0442\u0430\u044F\u0442\u044C\!
+RICH_FILE_UPLOAD_PROGRESS_LABEL=\u0434\u0443\u043C\u0430\u044E...
+RICH_FILE_UPLOAD_UPLOAD_LABEL=\u043F\u043E\u0435\u0445\u0430\u043B\u0438\!
+RICH_FILE_UPLOAD_CLEAR_LABEL=\u0441\u0434\u0435\u043B\u0430\u0442\u044C
\u0447\u0438\u0441\u0442\u0435\u043D\u044C\u043A\u043E\:)
+RICH_FILE_UPLOAD_CLEAR_ALL_LABEL=\u0441\u043D\u0435\u0441\u0442\u0438 \u0432\u0441\u0435
\:\\
+RICH_FILE_UPLOAD_ENTRY_CLEAR_LABEL=\u0441\u0442\u0435\u0440\u0435\u0442\u044C \u0438
\u043D\u0438\u0438\u0431\u0430\u0446\u043E
+RICH_FILE_UPLOAD_ENTRY_CANCEL_LABEL=\u044F
\u043F\u0435\u0440\u0435\u0434\u0443\u043C\u0430\u043B
+RICH_FILE_UPLOAD_ADD_LABEL=\u0434\u0430\u0431\u0430\u0432\u0438\u0442\u044C
\u0438\u0441\u0447\u043E
Modified: trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp 2008-04-24
15:02:45 UTC (rev 8131)
+++ trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp 2008-04-24
15:32:18 UTC (rev 8132)
@@ -4,17 +4,18 @@
<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="FileUploadSubviewID">
- <rich:fileUpload id="fileUploadID"
uploadData="#{fileUpload.data}"
+ <rich:fileUpload id="fileUploadID"
+ uploadData="#{fileUpload.data}"
acceptedTypes="#{fileUpload.acceptedTypes}"
- disabled="#{fileUpload.disabled}"
autoclear="#{fileUpload.autoclear}"
+ disabled="#{fileUpload.disabled}"
+ autoclear="#{fileUpload.autoclear}"
required="#{fileUpload.required}"
requiredMessage="#{fileUpload.requiredMessage}"
rendered="#{fileUpload.rendered}"
listHeight="#{fileUpload.listHeight}"
listWidth="#{fileUpload.listWidth}"
maxFilesQuantity="#{fileUpload.maxFilesQuantity}"
- fileUploadListener="#{fileUpload.fileUploadListener}"
- cleanButtonClass="test"
+ fileUploadListener="#{fileUpload.fileUploadListener}"
onuploadcanceled="#{event.onuploadcanceled}"
onclear="#{event.onclear}"
onblur="#{event.onblur}"
@@ -36,8 +37,29 @@
ontyperejected="#{event.ontyperejected}"
onupload="#{event.onupload}"
onuploadcomplete="#{event.onuploadcomplete}"
- accesskey="y"
- >
+ accesskey="y" alt="alternative"
+ align="#{fileUpload.align}"
+ binding="#{fileUpload.myFileUpload}"
+ addButtonClass="#{fileUpload.addButtonClass}"
+ addButtonClassDisabled="#{fileUpload.addButtonClassDisabled}"
+ cancelButtonClass="#{fileUpload.cancelButtonClass}"
+ cancelButtonClassDisabled="#{fileUpload.cancelButtonClassDisabled}"
+ cleanButtonClass="#{fileUpload.cleanButtonClass}"
+ cleanButtonClassDisabled="#{fileUpload.cleanButtonClassDisabled}"
+ fileEntryClass="#{fileUpload.fileEntryClass}"
+ fileEntryControlClass="#{fileUpload.fileEntryControlClass}"
+ fileEntryControlClassDisabled="#{fileUpload.fileEntryControlClassDisabled}"
+ fileEntryClassDisabled="#{fileUpload.fileEntryControlClassDisabled}"
+ uploadButtonClass="#{fileUpload.uploadButtonClass}"
+ uploadButtonClassDisabled="#{fileUpload.uploadButtonClassDisabled}"
+ uploadListClass="#{fileUpload.uploadListClass}"
+ uploadListClassDisabled="#{fileUpload.uploadListClassDisabled}"
+ converter="fileUploadConverter"
+ immediateUpload="#{fileUpload.immediateUpload}"
+ locale="ru"
+ noDuplicate="#{fileUpload.noDuplicate}"
+ tabindex="222"
+ valueChangeListener="#{fileUpload.valueChangeListener}">
<f:facet name="label">
<h:outputText value="{_KB}KB from {KB}KB uploaded :[ {mm}:{ss}
]"></h:outputText>
</f:facet>
@@ -80,8 +102,32 @@
<h:selectBooleanCheckbox value="#{fileUpload.required}"
onchange="submit();"></h:selectBooleanCheckbox>
+ <h:outputText value="immediateUpload"></h:outputText>
+ <h:selectBooleanCheckbox value="#{fileUpload.immediateUpload}">
+ <a4j:support event="onchange"
reRender="fileUploadID"></a4j:support>
+ </h:selectBooleanCheckbox>
+
<h:outputText value="requiredMessage"></h:outputText>
<h:inputText value="#{fileUpload.requiredMessage}"
onchange="submit();"></h:inputText>
+
+ <h:outputText value="Align"></h:outputText>
+ <h:selectOneRadio value="#{fileUpload.align}">
+ <a4j:support event="onchange"
reRender="fileUploadID"></a4j:support>
+ <f:selectItem itemLabel="right" itemValue="right"/>
+ <f:selectItem itemLabel="left" itemValue="left"/>
+ <f:selectItem itemLabel="center" itemValue="center"/>
+ </h:selectOneRadio>
+
+ <h:commandButton actionListener="#{fileUpload.checkBinding}"
value="Binding"></h:commandButton>
+ <h:outputText value="#{fileUpload.bindLabel}"></h:outputText>
+
+ <h:outputText value="noDuplicate"></h:outputText>
+ <h:selectBooleanCheckbox value="#{fileUpload.noDuplicate}">
+ <a4j:support event="onchange"
reRender="fileUploadID"></a4j:support>
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="Uploaded data:"></h:outputText>
+ <h:outputText
value="#{fileUpload.changedLabel}"></h:outputText>
</h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml
===================================================================
---
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml 2008-04-24
15:02:45 UTC (rev 8131)
+++
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml 2008-04-24
15:32:18 UTC (rev 8132)
@@ -26,4 +26,8 @@
<converter-id>comboBoxConverter</converter-id>
<converter-class>util.converter.ComboBoxConverter</converter-class>
</converter>
+ <converter>
+ <converter-id>fileUploadConverter</converter-id>
+ <converter-class>util.converter.FileUploadConverter</converter-class>
+ </converter>
</faces-config>
Modified: trunk/test-applications/jsp/src/main/webapp/styles/styles.css
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/styles/styles.css 2008-04-24 15:02:45 UTC
(rev 8131)
+++ trunk/test-applications/jsp/src/main/webapp/styles/styles.css 2008-04-24 15:32:18 UTC
(rev 8132)
@@ -251,12 +251,5 @@
background-color: pink;
}
.test{
- color: red;
- background-color: span;
- font: italic;
- font-family: sans-serif;
- font-size: 12px;
- font-weight: bold;
- caption-side: top;
- border: thick;
+ color: green;
}
\ No newline at end of file