« first day  last day (15 days later) » 

11:31
7
Q: Populating JavaFX ComboBox or ChoiceBox from enum

JérômeIs there a way to populate a JavaFX ComboBox or ChoiceBox with all enumerations of a enum ? Here is what I tried : public class Test { public enum Status { ENABLED("enabled"), DISABLED("disabled"), UNDEFINED("undefined"); private String label; Stat...

Looks fairly easy there, but the grass is always greener on the other side :P
 
1 hour later…
12:59
@Hosch250 I mostly implemented the enum backing the combo box now, how would you go on about the conditional visibility? Does that really belong in XAML, or more in the code-behind or perhaps even in the VM?
13:33
I now ended up with having a ShowFuelCost/ShowShippingCost/ShowShippingIncluded property that has a get that checks if the ExtraCostType enum matches the respective value
And I render the items with a BooleanToVisibilityConverter on those bindings
Pushed everything as well: github.com/skiwi2/ArbitrageClient
13:56
@skiwi XAML. Did you get it?
@Hosch250 I did it somewhat different just now
14:38
@Hosch250 Should the property binding that calculates TotalPrice not be in the model instead of the viewmodel in my case?
@skiwi Could be.
Since it only concerns the model and not other related parts of the viewmodel it might be better off there?
You can bind to items in the VM, you know.
Sure.
As I'd also need it when calculating the total price in the model
The view model just provides data for the display. Theoretically, you shouldn't be doing much work there, other than calling the code for the UI actions.
14:41
Okay

« first day  last day (15 days later) »