// This is called if the upload is finished.
  public void uploadSucceeded(final Upload.SucceededEvent event) {
    // Log the upload on screen.
    root.addComponent(
        new Label(
            "File " + event.getFilename() + " of type '" + event.getMIMEType() + "' uploaded."));

    // Display the uploaded file in the image panel
    final StreamSource streamSource = new IconStreamSource(outputStream);
    final StreamResource imageResource =
        new StreamResource(streamSource, event.getFilename(), getApplication());

    imagePanel.removeAllComponents();
    imagePanel.addComponent(new Embedded("", imageResource));

    final Set graphVisualization = findGraphVisualization();
    // final Set representationOfSemanticIdentity =
    // findRepresentationOfSemanticIdentity(visualizedGraph);
    final String iconContent = new String(outputStream.toByteArray());
    findIcon(graphVisualization).identity().setPayload(iconContent);

    /*
    final FileResource imageResource =
            new FileResource(file, getApplication());
    imagePanel.removeAllComponents();
    imagePanel.addComponent(new Embedded("", imageResource));
    */
  }
Beispiel #2
0
  // This is called if the upload is finishe
  public void uploadSucceeded(Upload.SucceededEvent event) {

    boolean validData = false;
    try {
      ExperimentBean newExp = this.validateForm();
      if (newExp != null) {
        validData = true;
      }
      if (validData) {
        // send the file to the reader to extract the information

        boolean test =
            eh.handelExperimentFile(
                file,
                event.getMIMEType(),
                newExp); // Getting data from the uploaded file..here we assume that the experiment
                         // id is 1

        if (!test) {
          getWindow()
              .showNotification(
                  "Failed !  Please Check Your Uploaded File !"); // file didn't store in db
        } else {
          // Display the uploaded file in the file panel.
          getWindow().showNotification("Successful !");
          updateComponents(user);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }