コード例 #1
0
 @UiHandler("uploadBundleUploadButton")
 void clickUploadBundleUploadButton(ClickEvent event) {
   uploadBundleUploadButton.setEnabled(false);
   if (checkBundleFormValid()) {
     uploadResultTextBox.setVisible(false);
     showUploadProgressForBundle(true);
     presenter.uploadBundle(
         uploadBundleNameTextBox.getText(), uploadBundleClassNameTextBox.getText());
   }
 }
コード例 #2
0
 public void testResetNative() {
   System.out.println("testResetNative"); // this test makes only sense if an event is called
   FormPanel form = new FormPanel();
   RootPanel.get().add(form);
   TextBox textBox = new TextBox();
   textBox.setText("Hello World");
   form.setWidget(textBox);
   assertEquals("Hello World", textBox.getText());
   System.out.println("reset: native");
   nativeFormReset(form.getElement());
   assertEquals("", textBox.getText());
   RootPanel.get().remove(form);
 }
コード例 #3
0
 public void testReset() {
   System.out.println("testReset");
   FormPanel form = new FormPanel();
   RootPanel.get().add(form);
   TextBox textBox = new TextBox();
   textBox.setText("Hello World");
   form.setWidget(textBox);
   assertEquals("Hello World", textBox.getText());
   System.out.println("reset: normal");
   form.reset();
   assertEquals("", textBox.getText());
   RootPanel.get().remove(form);
 }
コード例 #4
0
 private boolean checkBundleFormValid() {
   if (uploadBundleNameTextBox.getText().isEmpty()) {
     showUploadResult(UploadPresenter.MSG_NO_BUNDLE_NAME);
   } else if (!uploadDriverDone) {
     showUploadResult(UploadPresenter.MSG_NO_FILE_DRIVER);
   } else if (!uploadModuleDone) {
     showUploadResult(UploadPresenter.MSG_NO_FILE_MODULE);
   } else if (uploadBundleClassNameTextBox.getText().isEmpty()) {
     showUploadResult(UploadPresenter.MSG_NO_MCL_CLASS_FULL_NAME);
   } else {
     return true;
   }
   return false;
 }
コード例 #5
0
  private void addStock() {
    final String symbol = newSymbolTextBox.getText().toUpperCase().trim();
    newSymbolTextBox.setFocus(true);

    // Stock code must be between 1 and 10 chars that are numbers, letters, or dots.
    if (!symbol.matches("^[0-9A-Z\\.]{1,10}$")) {
      Window.alert("'" + symbol + "' is not a valit symbol.");
      newSymbolTextBox.selectAll();
      return;
    }

    newSymbolTextBox.setText("");
  }
コード例 #6
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
 /** Update the output location as appropriate. */
 public void updateOutputLocation() {
   if (outputPathChangeEnabled && outputPathUserSpecified) {
     // The user can and did influence output path. Keep whatever was the previous setting, unless
     // it is a special value like "<No Files Selected>" or "<No Title>" - wipe that one.
     if (outputPathSpecial) {
       outputPathSpecial = false;
     }
     validateOutputPath(output.getText());
   } else {
     // Automatically populate the file path
     final List<ClientFileSearch> fileSearches = getFileSearches();
     if (files == null || (fileSearches == null) || (fileSearches.isEmpty())) {
       if (!outputPathChangeEnabled) {
         output.setText("<No Files Selected>");
         outputPathSpecial = true;
       } else {
         output.setText("");
       }
       outputValidationPanel.removeValidationsFor(output);
       outputPath = null;
     } else if ((getTitleText() == null) || getTitleText().equals("")) {
       if (!outputPathChangeEnabled) {
         output.setText("<No Title>");
         outputPathSpecial = true;
       } else {
         output.setText("");
       }
       outputValidationPanel.removeValidationsFor(output);
       outputPath = null;
     } else {
       outputPathSpecial = false;
       outputPath = getOutputPathFromFileTable(fileSearches);
       output.setText(outputPath);
       validateOutputPath(outputPath);
     }
   }
 }
コード例 #7
0
  public void testResetEvent() {
    System.out.println("testResetEvent");
    FormPanel form = new FormPanel();
    RootPanel.get().add(form);
    TextBox textBox = new TextBox();
    textBox.setText("Hello World");
    form.setWidget(textBox);

    /*
     *  the following checkbox is not added to the form on purpose
     *  in order to reset it via callback
     */
    final CheckBox checkBox = new CheckBox();
    checkBox.setValue(true);

    /*
     * first test shall not affect the checkbox
     */

    // check preconditions
    assertEquals("Hello World", textBox.getText());
    assertTrue(checkBox.getValue());
    System.out.println("reset: normal");
    form.reset();
    // check postconditions
    assertEquals("", textBox.getText());
    assertTrue(checkBox.getValue());

    /*
     * second test shall affect the checkbox,
     * to this end a ResetHandler is added to to FormPanel which is called on a ResetEvent
     */
    HandlerRegistration handlerRegistration =
        form.addResetHandler(
            new ResetHandler() {

              @Override
              public void onReset(ResetEvent event) {
                checkBox.setValue(false);
              }
            });

    // init preconditions
    textBox.setText("Hello World");
    // check preconditions
    assertEquals("Hello World", textBox.getText());
    assertTrue(checkBox.getValue());
    System.out.println("reset: normal");
    form.reset();
    nativeFormReset(form.getElement());
    // check postconditions
    assertEquals("", textBox.getText());
    assertFalse(checkBox.getValue());

    /*
     * third test shall not affect the checkbox,
     * to this end the ResetHandler is removed from the FormPanel
     */
    handlerRegistration.removeHandler();
    // init preconditions
    textBox.setText("Hello World");
    checkBox.setValue(true);
    // check preconditions
    assertEquals("Hello World", textBox.getText());
    assertTrue(checkBox.getValue());
    System.out.println("reset: normal");
    form.reset();
    // check postconditions
    assertEquals("", textBox.getText());
    assertTrue(checkBox.getValue());

    RootPanel.get().remove(form);
  }
コード例 #8
0
 private String getParameterValue(HorizontalPanel entry) {
   TextBox key = (TextBox) entry.getWidget(2);
   return key.getText();
 }
コード例 #9
0
 public AppointmentModel getModel() {
   return new AppointmentModel(
       doctorName.getText(), dateOfAppointment.getText(), reason.getText());
 }
コード例 #10
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
 /** @return Contents of the Title field, trimmed. */
 private String getTitleText() {
   return title.getText() == null ? null : title.getText().trim();
 }