The distribution does not seem to include either button images from the examples nor CSS files. I was able to find a new button image, but the styles I added to my CSS file from wht I found on your examples/showcase page have no affect. So now I have a plan bland "Drop files here" without a nice box and the progress bars only have textual information. What am I doing wrong? (Firefox Nightly 31.0a1)
Here is my set-up code:
/*
* prepares the uploader component
*
* @param verticalPanel a place to put the controls
* @param progressBarPanel a place for the progress bars
* @return the uploader for convenience /
private Uploader prepareUploader(final VerticalPanel verticalPanel, final VerticalPanel progressBarPanel) {
uploader.setUploadURL(IMPORT_SERVLET_PATH)
.setButtonImageURL("images/folder_open_add.png")
.setButtonWidth(32)
.setButtonHeight(32)
.setFileSizeLimit("0")
.setButtonCursor(Uploader.Cursor.HAND)
.setButtonAction(Uploader.ButtonAction.SELECT_FILES)
.setFileQueuedHandler(new FileQueuedHandler() {
@Override
public boolean onFileQueued(final FileQueuedEvent fileQueuedEvent) {
dataManager.startUserSessionPolling();
//CreateaProgressBarforthisfilefinalProgressBarprogressBar=newProgressBar(0.0,1.0,0.0,newCancelProgressBarTextFormatter());progressBar.setTitle(fileQueuedEvent.getFile().getName());progressBar.setHeight("18px");progressBar.setWidth("200px");progressBars.put(fileQueuedEvent.getFile().getId(),progressBar);//AddCancelButtonImagefinalImagecancelButton=newImage("images/stop.png");cancelButton.setStyleName("cancelButton");cancelButton.addClickHandler(newCancelButtonClickHandler(fileQueuedEvent,progressBars,progressBar,cancelButton));cancelButtons.put(fileQueuedEvent.getFile().getId(),cancelButton);//AddtheBarandButtontotheinterfaceprogressBarAndButtonPanel.clear();progressBarAndButtonPanel.add(progressBar);progressBarAndButtonPanel.add(cancelButton);progressBarPanel.add(progressBarAndButtonPanel);returntrue;}finalclassCancelButtonClickHandlerimplementsClickHandler{privateFileQueuedEventfileQueuedEvent;privateMap<String,ProgressBar>progressBars;privateProgressBarprogressBar;privateImagecancelButton;/***@paramfileQueuedEvent*@paramprogressBars*@paramprogressBar*@paramcancelButton*/publicCancelButtonClickHandler(FileQueuedEventfileQueuedEvent,Map<String,ProgressBar>progressBars,ProgressBarprogressBar,ImagecancelButton){this.fileQueuedEvent=fileQueuedEvent;this.progressBars=progressBars;this.progressBar=progressBar;this.cancelButton=cancelButton;}@OverridepublicvoidonClick(ClickEventevent){uploader.cancelUpload(fileQueuedEvent.getFile().getId(),false);progressBars.get(fileQueuedEvent.getFile().getId()).setProgress(-1.0d);cancelButton.removeFromParent();progressBars.remove(progressBar);if(progressBars.isEmpty()){closeDialog.setEnabled(true);}}}}).setUploadProgressHandler(newUploadProgressHandler(){@OverridepublicbooleanonUploadProgress(UploadProgressEventuploadProgressEvent){ProgressBarprogressBar=progressBars.get(uploadProgressEvent.getFile().getId());progressBar.setProgress((double)uploadProgressEvent.getBytesComplete()/uploadProgressEvent.getBytesTotal());returntrue;}}).setUploadStartHandler(newUploadStartHandler(){@OverridepublicbooleanonUploadStart(UploadStartEventuploadStartEvent){disableDialog();returntrue;}}).setUploadCompleteHandler(newUploadCompleteHandler(){@OverridepublicbooleanonUploadComplete(UploadCompleteEventuploadCompleteEvent){StringfileId=uploadCompleteEvent.getFile().getId();cancelButtons.remove(fileId).removeFromParent();progressBars.remove(fileId).removeFromParent();enableDialog();uploader.startUpload();returntrue;}}).setFileDialogStartHandler(newFileDialogStartHandler(){@OverridepublicbooleanonFileDialogStartEvent(FileDialogStartEventfileDialogStartEvent){if((uploader.getStats().getUploadsInProgress()<=0)&&importParametersAreValid()){//Cleartheuploadsthathavecompleted,ifnoneareinprocessclearStatusPanel(progressBarPanel);/**CreateanewFileImportRequestobjectinorderto*obtainasharedJobIDforallfilesinthelist.*/prepareImportSubmit();disableDialog();}returntrue;}}).setFileDialogCompleteHandler(newFileDialogCompleteHandler(){@OverridepublicbooleanonFileDialogComplete(FileDialogCompleteEventfileDialogCompleteEvent){if((fileDialogCompleteEvent.getNumberOfFilesSelected()>0)&&(fileDialogCompleteEvent.getTotalFilesInQueue()>0)){if(uploader.getStats().getUploadsInProgress()<=0){uploader.startUpload();}}else{enableDialog();}returntrue;}}).setFileQueueErrorHandler(newFileQueueErrorHandler(){@OverridepublicbooleanonFileQueueError(FileQueueErrorEventfileQueueErrorEvent){clearStatusPanel(progressBarPanel);enableDialog();messageManager.getAlertDialog().alert("<p><b>Upload of file "+fileQueueErrorEvent.getFile().getName()+" failed due to ["+fileQueueErrorEvent.getErrorCode().toString()+"]: "+fileQueueErrorEvent.getMessage()+"</b></p>");returntrue;}}).setUploadErrorHandler(newUploadErrorHandler(){@OverridepublicbooleanonUploadError(UploadErrorEventuploadErrorEvent){clearStatusPanel(progressBarPanel);enableDialog();messageManager.getAlertDialog().alert("<p><b>Upload of file "+uploadErrorEvent.getFile().getName()+" failed due to ["+uploadErrorEvent.getErrorCode().toString()+"]: "+uploadErrorEvent.getMessage()+"</b></p>");returntrue;}});verticalPanel.add(uploader);if(Uploader.isAjaxUploadWithProgressEventsSupported()){finalLabeldropFilesLabel=newLabel("Drop Files Here");dropFilesLabel.setStyleName("dropFilesLabel");dropFilesLabel.addDragOverHandler(newDragOverHandler(){@OverridepublicvoidonDragOver(DragOverEventevent){if(!uploader.getButtonDisabled()){dropFilesLabel.addStyleName("dropFilesLabelHover");}}});dropFilesLabel.addDragLeaveHandler(newDragLeaveHandler(){@OverridepublicvoidonDragLeave(DragLeaveEventevent){dropFilesLabel.removeStyleName("dropFilesLabelHover");}});dropFilesLabel.addDropHandler(newDropHandler(){@OverridepublicvoidonDrop(DropEventevent){dropFilesLabel.removeStyleName("dropFilesLabelHover");if(uploader.getStats().getUploadsInProgress()<=0){clearStatusPanel(progressBarPanel);}uploader.addFilesToQueue(Uploader.getDroppedFiles(event.getNativeEvent()));event.preventDefault();}});verticalPanel.add(dropFilesLabel);}returnuploader;}/***Disablesthecloseandtheuploaderbuttons*/privatevoiddisableDialog(){closeDialog.setEnabled(false);uploader.setButtonDisabled(true);}/***Disablesthecloseandtheuploaderbuttons*/privatevoidenableDialog(){closeDialog.setEnabled(true);uploader.setButtonDisabled(false);}/***Clearstheprogressbarpanelandeverythinginit.**@paramprogressBarPanelthepanelwheretheuploadcontrolsareplaced*/privatevoidclearStatusPanel(VerticalPanelprogressBarPanel){progressBarPanel.clear();progressBars.clear();cancelButtons.clear();}protectedclassCancelProgressBarTextFormatterextendsProgressBar.TextFormatter{@OverrideprotectedStringgetText(ProgressBarbar,doublecurProgress){if(curProgress<0){return"Cancelled";}return((int)(100*bar.getPercent()))+"%";}}
Here is the CSS I copied from your CSS and from the get-incubator
/* ProgessBar styles /
.gwt-ProgressBar-shell {
border: 2px solid #848280;
background-color: #454545;
height: 16px;
width: 50%;
margin-left: 10px;
}
P.S. I had to hunt around to find the progress bars dependency. It might be helpful in quick start to mention that you need the GWT Incubator JAR and some style sheet additions to get that working.
Cheers!
Ben
Last edit: Ben Michaud 2014-07-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The distribution does not seem to include either button images from the examples nor CSS files. I was able to find a new button image, but the styles I added to my CSS file from wht I found on your examples/showcase page have no affect. So now I have a plan bland "Drop files here" without a nice box and the progress bars only have textual information. What am I doing wrong? (Firefox Nightly 31.0a1)
Here is my set-up code:
/*
* prepares the uploader component
*
* @param verticalPanel a place to put the controls
* @param progressBarPanel a place for the progress bars
* @return the uploader for convenience
/
private Uploader prepareUploader(final VerticalPanel verticalPanel, final VerticalPanel progressBarPanel) {
uploader.setUploadURL(IMPORT_SERVLET_PATH)
.setButtonImageURL("images/folder_open_add.png")
.setButtonWidth(32)
.setButtonHeight(32)
.setFileSizeLimit("0")
.setButtonCursor(Uploader.Cursor.HAND)
.setButtonAction(Uploader.ButtonAction.SELECT_FILES)
.setFileQueuedHandler(new FileQueuedHandler() {
@Override
public boolean onFileQueued(final FileQueuedEvent fileQueuedEvent) {
dataManager.startUserSessionPolling();
Here is the CSS I copied from your CSS and from the get-incubator
/* ProgessBar styles /
.gwt-ProgressBar-shell {
border: 2px solid #848280;
background-color: #454545;
height: 16px;
width: 50%;
margin-left: 10px;
}
These are the changes in my GWT XML module definition file:
<inherits name="com.google.gwt.widgetideas.WidgetIdeas">
<set-configuration-property name="xsiframe.failIfScriptTag" value="FALSE">
<inherits name="org.moxieapps.gwt.uploader.Uploader">
</inherits></set-configuration-property></inherits>
P.S. I had to hunt around to find the progress bars dependency. It might be helpful in quick start to mention that you need the GWT Incubator JAR and some style sheet additions to get that working.
Cheers!
Ben
Last edit: Ben Michaud 2014-07-10