@FXML
 private void changeToOtherDefectCount(Event event) {
   checkLegacyDTS.setSelected(false);
   checkJIRA.setSelected(false);
   checkOther.setSelected(true);
   textPrefix.setPromptText("Enter prefix");
   textPrefix.setTooltip(new Tooltip("Enter prefix"));
   textPrefix.setDisable(false);
   textPrefix.selectAll();
   textMax.setText(textPrefix.getText() + "99999");
 }
예제 #2
0
  /** Prepares the cell for editing */
  @Override
  public void startEdit() {
    super.startEdit();

    if (textField == null) {
      createTextField();
    }
    setText(null);
    setGraphic(textField);
    textField.setText(getString());
    textField.selectAll();
  }
예제 #3
0
  private String showCreateOrRenameDialog(
      final String title,
      final String headerText,
      final File parent,
      final String name,
      final NameVerifier nameVerifier) {
    final Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle(title);
    alert.setHeaderText(headerText);

    final GridPane contentContainer = new GridPane();
    contentContainer.setPadding(new Insets(8));
    contentContainer.setHgap(8);
    contentContainer.setVgap(8);

    contentContainer.add(new Label("Parent:"), 0, 0);
    final TextField parentTextField = new TextField();
    parentTextField.setEditable(false);

    parentTextField.setText(parent.getAbsolutePath());
    contentContainer.add(parentTextField, 1, 0);

    contentContainer.add(new Label("Name:"), 0, 1);

    final TextField dirNameTextField = new TextField();
    dirNameTextField.setText(name);
    GridPane.setHgrow(dirNameTextField, Priority.ALWAYS);
    contentContainer.add(dirNameTextField, 1, 1);

    final InvalidationListener updateDisableInvalidationListener =
        (observable) -> {
          final String dirName = dirNameTextField.getText();
          final Node okButton = alert.getDialogPane().lookupButton(ButtonType.OK);
          if (isEmpty(dirName)) okButton.setDisable(true);
          else {
            final boolean nameAcceptable = nameVerifier.isNameAcceptable(dirName);
            okButton.setDisable(!nameAcceptable);
          }
        };
    dirNameTextField.textProperty().addListener(updateDisableInvalidationListener);

    alert.getDialogPane().setContent(contentContainer);
    alert.setOnShowing(
        (event) -> {
          dirNameTextField.requestFocus();
          dirNameTextField.selectAll();
          updateDisableInvalidationListener.invalidated(null);
        });

    if (alert.showAndWait().get() == ButtonType.OK) return dirNameTextField.getText();
    else return null;
  }
예제 #4
0
 @Override
 public void startEdit() {
   super.startEdit();
   if (textField == null) {
     createTextField();
   }
   setText(null);
   setGraphic(textField);
   textField.selectAll();
   if (getItem() == null) {
     editingPath = null;
   } else {
     editingPath = getItem().getPath();
   }
 }
예제 #5
0
  @Override
  public void startEdit() {
    super.startEdit();

    if (textField == null) {
      createTextField();
    }
    setGraphic(textField);
    setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    textField.selectAll();
    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            textField.requestFocus();
            textField.selectAll();
          }
        });
  }
  public EditSpriteAnimationDialog(File dataDirectory, ResourceLocator loc, SpriteAnimation anim) {
    super();

    // Set up the header and footer
    if (anim == null) {
      this.setTitle("New sprite animation");
    } else {
      this.setTitle("Edit sprite animation");
    }
    this.setHeaderText("Configure the animation");
    this.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

    // The dialog content
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(20, 150, 10, 10));

    TextField id = new TextField();
    if (anim == null) {
      id.setText(UUID.randomUUID().toString());
    } else {
      id.setText(anim.id);
    }
    id.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> id.selectAll());

    TextField spriteFile = new TextField();
    spriteFile.setEditable(false);

    Button browse = new Button("Browse...");
    browse.setOnAction(
        event -> {
          FileChooser fc = new FileChooser();
          fc.setTitle("Browse for sprite image");
          fc.setInitialDirectory(dataDirectory);
          fc.getExtensionFilters()
              .addAll(
                  new ExtensionFilter(
                      "Graphics files",
                      "*.png",
                      "*.PNG",
                      "*.jpg",
                      "*.jpeg",
                      "*.JPG",
                      "*.JPEG",
                      "*.bmp",
                      "*.BMP"));
          File r = fc.showOpenDialog(this.getOwner());
          if (r != null) {
            spriteFile.setText(dataDirectory.toPath().relativize(r.toPath()).toString());
          }
        });

    grid.add(new Label("Animation name"), 0, 0);
    grid.add(id, 1, 0);

    grid.add(new Label("Image file"), 0, 1);
    grid.add(spriteFile, 1, 1);
    grid.add(browse, 2, 1);

    PositiveIntegerField frames = new PositiveIntegerField();
    PositiveIntegerField framerate = new PositiveIntegerField();

    if (anim != null) {
      spriteFile.setText(anim.url);
      frames.setValue(anim.frames);
      framerate.setValue(anim.framerate);
    }

    grid.add(new Label("Frame count"), 0, 2);
    grid.add(frames, 1, 2);

    grid.add(new Label("Frame rate"), 0, 3);
    grid.add(framerate, 1, 3);

    this.getDialogPane().setContent(grid);

    this.setResultConverter(
        clickedButton -> {
          if (clickedButton == ButtonType.OK) {
            int nframes = frames.getValue();
            int rframerate = framerate.getValue();

            if (nframes == 0 || rframerate == 0) return null;

            try {
              return new SpriteAnimation(
                  loc, id.getText(), spriteFile.getText(), nframes, rframerate);
            } catch (CorruptDataException e) {
              Alert err = new Alert(Alert.AlertType.ERROR);
              err.setTitle("Cannot load sprite image");
              err.setContentText(e.getMessage());
              err.showAndWait();
              return null;
            }
          } else {
            return null;
          }
        });
  }