java.lang.Object
com.amalgamasimulation.desktop.ui.editor.dialogs.Dialogues

public final class Dialogues extends Object
Simple dialogs with input fields. You build a dialog with a chain of calls and open it with open.

Kinds of dialog:

  • one field: integer, doubleValue, string, file, folder. open returns the entered value. If the user clicks Cancel, open returns an empty Optional.
  • any number of fields: fields. Each field reads its value from the supplier. After OK, each field passes the new value to its handler.
  • one field for each record component: record. open returns a new record with the entered values.
  • one field for each feature of an EMF object: emf. After OK, the dialog sets all features with one command.
While the value of any field fails validation, the OK button is disabled.

Example with one field:


 Optional<Integer> trucks = Dialogues.integer(shell, "Count")
         .label("Trucks")
         .value(5)
         .open();
 
Example with several fields:

 Dialogues.fields(shell, "Settings")
         .integer("Trucks", () -> trucks, value -> trucks = value)
         .doubleValue("Speed", () -> speed, value -> speed = value)
         .open();
 
Author:
Ionov Ivan