I defined a bean property as a constrained and bound property. In design time while changing the property in default property editor I am throwing a PropertyVetoException and catching it (In run time I will throw another exception). In design time, when I catch the PropertyVetoException I am again calling setX method for setting the property value to the previous value and rejecting the new value. But the code is generated with the new value by the designer instead of the old value. I also tried making a new call to firePropertyChange with the old value in it, but it didn't work.
Is this a normal result ?
Another question is that; if I don't catch the exception, who catchs it at design time or what happens to the exception? Does designer catch an exception such as PropertyVetoException at design time?
pseudo code;
- Code: Select all
public void setX ( value b )
{
if bean.isDesignTime()
try {
fireVetoableChange ( "X", oldvalue, newValue ) ;
} catch ( PropertyVetoException e ) {
//firePropertyChange ( "X", oldvalue, oldValue ) ;
//firePropertyChange ( "X", " ", oldValue ) ;
setX(oldValue);
}
}