Commit 36ea57e6 authored by Axel Howind's avatar Axel Howind

rename text() to string()

to differentiate between setting content text and a text input
parent d25757ee
......@@ -62,7 +62,7 @@ public class DialogSample extends Application {
.title("Input")
.header("This is an input dialog.")
.text("Enter data here: ")
.text("txt", "enter text", "dflt")
.string("txt", "enter text", "dflt")
.integer("integer", "enter number", 0)
.integer("integer from 4 to 7", "enter number", 0,
i -> i >= 4 && i <= 7 ? Optional.empty() : Optional.of(i + " is not between 4 and 7"))
......
......@@ -17,11 +17,11 @@ public interface InputBuilder<B extends InputBuilder<B>> {
B columns(int columns);
default B text(String id, String label, String dflt) {
return text(id, label, dflt, s -> Optional.empty());
default B string(String id, String label, String dflt) {
return string(id, label, dflt, s -> Optional.empty());
}
B text(String id, String label, String dflt, Function<String, Optional<String>> validate);
B string(String id, String label, String dflt, Function<String, Optional<String>> validate);
default B integer(String id, String label, Integer dflt) {
return integer(id, label, dflt, i -> Optional.empty());
......
......@@ -53,8 +53,8 @@ implements InputBuilder<InputDialogBuilder> {
}
@Override
public InputDialogBuilder text(String id, String label, String dflt, Function<String,Optional<String>> validate) {
pb.text(id, label, dflt, validate);
public InputDialogBuilder string(String id, String label, String dflt, Function<String,Optional<String>> validate) {
pb.string(id, label, dflt, validate);
return this;
}
......
......@@ -78,7 +78,7 @@ implements InputBuilder<InputDialogPaneBuilder> {
* @see com.dua3.fx.util.controls.InputBuilder#text(java.lang.String, java.lang.String, java.lang.String, java.util.function.Function)
*/
@Override
public InputDialogPaneBuilder text(String id, String label, String dflt, Function<String,Optional<String>> validate) {
public InputDialogPaneBuilder string(String id, String label, String dflt, Function<String,Optional<String>> validate) {
return add(id, label, String.class, dflt,
new InputControl<String>() {
final TextField control = new TextField();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment