Example usage for com.google.gwt.user.client.ui FormPanel addSubmitCompleteHandler

List of usage examples for com.google.gwt.user.client.ui FormPanel addSubmitCompleteHandler

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FormPanel addSubmitCompleteHandler.

Prototype

public HandlerRegistration addSubmitCompleteHandler(SubmitCompleteHandler handler) 

Source Link

Document

Adds a SubmitCompleteEvent handler.

Usage

From source file:edu.iastate.airl.semtus.client.SEMTUSWEBAPP.java

License:Open Source License

public FormPanel upload() {

    final FormPanel form = new FormPanel();
    form.setAction(GWT.getModuleBaseURL() + "upload");

    // Because we're going to add a FileUpload widget, we'll need to set the
    // form to use the POST method, and multipart MIME encoding.
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    // Create a panel to hold all of the form widgets.
    HorizontalPanel panel = new HorizontalPanel();
    form.setWidget(panel);/*from  ww w. j  a va 2s. co m*/

    // Create a FileUpload widget.
    final FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");
    panel.add(upload);

    panel.add(new HTML("  "));

    // Add a 'submit' button.
    panel.add(new Button("Upload", new ClickHandler() {

        public void onClick(ClickEvent event) {

            String filename = upload.getFilename();

            if (filename.length() == 0) {

                Window.alert("No File Specified");

            } else {

                form.submit();
            }
        }
    }));

    panel.add(new HTML(" "));

    // Add a 'Done' button.
    panel.add(new Button("Done", new ClickHandler() {
        public void onClick(ClickEvent event) {

            uploadBox.hide();
            tabPanel.selectTab(0);
        }
    }));

    // Add an event handler to the form.
    form.addSubmitHandler(new FormPanel.SubmitHandler() {
        public void onSubmit(SubmitEvent event) {
        }
    });

    form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
        public void onSubmitComplete(SubmitCompleteEvent event) {

            // Check if there's been an error in upload
            if (event.getResults() == null) {

                Window.alert(
                        "Ontology Upload Failed. Please give us feedback [sushain.pandit@gmail.com] explaining the parameters of upload (filesize, format, etc) and we'll try to get it resolved asap.");

            } else if (event.getResults().toLowerCase().contains("file already exists")) { // if it's already present on
                // server, then we're just
                // fine.

                Window.alert(
                        "You just uploaded this ontology. Please proceed to the workspace for text input. Thanks !");

            } else if (event.getResults().toLowerCase().contains("error")
                    || event.getResults().toLowerCase().contains("not available")) { // o'wise flag an error

                Window.alert(
                        "Ontology Upload Failed. Please give us feedback [sushain.pandit@gmail.com] explaining the parameters of upload (filesize, format, etc) and we'll try to get it resolved asap.");

            } else {

                Window.alert(event.getResults());
                Window.alert("Ontology Upload Successful");
            }
        }
    });

    return form;
}

From source file:edu.ucla.loni.client.ServerLibraryManager.java

License:Open Source License

/**
 *  Sets workarea to an import form/* w  ww  .  ja  v  a 2  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:es.upm.fi.dia.oeg.map4rdf.client.presenter.ShapeFilesPresenter.java

License:Open Source License

@Override
protected void onBind() {
    final FormPanel form = getDisplay().getFormUpload();

    getDisplay().getSubmitUrlButton().addClickHandler(new ClickHandler() {
        @Override//from   w  w  w  .ja v a  2  s. c  o m
        public void onClick(ClickEvent event) {
            form.setEncoding(FormPanel.ENCODING_URLENCODED);
            form.submit();
        }
    });

    getDisplay().getSubmitUploadButton().addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // The form needs to be multipart for the section that uploads
            // the zip file.
            form.setEncoding(FormPanel.ENCODING_MULTIPART);
            form.submit();
        }
    });

    form.addSubmitHandler(new FormPanel.SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            // TODO(jonathangsc): Check if any action here is desired to
            // notify the user.
            // Window.alert("Submitting!");
        }
    });

    form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            String message = event.getResults().split(">")[1].split("<")[0];
            String fileName = "";
            if (message.contains("successfully")) {
                fileName = message.split(": ")[1];
                eventBus.fireEvent(new ShapeFilesChangedEvent(fileName));
            } else {
                // In case the upload / download is not successful,
                // the error message should be displayed to the user.
                Window.alert(message);
            }
        }
    });
}

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);/*from   w w w .j  a v  a2s  .  com*/

    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);/* w w w  .  j  a  v  a  2  s . c om*/

    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.cloudcoder.app.client.view.BulkRegistrationPanel.java

