.withCyclic(true);
personPA.bindBidirectional(path, ls.valueProperty(),
(Class<T>) choices[0].getClass());
ctrl = ls;
} else {
final TextField tf = controlType == PasswordField.class ? new PasswordField() {
@Override
public void replaceText(int start, int end, String text) {
if (matchTest(text)) {
super.replaceText(start, end, text);
}
}
@Override
public void replaceSelection(String text) {
if (matchTest(text)) {
super.replaceSelection(text);
}
}
private boolean matchTest(String text) {
return text.isEmpty()
|| (text.matches(restictTo) && (getText() == null || getText()
.length() < maxChars));
}
}
: new TextField() {
@Override
public void replaceText(int start, int end, String text) {
if (matchTest(text)) {
super.replaceText(start, end, text);
}
}
@Override
public void replaceSelection(String text) {
if (matchTest(text)) {
super.replaceSelection(text);
}
}
private boolean matchTest(String text) {
return text.isEmpty()
|| (text.matches(restictTo) && (getText() == null || getText()
.length() < maxChars));
}
};
// POJO binding magic...
personPA.bindBidirectional(path, tf.textProperty());
ctrl = tf;
}
box.getChildren()
.addAll(new Label(
path