Ejemplo n.º 1
0
    private void exportProject(Project project) {
      Tracking.trackEvent(
          Tracking.PROJECT_EVENT,
          Tracking.PROJECT_ACTION_DOWNLOAD_PROJECT_SOURCE_YA,
          project.getProjectName());

      Downloader.getInstance()
          .download(
              ServerLayout.DOWNLOAD_SERVLET_BASE
                  + ServerLayout.DOWNLOAD_PROJECT_SOURCE
                  + "/"
                  + project.getProjectId());
    }
Ejemplo n.º 2
0
 private boolean deleteConfirmation(List<Project> projects) {
   String message;
   if (projects.size() == 1) {
     message = MESSAGES.confirmDeleteSingleProject(projects.get(0).getProjectName());
   } else {
     StringBuilder sb = new StringBuilder();
     String separator = "";
     for (Project project : projects) {
       sb.append(separator).append(project.getProjectName());
       separator = ", ";
     }
     String projectNames = sb.toString();
     message = MESSAGES.confirmDeleteManyProjects(projectNames);
   }
   return Window.confirm(message);
 }
Ejemplo n.º 3
0
    private void deleteProject(Project project) {
      Tracking.trackEvent(
          Tracking.PROJECT_EVENT,
          Tracking.PROJECT_ACTION_DELETE_PROJECT_YA,
          project.getProjectName());

      final long projectId = project.getProjectId();

      Ode ode = Ode.getInstance();
      boolean isCurrentProject = (projectId == ode.getCurrentYoungAndroidProjectId());
      ode.getEditorManager().closeProjectEditor(projectId);
      if (isCurrentProject) {
        // If we're deleting the project that is currently open in the Designer we
        // need to clear the ViewerBox first.
        ViewerBox.getViewerBox().clear();
      }
      // Make sure that we delete projects even if they are not open.
      doDeleteProject(projectId);
    }
Ejemplo n.º 4
0
    private ProjectWidgets(final Project project) {
      checkBox = new CheckBox();
      checkBox.addValueChangeHandler(
          new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
              boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean
              int row = 1 + projects.indexOf(project);
              if (isChecked) {
                table.getRowFormatter().setStyleName(row, "ode-ProjectRowHighlighted");
                selectedProjects.add(project);
              } else {
                table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted");
                selectedProjects.remove(project);
              }
              Ode.getInstance().getProjectToolbar().updateButtons();
            }
          });

      nameLabel = new Label(project.getProjectName());
      nameLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              Ode.getInstance().openYoungAndroidProjectInDesigner(project);
            }
          });
      nameLabel.addStyleName("ode-ProjectNameLabel");

      DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat();

      Date dateCreated = new Date(project.getDateCreated());
      dateCreatedLabel = new Label(dateTimeFormat.format(dateCreated));

      Date dateModified = new Date(project.getDateModified());
      dateModifiedLabel = new Label(dateTimeFormat.format(dateModified));

      editButton = new Button("Publish");
    }
Ejemplo n.º 5
0
  /** Prepares the app publishing process */
  private void preparePublishApp(Project p, ProjectWidgets pw) {
    //    final GalleryApp app  = new GalleryApp(String title, String developerName, String
    // description,
    //        String creationDate, String updateDate, String imageURL, String sourceFileName,
    //        int downloads, int views, int likes, int comments,
    //        String imageBlobId, String sourceBlobId, String galleryAppId,
    //        ArrayList<String> tags);
    String dateCreated = String.valueOf(p.getDateCreated());
    String dateModified = String.valueOf(p.getDateModified());
    ArrayList<String> tags = new ArrayList<String>();
    tags.add("Education");
    tags.add("testing");
    final GalleryApp app1 =
        new GalleryApp(
            "Sports Analyzer",
            "Joe Hammons",
            "a great game",
            "1355091003791",
            "1355091003791",
            "http://lh3.ggpht.com/zyfGqqiN4P8GvXFVbVf-RLC--PrEDeRCu5jovFYD6l3TXYfU5pR70HXJ3yr-87p5FUGFSxeUgOMecodBOcTFYA7frUg6QTrS5ocMcNk=s100",
            "http://www.appinventor.org/apps2/ihaveadream/ihaveadream.aia",
            2,
            5,
            3,
            4,
            "",
            "",
            "",
            tags);

    pw.editButton.addClickHandler(
        new ClickHandler() {
          //  @Override
          public void onClick(ClickEvent event) {
            Ode.getInstance().switchToGalleryAppView(app1, true);
          }
        });
  }