License:Open Source License

/**
 * Constructor.//  w w w.ja  v  a  2 s  . c  om
 */
public BulkRegistrationPanel(final CloudCoderPage page) {
    super(new FormPanel());

    FormPanel formPanel = (FormPanel) getPanel();
    formPanel.setWidth("100%");
    formPanel.setHeight("144px");

    formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    formPanel.setMethod(FormPanel.METHOD_POST);
    formPanel.setAction(GWT.getModuleBaseURL() + "registerStudents");

    this.layoutPanel = new LayoutPanel();
    formPanel.add(layoutPanel);

    double y = 10.0;

    // Add widgets
    InlineHTML fileFormatMsg = new InlineHTML("File should be tab-delimited in format:<br>"
            + "<tt>username firstname lastname email password</tt>");
    y = addWidget(y, fileFormatMsg, "", new NoopFieldValidator(), 36.0);

    this.fileUpload = new FileUpload();
    fileUpload.setName("fileupload");
    y = addWidget(y, fileUpload, "Filename:", new NoopFieldValidator());

    this.submitButton = new SubmitButton("Register students");
    y = addWidget(y, submitButton, "", new NoopFieldValidator());

    this.courseId = new Hidden();
    courseId.setName("courseId");
    layoutPanel.add(courseId);

    formPanel.addSubmitHandler(new SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            page.getSession().add(StatusMessage.pending("Uploading student data..."));
        }
    });
    formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {
        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            String results = event.getResults();
            if (results == null) {
                page.getSession().add(StatusMessage.error("Error communicating with server"));
            } else {
                if (results.startsWith("Error: ")) {
                    results = results.substring("Error: ".length());
                    page.getSession().add(StatusMessage.error(results));
                } else {
                    page.getSession().add(StatusMessage.goodNews(results));
                    clear();
                }
            }
        }
    });
}

From source file:org.datacleaner.monitor.shared.widgets.FileUploadFunctionHandler.java

License:Open Source License

public static void uploadFile(String fileUploadElementId) {
    final Element element = Document.get().getElementById(fileUploadElementId);

    final InputElement inputElement = getFileInput(element);
    if (inputElement == null) {
        throw new IllegalArgumentException("No file input found within element id: " + fileUploadElementId);
    }/*from  ww  w  . j  a  va 2 s  .c o m*/

    GWT.log("Found file input element: " + inputElement);

    final String inputName = inputElement.getName();
    final Element parent = inputElement.getParentElement();

    parent.setInnerHTML("<div class='loader'></div>");

    // use "contentType" param because form submission requires everything
    // to be text/html
    final String url = Urls.createRelativeUrl("util/upload?contentType=text/html");

    final RootPanel rootPanel = RootPanel.get();

    final FormPanel form = new FormPanel();
    form.setVisible(false);
    form.setAction(url);
    form.setMethod(FormPanel.METHOD_POST);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.getElement().appendChild(inputElement);
    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {

        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {

            final String stringResponse = event.getResults();

            GWT.log("File upload form submit complete! Results: " + stringResponse);

            try {
                final JSONValue jsonResponse = JSONParser.parseLenient(stringResponse);
                final JSONArray jsonFiles = jsonResponse.isObject().get("files").isArray();
                final JSONValue jsonFile = jsonFiles.get(0);
                final String jsonFileStr = jsonFile.toString();
                parent.setInnerHTML("<p>File uploaded!</p><input type='hidden' name='" + inputName + "' value='"
                        + jsonFileStr + "' />");
                rootPanel.remove(form);
            } catch (Exception e) {
                ErrorHandler.showErrorDialog("Unexpected error occurred",
                        "An error occurred when uploading the file to the server.", stringResponse);
            }
        }
    });

    rootPanel.add(form);

    GWT.log("Submitting hidden file upload form");

    form.submit();
}

From source file:org.dataconservancy.dcs.access.client.ui.UploadBagDialog.java

License:Apache License

public UploadBagDialog(String bagUrl
//, final CaptionPanel researchObjectPanel, final Button ingestButton
) {/*www. j  a v  a2 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);//from ww w  .ja va 2  s.  com
    //  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.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);/*ww  w .jav  a 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();
        }
    });
}