Class ValueDialogBuilder<V>

java.lang.Object
com.amalgamasimulation.desktop.ui.editor.dialogs.ValueDialogBuilder<V>
Type Parameters:
V - type of the value

public class ValueDialogBuilder<V> extends Object
Builder of a dialog with one field, created by the one-field methods of Dialogues.
Author:
Ionov Ivan
  • Method Details

    • label

      public ValueDialogBuilder<V> label(String label)
      Sets the label of the field. By default there is no label.
      Parameters:
      label - label of the field
      Returns:
      this builder
    • message

      public ValueDialogBuilder<V> message(String message)
      Sets the message under the title.
      Parameters:
      message - the message; null shows no message
      Returns:
      this builder
    • value

      public ValueDialogBuilder<V> value(V value)
      Sets the initial value. By default the field is empty.
      Parameters:
      value - the initial value; null leaves the field empty
      Returns:
      this builder
    • strategy

      public ValueDialogBuilder<V> strategy(ValidationStrategy<V,String> strategy)
      Replaces the validation strategy of the field.
      Parameters:
      strategy - checks and converts the text of the field
      Returns:
      this builder
    • button

      public ValueDialogBuilder<V> button(ISimpleButtonProperties button)
      Sets the button of the field. For a file or folder field it replaces the default button, for example with Buttons.openFile().extensions(...).
      Parameters:
      button - the button
      Returns:
      this builder
    • open

      public Optional<V> open()
      Opens the dialog and waits until it is closed.
      Returns:
      the entered value after OK; an empty Optional after Cancel or when the strategy converts the text to null