Esempio n. 1
0
 private void setupLoadingPopup() {
   FlowPanel fp = new FlowPanel();
   Label label = new Label("Deploying Project...");
   Image loadingImage = new Image(OpusImages.INSTANCE.loadingSpinner());
   loadingImage.setStyleName(style.loadingImage());
   label.setStyleName(style.loadingLabel());
   fp.add(loadingImage);
   fp.add(label);
   loadingPopup.add(fp);
 }
Esempio n. 2
0
  @UiHandler("emailTextBox")
  void emailTextBoxOnChange(KeyUpEvent event) {
    if (!usernameTextBox.getText().isEmpty()) {
      if (!isEmailValid()) {
        active.hide();
        emailError.setText("Enter a valid email address");
        emailTextBox.setStyleName(deployer.redBorder());
      } else {
        emailError.setText("");
        emailTextBox.setStyleName(deployer.greyBorder());
      }
    } else {

    }
  }
Esempio n. 3
0
  @UiHandler("passwordConfirmTextBox")
  void passwordConfirmTextBoxOnChange(KeyUpEvent event) {
    if (!usernameTextBox.getText().isEmpty()) {
      if (!isPasswordValid()) {
        active.hide();
        passwordError.setText("Passwords do not match");
        passwordTextBox.setStyleName(deployer.redBorder());
        passwordConfirmTextBox.setStyleName(deployer.redBorder());
      } else {
        passwordError.setText("");
        passwordTextBox.setStyleName(deployer.greyBorder());
        passwordConfirmTextBox.setStyleName(deployer.greyBorder());
      }
    } else {

    }
  }
Esempio n. 4
0
  @UiHandler("emailTextBox")
  void emailTextBoxOnFocus(FocusEvent event) {
    if (!emailTextBox.getStyleName().equals(deployer.redBorder())) {
      active.setVisible(true);

      int x = getTooltipPosition(emailTextBox)[0];
      int y = getTooltipPosition(emailTextBox)[1];

      active.setGray();
      setTooltipPosition(x, y);
      setTooltipText("Enter your email address.");
    }
  }
Esempio n. 5
0
  @UiHandler("passwordConfirmTextBox")
  void passwordConfirmTextBoxOnFocus(FocusEvent event) {
    if (!passwordTextBox.getStyleName().equals(deployer.redBorder())) {
      active.setVisible(true);

      int x = getTooltipPosition(passwordConfirmTextBox)[0];
      int y = getTooltipPosition(passwordConfirmTextBox)[1];

      active.setGray();
      setTooltipPosition(x, y);
      setTooltipText("Confirm the previous password.");
    }
  }
Esempio n. 6
0
  @UiHandler("passwordTextBox")
  void passwordTextBoxOnFocus(FocusEvent event) {
    if (!passwordTextBox.getStyleName().equals(deployer.redBorder())) {
      active.setVisible(true);

      int x = getTooltipPosition(passwordTextBox)[0];
      int y = getTooltipPosition(passwordTextBox)[1];

      active.setGray();
      setTooltipPosition(x, y);
      setTooltipText("Must be entered if your wish to create a superuser.");
    }
  }
Esempio n. 7
0
  private void deployProject() {
    createdProjectName = deploymentOptionsPanel.getProjectName();

    ArrayList<String> paths = appBrowserPanel.getAppPaths();
    ArrayList<String> apptypes = appBrowserPanel.getAppTypes();
    ArrayList<String> appNames = appBrowserPanel.getAppNames();

    StringBuffer formBuilder = new StringBuffer();
    formBuilder.append("csrfmiddlewaretoken=");
    formBuilder.append(URL.encodeQueryString(jsVarHandler.getCSRFTokenURL()));

    formBuilder.append("&form-TOTAL_FORMS=");
    formBuilder.append(URL.encodeQueryString(String.valueOf(paths.size())));
    formBuilder.append("&form-INITIAL_FORMS=");
    formBuilder.append(URL.encodeQueryString(String.valueOf(0)));
    formBuilder.append("&form-MAX_NUM_FORMS=");

    for (int i = 0; i < paths.size(); i++) {
      formBuilder.append("&form-" + i + "-apptype=");
      formBuilder.append(apptypes.get(i));

      formBuilder.append("&form-" + i + "-apppath=");
      formBuilder.append(paths.get(i));

      formBuilder.append("&form-" + i + "-appname=");
      formBuilder.append(appNames.get(i));
    }

    formBuilder.append(deploymentOptionsPanel.getPostData());
    formBuilder.append(projectOptionsPanel.getPostData());
    formBuilder.append(databaseOptionsPanel.getPostData());

    RequestBuilder builder =
        new RequestBuilder(RequestBuilder.POST, "/deployments/" + createdProjectName + "/");
    builder.setHeader("Content-type", "application/x-www-form-urlencoded");
    // builder.setHeader(header, value);

    try {
      Request request =
          builder.sendRequest(
              formBuilder.toString(),
              new RequestCallback() {
                public void onError(Request request, Throwable exception) {
                  ErrorPanel ep = new ErrorPanel(clientFactory);
                  ep.errorHTML.setHTML("<p>Error Occured</p>");
                  deployerDeckPanel.add(ep);
                  deployerDeckPanel.showWidget(deployerDeckPanel.getWidgetIndex(ep));
                }

                public void onResponseReceived(Request request, Response response) {
                  if (response.getText().contains("Back to")) {
                    loadingPopup.hide();
                    eventBus.fireEvent(new AsyncRequestEvent("addProject", createdProjectName));
                  } else {
                    loadingPopup.hide();
                    ErrorPanel ep = new ErrorPanel(clientFactory);
                    ep.errorHTML.setHTML(response.getText());
                    deployerDeckPanel.add(ep);
                    deployerDeckPanel.showWidget(deployerDeckPanel.getWidgetIndex(ep));
                  }
                }
              });
    } catch (RequestException e) {

    }

    loadingPopup.setGlassEnabled(true);
    loadingPopup.setGlassStyleName(style.loadingGlass());
    loadingPopup.show();
    int left = (Window.getClientWidth() / 2) - 150;
    int top = (Window.getClientHeight() / 2) - 10;
    loadingPopup.setPopupPosition(left, top);
    loadingPopup.show();
  }
Esempio n. 8
0
 private void removeAllStyles() {
   passwordTextBox.setStyleName(deployer.greyBorder());
   passwordConfirmTextBox.setStyleName(deployer.greyBorder());
   emailTextBox.setStyleName(deployer.greyBorder());
 }
Esempio n. 9
0
 private void setAllStyles() {
   passwordTextBox.setStyleName(deployer.redBorder());
   passwordConfirmTextBox.setStyleName(deployer.redBorder());
   emailTextBox.setStyleName(deployer.redBorder());
 }