I am creating a list from which the user can select from using Vaadin8. I want to get the values from the Enum but the string values with spaces not the Element Names.
public enum CustomerStatus {
ImportedLead {
public String toString() {
return "Imported Lead";
}
},
NotContacted{
public String toString() {
return "Not Contacted";
}
},
Contacted{
public String toString() {
return "Contacted";
}
},
Customer{
public String toString() {
return "Customer";
}
},
ClosedLost{
public String toString() {
return "Closed Lost";
}
}
}
Here is the list created to select from the Enum elements:
private NativeSelect <CustomerStatus> status = new NativeSelect<>("Status");
And here are 3 lines I tried that did not work:
status.setItems(CustomerStatus.values().toString());
//
status.setItems(CustomerStatus.valueOf(CustomerStatus.values()));
//
status.setItems(CustomerStatus.ClosedLost.toString(), CustomerStatus.Contacted.toString() , CustomerStatus.Customer, CustomerStatus.NotContacted, CustomerStatus.ImportedLead);
//