We have a complex web form (we use GWT/GXT stack) with lots of input elements of different types (text fields, selects, checkboxes, buttons), and behavior of these elements depends on each other.
Now it means, to set form element state correctly, it's necessary to know what happened to it (user input occurred or an event came from server) and state of other elements of that form.
So, the question is what best practices to maintain code for such a complex web form in clean and comprehensible state? Now it seems that ideal solution would employ some form of declarative DSL to describe said behavior.
Initial brain storming produced following kind of Java DSL (this is just to give an idea what I mean, no any real DSL exists right now):
private Event whenStopOrderChanged;
private Predicate parentPriceValid;
private Command calculateStopPrice;
public void initRules() {
whenStopOrderChanged.and(parentPriceValid).then(calculateStopPrice);
}
So, could you please share your ideas/experience solving such kind of task?