
Untitled
By: a guest on
Aug 11th, 2012 | syntax:
None | size: 1.01 KB | hits: 9 | expires: Never
Java, FX data validation with complex interdependency
class Product{
StringProperty prop1;
StringProperty prop2;
.........
}
class Controller{
GridPane pane;
Product _product;
init(){};
ObservableList readXMLBuildOptionsList(){
//build options from xml
return optionlist;
}
buildGui(){
pane = new GridPane();
Rules rule = new Rules();
//For each optionList in master list
//Create combo that matches up to properties of object
ComboBox box = new ComboBox(observableList);
box.addChangeListener(new ChangeListener(){
@Override
public void changed(ObservableValue arg0, Object arg1, Object arg2) {
if (arg1 != arg2) {
rule.validate(arg0, arg1, arg2);
}
}
});
}
}
class Rules{
void validate(ObservableValue arg0, Object arg1, Object arg2){
//some validation across all fields?
//Change invalid options in other fields to red colored text
}
}