Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092713

[Dialogs] TextInput and Choice dialogs should compare result against ButtonData, not ButtonType

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 8u40
    • Component/s: javafx
    • Labels:
      None

      Description

      Rather than have the following result converter:
      dialog.setResultConverter((dialogButton) -> dialogButton == yourOkButton ? dialog.getEditor().getText() : null);

      We should have the following:
      setResultConverter((dialogButton) -> {
          ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
          return data == ButtonBar.ButtonData.OK_DONE ? getSelectedItem() : null;
      });

      This allows for alternative ButtonTypes to be set that are OK_DONE ButtonData instances, rather than forcing the requirement to use the pre-defined ButtonType.OK button.

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            jgiles Jonathan Giles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: