Hello together,
i would like to know why after selecting a directory, the onChange method isn't triggered?
Thank you very much for your help.
Code:
public class CenterPanel extends ScrollPanel {
final FileUpload fileUpload = new FileUpload();
public CenterPanel(final GoogleUploader gooUp) {
fileUpload.getElement().setPropertyBoolean("webkitdirectory", true);
Image upBack = new Image(Resources.INSTANCE.uploadBackground());
this.getElement().setPropertyString("align", "left");
upBack.addDoubleClickHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
// TODO Auto-generated method stub
fileUpload.click();
}
});
fileUpload.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
// TODO Auto-generated method stub
JavaScriptObject fileList = event.getNativeEvent().cast();
gooUp.setFileList(getFiles(fileList));
}
});
this.add(upBack);
this.getElement().getStyle().setBackgroundColor("#DBDEE6");
this.getElement().setAttribute("id", "idScrollPanel");
this.setHeight("100%");
this.setWidth("100%");
}
private native JsArray<File> getFiles(JavaScriptObject e) /*-{
var files = e.target.files;
return files;
}-*/;
}
-- i would like to know why after selecting a directory, the onChange method isn't triggered?
Thank you very much for your help.
Code:
public class CenterPanel extends ScrollPanel {
final FileUpload fileUpload = new FileUpload();
public CenterPanel(final GoogleUploader gooUp) {
fileUpload.getElement().setPropertyBoolean("webkitdirectory", true);
Image upBack = new Image(Resources.INSTANCE.uploadBackground());
this.getElement().setPropertyString("align", "left");
upBack.addDoubleClickHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
// TODO Auto-generated method stub
fileUpload.click();
}
});
fileUpload.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
// TODO Auto-generated method stub
JavaScriptObject fileList = event.getNativeEvent().cast();
gooUp.setFileList(getFiles(fileList));
}
});
this.add(upBack);
this.getElement().getStyle().setBackgroundColor("#DBDEE6");
this.getElement().setAttribute("id", "idScrollPanel");
this.setHeight("100%");
this.setWidth("100%");
}
private native JsArray<File> getFiles(JavaScriptObject e) /*-{
var files = e.target.files;
return files;
}-*/;
}
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment