Author: andrei_exadel
Date: 2008-03-21 10:01:37 -0400 (Fri, 21 Mar 2008)
New Revision: 7050
Modified:
trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
fix upload listener event
Modified: trunk/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-03-21 13:58:30 UTC
(rev 7049)
+++ trunk/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-03-21 14:01:37 UTC
(rev 7050)
@@ -55,6 +55,12 @@
<superclassname>org.ajax4jsf.tests.AbstractJspTestCase</superclassname>
</test>
</tag>
+ <taghandler generate="true">
+ <classname>org.richfaces.taglib.FileUploadTagHandler</classname>
+ <superclass>
+ com.sun.facelets.tag.jsf.ComponentHandler
+ </superclass>
+ </taghandler>
&ui_component_attributes;
&ui_input_attributes;
&html_style_attributes;
@@ -160,7 +166,7 @@
</property>
<property>
<name>fileUploadListener</name>
- <classname>javax.el.MethodExpression</classname>
+ <classname>javax.faces.el.MethodBinding</classname>
<description>
MethodExpression representing an action listener method
that will be notified after file uploaded.
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-03-21
13:58:30 UTC (rev 7049)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-03-21
14:01:37 UTC (rev 7050)
@@ -13,6 +13,7 @@
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.el.MethodBinding;
import javax.faces.event.FacesEvent;
import javax.servlet.http.HttpServletRequest;
@@ -126,9 +127,9 @@
public abstract void setLocale(Object locale);
- public abstract MethodExpression getFileUploadListener();
+ public abstract MethodBinding getFileUploadListener();
- public abstract void setFileUploadListener(MethodExpression scrollerListener);
+ public abstract void setFileUploadListener(MethodBinding scrollerListener);
public void addFileUploadListener(FileUploadListener listener) {
addFacesListener(listener);
@@ -152,15 +153,11 @@
public void broadcast(FacesEvent e) {
- //super.broadcast(e);
-
if (e instanceof UploadEvent) {
- // XXX BTW, why doesn't UploadEvent accept any listeners?
-
FacesContext facesContext = FacesContext.getCurrentInstance();
- MethodExpression binding = getFileUploadListener();
+ MethodBinding binding = getFileUploadListener();
if (binding != null) {
- binding.invoke(facesContext.getELContext(), new Object[] { e });
+ binding.invoke(facesContext, new Object[] { e });
}
} else {
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
---
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-21
13:58:30 UTC (rev 7049)
+++
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-21
14:01:37 UTC (rev 7050)
@@ -360,6 +360,7 @@
collection.add(item);
}
}
+// fileUpload.queueEvent(new UploadEvent(fileUpload, item));
new UploadEvent(fileUpload, item).queue();
}
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
---
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-21
13:58:30 UTC (rev 7049)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-21
14:01:37 UTC (rev 7050)
@@ -414,7 +414,6 @@
this.checkFrame();
this.initFileEntryWidth();
this.initLabels(labels);
- this.element.onload = function () {this.initFileInput();}.bind(this);
this.initFileInput();
},
@@ -433,16 +432,16 @@
if (p.getWidth() != 0) {
o.style.width = p.getWidth() + "px";
o.style.height = p.getHeight() + "px";
- p.onclick = null;
+ p.onmouseover = null;
}else {
o.style.width = "30px";
o.style.height = "10px";
- p.onclick = function () {this.initFileInput();}.bind(this);
+ p.onmouseover = function () {this.initFileInput();}.bind(this);
}
},
initFileEntryWidth: function () {
- var w = this.element.clientWidth - 115;
+ var w = this.element.getWidth() - 115;
this.fileEntryWidth = w;
var progressW = this._progressBar.style.width;
if (progressW == "") { progressW = 200; }
Show replies by date