Author: mvitenkov
Date: 2008-06-17 08:30:43 -0400 (Tue, 17 Jun 2008)
New Revision: 9074
Modified:
trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp
Log:
enable(), disable(), clear() & stop() JS API with rich:componentControl test
Modified: trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp 2008-06-17
12:07:13 UTC (rev 9073)
+++ trunk/test-applications/jsp/src/main/webapp/FileUpload/FileUpload.jsp 2008-06-17
12:30:43 UTC (rev 9074)
@@ -4,42 +4,29 @@
<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="FileUploadSubviewID">
- <rich:fileUpload id="fileUploadID"
- status="a4jStatusID"
+ <rich:fileUpload id="fileUploadID" status="a4jStatusID"
uploadData="#{fileUpload.data}"
acceptedTypes="#{fileUpload.acceptedTypes}"
- disabled="#{fileUpload.disabled}"
- autoclear="#{fileUpload.autoclear}"
- required="#{fileUpload.required}"
- requiredMessage="#{item.fileName}"
+ disabled="#{fileUpload.disabled}"
autoclear="#{fileUpload.autoclear}"
+ required="#{fileUpload.required}"
requiredMessage="#{item.fileName}"
rendered="#{fileUpload.rendered}"
listHeight="#{fileUpload.listHeight}"
listWidth="#{fileUpload.listWidth}"
maxFilesQuantity="#{fileUpload.maxFilesQuantity}"
- fileUploadListener="#{fileUpload.fileUploadListener}"
+ 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}"
+ 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"
- binding="#{fileUpload.myFileUpload}"
+ ontyperejected="#{event.ontyperejected}"
onupload="#{event.onupload}"
+ onuploadcomplete="#{event.onuploadcomplete}" accesskey="y"
+ alt="alternative" binding="#{fileUpload.myFileUpload}"
addButtonClass="#{fileUpload.addButtonClass}"
addButtonClassDisabled="#{fileUpload.addButtonClassDisabled}"
cancelButtonClass="#{fileUpload.cancelButtonClass}"
@@ -54,33 +41,31 @@
uploadButtonClassDisabled="#{fileUpload.uploadButtonClassDisabled}"
uploadListClass="#{fileUpload.uploadListClass}"
uploadListClassDisabled="#{fileUpload.uploadListClassDisabled}"
- immediateUpload="#{fileUpload.immediateUpload}"
- locale="ru"
- noDuplicate="#{fileUpload.noDuplicate}"
- tabindex="222"
- addControlLabel="addControl"
- clearAllControlLabel="clearAllControl"
+ immediateUpload="#{fileUpload.immediateUpload}" locale="ru"
+ noDuplicate="#{fileUpload.noDuplicate}" tabindex="222"
+ addControlLabel="addControl"
clearAllControlLabel="clearAllControl"
cancelEntryControlLabel="cancelEntryControl"
- clearControlLabel="clearControl"
- doneLabel="done"
- progressLabel="progress"
- sizeErrorLabel="sizeError"
+ clearControlLabel="clearControl" doneLabel="done"
+ progressLabel="progress" sizeErrorLabel="sizeError"
stopControlLabel="stopControl"
stopEntryControlLabel="stopEntryControl"
- transferErrorLabel="transferError"
- uploadControlLabel="uploadControl">
+ transferErrorLabel="transferError"
uploadControlLabel="uploadControl">
<f:facet name="label">
<h:outputText value="{_KB}KB from {KB}KB uploaded :[ {mm}:{ss}
]"></h:outputText>
</f:facet>
+ <f:facet name="header">
+ <h:outputText value="some text"></h:outputText>
+ </f:facet>
</rich:fileUpload>
-
+
<h:panelGrid columns="2">
- <a4j:commandButton value="show file"
reRender="fileUploadDataID"></a4j:commandButton>
- <h:dataTable id="fileUploadDataID" value="#{fileUpload.data}"
var="item">
- <h:column>
- <h:outputText value="#{item.fileName}"></h:outputText>
- </h:column>
- </h:dataTable>
+ <a4j:commandButton value="show file"
reRender="fileUploadDataID"></a4j:commandButton>
+ <h:dataTable id="fileUploadDataID" value="#{fileUpload.data}"
+ var="item">
+ <h:column>
+ <h:outputText value="#{item.fileName}"></h:outputText>
+ </h:column>
+ </h:dataTable>
</h:panelGrid>
<h:panelGrid columns="2">
@@ -115,31 +100,62 @@
<h:outputText value="immediateUpload"></h:outputText>
<h:selectBooleanCheckbox value="#{fileUpload.immediateUpload}">
- <a4j:support event="onchange"
reRender="fileUploadID"></a4j:support>
+ <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}">
+
+ <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>
-
+ <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>
+
+ <a4j:commandLink
+ onclick="$('formID:FileUploadSubviewID:fileUploadID').component.enable()"
+ value="enable()"></a4j:commandLink>
+ <a4j:commandLink
+ onclick="$('formID:FileUploadSubviewID:fileUploadID').component.disable()"
+ value="disable()"></a4j:commandLink>
+ <a4j:commandLink
+ onclick="$('formID:FileUploadSubviewID:fileUploadID').component.stop()"
+ value="stop()"></a4j:commandLink>
+ <a4j:commandLink
+ onclick="$('formID:FileUploadSubviewID:fileUploadID').component.clear()"
+ value="clear()"></a4j:commandLink>
</h:panelGrid>
+ <br />
+ <f:verbatim>
+ <h:outputText value="Component controll" style="FONT-WEIGHT:
bold;"></h:outputText>
+ <br />
+ <a href="#" id="enableID">enable()</a>
+ <br />
+ <a href="#" id="disableID">disable()</a>
+ <br />
+ <a href="#" id="stopID">stop()</a>
+ <br />
+ <a href="#" id="clearID">clear()</a>
+ </f:verbatim>
+
+ <rich:componentControl attachTo="enableID" event="onclick"
for="fileUploadID"
operation="enable"></rich:componentControl>
+ <rich:componentControl attachTo="disableID" event="onclick"
for="fileUploadID"
operation="disable"></rich:componentControl>
+ <rich:componentControl attachTo="stopID" event="onclick"
for="fileUploadID" operation="stop"></rich:componentControl>
+ <rich:componentControl attachTo="clearID" event="onclick"
for="fileUploadID"
operation="clear"></rich:componentControl>
+
</f:subview>
\ No newline at end of file