I'm working with jdesktop's beansbinding library in Netbeans 7.3. I have a really specific question. I'd like to have a JButton enabled if any property of another bean is not null and disabled if it's null.
So I tried to create an ELBinding (which has conditional support like ${myProperty > 50} returning a boolean holding whether this expression is true or not.
But in my occasion I cannot figure out (nor find on the internet) how to write down this condition. If I had an event listener for property changes, I'd write something like this (in some PropertyChangeListener instance's abstract method):
if (propertyChangeEvent.getNewValue() == null) {
button.setEnabled(false);
} else {
button.setEnabled(true);
}
Thanks a lot for any hints as I find ELProperties poorly documentated.
worksforme, see the example below.
But: usually enablement management shoud be handled by the bean itself (vs. doing so on the fly) - in a well-designed separated world, only the bean itself should have all the knowledge that's necessary.
Some code: