List of usage examples for com.google.gwt.user.client.ui FileUpload setName
public void setName(String name)
From source file:edu.ucla.loni.client.ServerLibraryManager.java
License:Open Source License
/** * Sets workarea to an import form/*from w w w .j a v a2 s . c o m*/ */ private void importForm() { clearWorkarea(); // Title Label title = new Label("Import File(s)"); title.setHeight(30); title.setStyleName("workarea-title"); // Uses GWT form components so we can submit in the background Grid grid = new Grid(4, 3); final FormPanel uploadForm = new FormPanel(); uploadForm.setWidget(grid); uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); uploadForm.setAction(GWT.getModuleBaseURL() + "upload"); // Package Name Label packageLabel = new Label("Package"); packageLabel.setHeight(30); final TextBox packageName = new TextBox(); packageName.setName("packageName"); packageName.setWidth("300px"); Label packageDescription = new Label("Set package to put all uploaded files into that package.<br/>" + "If empty all files will be placed in the package specified in the file"); packageDescription.setHeight(30); packageDescription.setWidth(500); packageDescription.setStyleName("workarea-description"); grid.setWidget(0, 0, packageLabel); grid.setWidget(0, 1, packageName); grid.setWidget(0, 2, packageDescription); // Upload local file Label uploadLabel = new Label("Upload Local Files"); uploadLabel.setHeight(40); FileUpload fileItem = new FileUpload(); fileItem.setName("theMostUniqueName"); Scheduler.get().scheduleDeferred(new Command() { @Override public void execute() { enableUpload(); //FROM :: http://forums.smartclient.com/showthread.php?t=16007 } }); Label uploadDescription = new Label( "Select local files to upload. Accepts \".pipe\" files only. All other files are discarded."); uploadDescription.setHeight(30); uploadDescription.setWidth(500); uploadDescription.setStyleName("workarea-description"); grid.setWidget(1, 0, uploadLabel); grid.setWidget(1, 1, fileItem); grid.setWidget(1, 2, uploadDescription); // Upload URLs Label urlLabel = new Label("Upload From URLs"); urlLabel.setHeight(40); final TextArea urls = new TextArea(); urls.setName("urls"); urls.setWidth("300px"); urls.setHeight("100px"); Label urlDescription = new Label("Enter a newline seperated list of urls."); urlDescription.setHeight(40); urlDescription.setWidth(400); urlDescription.setStyleName("workarea-description"); grid.setWidget(2, 0, urlLabel); grid.setWidget(2, 1, urls); grid.setWidget(2, 2, urlDescription); Button uploadButton = new Button("Send"); uploadButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { uploadForm.submit(); } }); grid.setWidget(3, 0, uploadButton); uploadForm.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults().length() == 0) { success("Successfully uploaded files"); } else { error("Failed to upload files: " + event.getResults()); } updateFullTree(null); basicInstructions(); } }); // Root Directory Hidden hRoot = new Hidden(); hRoot.setName("root"); hRoot.setValue(rootDirectory.absolutePath); grid.setWidget(3, 1, hRoot); workarea.addMember(title); workarea.addMember(uploadForm); }
From source file:net.scran24.admin.client.UserManager.java
public UserManager() { FlowPanel contents = new FlowPanel(); final FormPanel form = new FormPanel(); form.setAction(GWT.getModuleBaseURL() + "uploadUserInfo"); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); VerticalPanel panel = new VerticalPanel(); form.setWidget(panel);// w w w. j av a 2s .co m final FileUpload upload = new FileUpload(); upload.setName("file"); panel.add(upload); RadioButton append = new RadioButton("mode", "Append to existing user list"); append.setFormValue("append"); final RadioButton replace = new RadioButton("mode", "Replace existing user list"); replace.setFormValue("replace"); replace.setValue(true); panel.add(append); panel.add(replace); panel.add(WidgetFactory.createButton("Upload", new ClickHandler() { @Override public void onClick(ClickEvent event) { form.submit(); } })); form.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { if (upload.getFilename().isEmpty()) { Window.alert("Please choose a .csv file containing user information to upload"); event.cancel(); } else if (replace.getValue()) if (!Window.confirm( "Doing this will delete all user information from the database and replace it with the list you are submitting. Proceed?")) event.cancel(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { // This is not a very robust way of detecting the status code, // but unfortunately there does not seem to be a better way of doing // this // that supports IE8 -- Ivan. // https://code.google.com/p/google-web-toolkit/issues/detail?id=7365 String result = event.getResults(); if (result.equals("OK")) Window.alert("User information uploaded."); else if (result.startsWith("ERR:")) { Window.alert("There was a problem uploading the user information: " + result.substring(4)); } else if (result.contains("401")) { LoginForm.showPopup(new Callback1<UserInfo>() { @Override public void call(UserInfo info) { form.submit(); } }); } else if (result.contains("403")) { // User is not authorised, e.g. someone has logged on as admin, // opened the user upload tab and timed out, then someone else // logged on as someone who does not have the right to // upload users. In this case, let them know and refresh the page // to either show the UI that corresponds to their set of permissions // or redirect them to another page. Window.alert("You are not authorised to upload user information."); Location.reload(); } } }); contents.add(new HTMLPanel("<h2>Staff user accounts</h2>")); contents.add(new Button("Add")); contents.add(new HTMLPanel("<h2>Respondent user accounts</h2>")); contents.add(form); initWidget(contents); }
From source file:net.scran24.common.client.UserInfoUpload.java
public UserInfoUpload(final String surveyId, final String role, final List<String> permissions, final Callback1<Option<String>> onUploadComplete) { final FormPanel form = new FormPanel(); form.setAction(GWT.getModuleBaseURL() + "../staff/uploadUserInfo?surveyId=" + surveyId); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); VerticalPanel panel = new VerticalPanel(); form.setWidget(panel);//from w ww . j av a 2s . co m final Hidden roleField = new Hidden("role", role); panel.add(roleField); for (String perm : permissions) { final Hidden permField = new Hidden("permission", perm); panel.add(permField); } final FileUpload upload = new FileUpload(); upload.setName("file"); panel.add(upload); Button uploadButton = WidgetFactory.createButton("Upload", new ClickHandler() { @Override public void onClick(ClickEvent event) { form.submit(); } }); uploadButton.getElement().addClassName("scran24-admin-button"); panel.add(uploadButton); form.addSubmitHandler(new SubmitHandler() { @Override public void onSubmit(SubmitEvent event) { if (upload.getFilename().isEmpty()) { Window.alert("Please choose a .csv file containing user information to upload"); event.cancel(); } } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { // This is not a very robust way of detecting the status code, // but unfortunately there does not seem to be a better way of // doing this that supports IE8 // https://code.google.com/p/google-web-toolkit/issues/detail?id=7365 String result = event.getResults(); if (result.equals("OK")) { onUploadComplete.call(Option.<String>none()); } else if (result.startsWith("ERR:")) { onUploadComplete.call( Option.some("There was a problem uploading user information: " + result.substring(4))); } else if (result.contains("401")) { LoginForm.showPopup(new Callback1<UserInfo>() { @Override public void call(UserInfo info) { form.submit(); } }); } else if (result.contains("403")) { // User is not authorised, e.g. someone has logged on as // admin, opened the user upload tab and timed out, then someone // else logged on as someone who does not have the right to // upload users. In this case, let them know and refresh the // page to either show the UI that corresponds to their set of // permissions or redirect them to another page. onUploadComplete.call(Option.some("You are not authorised to upload user information.")); } else { onUploadComplete .call(Option.some("There was an problem uploading user information: " + result)); } } }); initWidget(form); }
From source file:org.bonitasoft.console.client.view.FileUploadWidget.java
License:Open Source License
protected FileUpload getFileUpload() { FileUpload fileUpload = new FileUpload(); // mandatory// w w w. j ava2s . c o m fileUpload.setName("uploadFormElement"); if (myFileNameValidationHandler != null) { fileUpload.addChangeHandler(myFileNameValidationHandler); } fileUpload.getElement().setAttribute("size", "45%"); return fileUpload; }
From source file:org.bonitasoft.forms.client.view.widget.FileUploadWidget.java
License:Open Source License
protected FileUpload addFileUploalToFormPanel(final String fileUploadName) { final FileUpload fileUpload = new FileUpload(); fileUpload.addChangeHandler(new ChangeHandler() { @Override//from www .j a va2 s. c o m public void onChange(final ChangeEvent event) { formPanel.submit(); } }); fileUpload.setStyleName("bonita_file_upload"); // mandatory because we are in a true form with a post action fileUpload.setName(fileUploadName); if (DOMUtils.getInstance().isIE8()) { fileUpload.getElement().setPropertyString("contentEditable", "false"); } formPanel.add(fileUpload); final UploadSubmitHandler uploadHandler = new UploadSubmitHandler(); formPanel.addSubmitHandler(uploadHandler); formPanel.addSubmitCompleteHandler(uploadHandler); return fileUpload; }
From source file:org.catrobat.html5player.client.Html5Player.java
License:Open Source License
public void onModuleLoad() { mainPanel.add(rotateLeftButton);/*from www. j a v a 2 s. c o m*/ mainPanel.add(rotateRightButton); final String projectFileUrl = Window.Location.getParameter("projectfileurl"); final String projectNumber = Window.Location.getParameter("projectnumber"); if (projectFileUrl != null) { mainPanel.add(rePlayButton); mainPanel.add(zoomInButton); mainPanel.add(zoomOutButton); mainPanel.add(screenPanel); } else { // String projectPath = Window.Location.getParameter("projectpath"); // if(projectPath != null && !projectPath.equals("")) // { // Const.PROJECT_PATH = projectPath; // } if (projectNumber == null) { // mainPanel.add(playButton); // playButton.ensureDebugId("playButton"); // // mainPanel.add(projectListBox); // playButton.ensureDebugId("projectListBox"); // // mainPanel.add(showLogButton); // showLogButton.ensureDebugId("showLogBox"); // // mainPanel.add(screenPanel); // screenPanel.add(logBox); mainPanel.add(rePlayButton); mainPanel.add(zoomInButton); mainPanel.add(zoomOutButton); VerticalPanel panel = new VerticalPanel(); //create a file upload widget final FileUpload fileUpload = new FileUpload(); //create upload button //pass action to the form to point to service handling file //receiving operation. form.setAction(GWT.getModuleBaseURL() + "fileupload"); // set form to use the POST method, and multipart MIME encoding. form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); fileUpload.setName("uploadFormElement"); panel.add(fileUpload); //add a button to upload the file panel.add(uploadButton); uploadButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { //get the filename to be uploaded String filename = fileUpload.getFilename(); if (filename.length() == 0) { Window.alert("No File Specified!"); } else { form.submit(); } } }); form.add(panel); mainPanel.add(uploadLabel); mainPanel.add(form); mainPanel.add(screenPanel); } else { mainPanel.add(rePlayButton); mainPanel.add(zoomInButton); mainPanel.add(zoomOutButton); mainPanel.add(screenPanel); } } if (Scene.get().createScene() == false) { //TODO exception if canvas not supported? CatrobatDebug.error("Canvas not supported"); return; } rootCanvas = Scene.get().getCanvas(); screenPanel.add(rootCanvas); rootCanvas.ensureDebugId("rootCanvas"); //populateProjectsListBox(); RootPanel.get("firstWindow").add(mainPanel); final Stage stage = Stage.getInstance(); stage.setCanvas(rootCanvas); stage.setLogBox(logBox); stage.defaultLogBoxSettings(); server = new ServerConnectionCalls(); playButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { rotationAngle = 0; rotateDirection(0, screenPanel); CatrobatDebug.info("Play button was clicked, project: " + projectNumber + " is selected"); stage.clearStage(); stage.displayLoadingImage(); stage.setProjectNumber(projectNumber); //get xml-projectfile from server server.getXML(projectNumber); } }); form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { //Window.alert(event.getResults()); rotationAngle = 0; rotateDirection(0, screenPanel); //int selectedIndex = projectListBox.getSelectedIndex(); //String projectNumber = projectListBox.getValue(selectedIndex); stage.clearStage(); stage.displayLoadingImage(); stage.setProjectNumber(projectNumber); server.getXML(); } }); //handle click on the log-button // showLogButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { logBox.setVisible(!logBox.isVisible()); } }); //handle click on the rotateLeft-button // rotateLeftButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { rotateLeft(screenPanel); } }); //handle click on the rotateRight-button // rotateRightButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { rotateRight(screenPanel); } }); //handle click on the replay-button // rePlayButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { stage.clearStage(); stage.displayLoadingImage(); stage.setProjectNumber(projectNumber); if (projectNumber != null) { server.getXML(projectNumber); } else { server.getXML(); } } }); //handle click on the zoomIn-button // zoomInButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { double twice = 2; Scene.get().zoomScene(twice); } }); //handle click on the zoomOut-button // zoomOutButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { double half = 0.5; Scene.get().zoomScene(half); } }); //handle click on the canvas // rootCanvas.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { stage.getSpriteManager().handleScreenClick( getRelativeXforRotation(event.getRelativeX(rootCanvas.getCanvasElement()), event.getRelativeY(rootCanvas.getCanvasElement()), screenPanel), getRelativeYforRotation(event.getRelativeX(rootCanvas.getCanvasElement()), event.getRelativeY(rootCanvas.getCanvasElement()), screenPanel)); } }); // if(projectNumber != null) // { // CatrobatDebug.on(); // stage.clearStage(); // // stage.displayLoadingImage(); // // stage.setProjectNumber(projectNumber); // server.getXML(projectNumber); // } if (projectFileUrl != null) { stage.clearStage(); stage.displayLoadingImage(); server.getXMLFromProjectFileUrl(projectFileUrl); } }
From source file:org.dataconservancy.dcs.access.client.ui.UploadBagDialog.java
License:Apache License
public UploadBagDialog(String bagUrl //, final CaptionPanel researchObjectPanel, final Button ingestButton ) {// w ww. j a v a 2 s .c o m dBox = new DialogBox(false, true); Panel panel = new FlowPanel(); dBox.setAnimationEnabled(true); dBox.setText("Upload Bag as a .zip file"); dBox.setWidget(panel); dBox.center(); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); Button upload = new Button("Upload"); Button cancel = new Button("Cancel"); buttons.add(upload); buttons.add(cancel); final FormPanel form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); Hidden depositurl = new Hidden("bagUrl"); depositurl.setValue(bagUrl); final FileUpload upfile = new FileUpload(); upfile.setName("file"); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(SeadApp.BAG_UPLOAD_URL); panel.add(new Label("Uploaded files will be included in the SIP.")); panel.add(form); panel.add(buttons); upload.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dBox.hide(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() == null) { Window.alert("File upload failed"); dBox.hide(); return; } String[] tempString = event.getResults().split(";"); final String sipPath = tempString[tempString.length - 1].split("<")[0]; String jsonString = event.getResults(); jsonString = jsonString.substring(jsonString.indexOf('{'), jsonString.lastIndexOf('}') + 1); dBox.hide(); JsDcp dcp = JsDcp.create(); JsSearchResult result = JsSearchResult.create(jsonString); for (int i = 0; i < result.matches().length(); i++) { Util.add(dcp, result.matches().get(i)); } PublishDataView.EVENT_BUS.fireEvent(new EntityEditEvent(dcp, true, sipPath)); } }); }
From source file:org.dataconservancy.dcs.access.client.ui.UploadFgdcDialog.java
License:Apache License
public UploadFgdcDialog(String fileUploadUrl) { dBox = new DialogBox(false, true); Panel panel = new FlowPanel(); dBox.setAnimationEnabled(true);/* www.j a v a 2 s. c o m*/ // dBox.setText("Upload local file"); dBox.setStyleName("dialogBox"); dBox.setWidget(panel); dBox.center(); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); Button upload = new Button("Upload"); Button cancel = new Button("Cancel"); buttons.add(upload); buttons.add(cancel); final FormPanel form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); final FileUpload upfile = new FileUpload(); upfile.setName("file"); Hidden depositurl = new Hidden("depositurl"); depositurl.setValue(fileUploadUrl); //depositConfig.fileUploadUrl()); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(SeadApp.FILE_UPLOAD_URL); panel.add(Util.label("Upload Metadata file to be included in the SIP.", "greenFont")); panel.add(form); panel.add(buttons); upload.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dBox.hide(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() == null) { Window.alert("File upload failed"); dBox.hide(); return; } String[] parts = event.getResults().split("\\^"); if (parts.length != 4) { Window.alert("File upload failed: " + event.getResults()); dBox.hide(); return; } String filesrc = parts[1].trim(); MediciIngestPresenter.metadataSrc = filesrc; dBox.hide(); MediciIngestPresenter.mdCb.setText("Uploaded Metadata!"); MediciIngestPresenter.mdCb.setEnabled(false); //Fire an event to update FGDC's successful update } }); }
From source file:org.dataconservancy.dcs.access.client.view.PublishDataView.java
License:Creative Commons License
public PublishDataView() { publishContainer = new VerticalPanel(); publishContainer.addStyleName("PublishContainer"); projectDesciptionPanel = new CaptionPanel("Project Description"); researchObjectPanel = new CaptionPanel("Research Object"); licensePanel = new CaptionPanel("License "); projectDesciptionPanel.setStyleName("CaptionPanelStyle"); researchObjectPanel.setStyleName("CaptionPanelStyle"); licensePanel.setStyleName("CaptionPanelStyle"); publishContainer.add(researchObjectPanel); publishContainer.add(projectDesciptionPanel); publishContainer.add(licensePanel);// w w w .j a v a2 s . c om Grid project = new Grid(3, 2); Label projectName = new Label("Project Name"); projectList = new ListBox(false); Label projectDescription = new Label("Project Description"); project.setCellSpacing(3); project.setCellPadding(3); projectNameTB = new TextBox(); projectNameTB.setEnabled(false); project.setWidget(0, 0, projectName); project.setWidget(0, 1, projectNameTB); abstractTB = new TextArea(); abstractTB.setEnabled(false); project.setWidget(1, 0, projectDescription); project.setWidget(1, 1, abstractTB); VerticalPanel descriptionPanel = new VerticalPanel(); descriptionPanel.add(project); warningPanel = new VerticalPanel(); descriptionPanel.add(warningPanel); projectDesciptionPanel.add(descriptionPanel); Grid ROGrid = new Grid(4, 2); Label uploadLabel = new Label("Upload Local Bag"); previewButton = new Button("Submit Dataset for Review"); form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); Hidden depositurl = new Hidden("bagUrl"); depositurl.setValue(SeadApp.bagIturl); final FileUpload upfile = new FileUpload(); upfile.setName("file"); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(SeadApp.BAG_UPLOAD_URL); Grid uploadGrid = new Grid(4, 2); uploadGrid.setWidget(1, 0, uploadLabel); uploadGrid.setWidget(1, 1, form); uploadBag = new Button("Upload"); uploadGrid.setWidget(3, 1, uploadBag); ROGrid.setCellSpacing(3); ROGrid.setCellPadding(3); // ROGrid.setWidget(0, 0, ROLabel); //ROGrid.setWidget(0, 1, ROList); //ROGrid.setWidget(1, 1, new HTML("Or")); //ROGrid.setWidget(2, 1, browsePanel); //ROGrid.setWidget(2, 1, uploadBag); researchObjectPanel.add(uploadGrid); Panel innerLicensePanel = new FlowPanel(); errorMessage = new Label(); licenseBox = new CheckBox( "By clicking this checkbox, I certify that I agree to release my research data under the terms of the Creative Commons license."); innerLicensePanel.add(errorMessage); innerLicensePanel.add(licenseBox); licensePanel.add(innerLicensePanel); HorizontalPanel previewButtonPanel = new HorizontalPanel(); previewButtonPanel.setWidth("600px"); previewButtonPanel.setStyleName("Margin"); Button clearButton = new Button("Start over"); clearButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { History.newItem(SeadState.UPLOAD.toToken("new")); } }); previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); previewButtonPanel.add(clearButton); previewButtonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); previewButtonPanel.add(previewButton); previewButton.setEnabled(false); publishContainer.add(previewButtonPanel); }
From source file:org.dataconservancy.dcs.ingest.ui.client.Application.java
License:Apache License
private void displayUploadFileDialog() { final DialogBox db = new DialogBox(false, true); Panel panel = new FlowPanel(); db.setAnimationEnabled(true);/*www . ja va 2 s.c o m*/ db.setText("Upload local file"); db.setWidget(panel); db.center(); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setSpacing(5); Button upload = new Button("Upload"); Button cancel = new Button("Cancel"); buttons.add(upload); buttons.add(cancel); final FormPanel form = new FormPanel(); FlowPanel formcontents = new FlowPanel(); form.add(formcontents); final FileUpload upfile = new FileUpload(); upfile.setName("file"); Hidden depositurl = new Hidden("depositurl"); depositurl.setValue(depositConfig.fileUploadUrl()); formcontents.add(upfile); formcontents.add(depositurl); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setAction(FILE_UPLOAD_URL); panel.add(new Label("Uploaded files will be included in the SIP.")); panel.add(form); panel.add(buttons); upload.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { db.hide(); } }); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() == null) { Window.alert("File upload failed"); db.hide(); return; } String[] parts = event.getResults().split("\\^"); if (parts.length != 4) { Window.alert("File upload failed: " + event.getResults()); db.hide(); return; } String filesrc = parts[1].trim(); // TODO String fileatomurl = parts[2].trim(); files.setVisible(true); String id = nextFileId(); fileids.add(id); files.add(new FileEditor(id, upfile.getFilename(), filesrc), id); files.selectTab(files.getWidgetCount() - 1); db.hide(); } }); }