Search enabled by default

This commit is contained in:
Oleg Agafonov 2017-12-27 06:42:27 +04:00
parent 534e00e41f
commit 80b5026ec7

View file

@ -40,8 +40,7 @@ import java.util.Set;
*/
public class ChoiceImpl implements Choice, Serializable {
private int ENABLE_SEARCH_FOR_ITEMS_COUNT = 5; // enable search for choices more then X items (for non standard choices)
// TODO: add sorting to items
protected boolean chosen;
protected final boolean required;
protected String choice;
@ -50,7 +49,7 @@ public class ChoiceImpl implements Choice, Serializable {
protected Map<String, String> keyChoices = new LinkedHashMap<>();
protected String message;
protected String subMessage;
protected boolean searchEnabled = true;
protected boolean searchEnabled = true; // enable for all windows by default
protected String searchText;
public ChoiceImpl() {
@ -72,12 +71,6 @@ public class ChoiceImpl implements Choice, Serializable {
this.keyChoices = choice.keyChoices; // list should never change for the same object so copy by reference
}
private void autoSearchEnable(){
if((this.choices != null) && (this.choices.size() >= ENABLE_SEARCH_FOR_ITEMS_COUNT)){
this.setSearchEnabled(true);
}
}
@Override
public boolean isChosen() {
return chosen;
@ -114,7 +107,6 @@ public class ChoiceImpl implements Choice, Serializable {
@Override
public void setChoices(Set<String> choices) {
this.choices = choices;
autoSearchEnable();
}
@Override
@ -148,7 +140,6 @@ public class ChoiceImpl implements Choice, Serializable {
@Override
public void setKeyChoices(Map<String, String> choices) {
keyChoices = choices;
autoSearchEnable();
}
@Override