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");
    }