Set constraint attribute listener
The constraint attribute listener implements the VETOABLECHANGELISTENER interface that contains the VetoableChange method. Once the source bean sends a constraint attribute change event, the VETOABLECHANGE method is called in each registered listener. The listener receives attribute change events by using this method, and accepts or rejects the proposed changes. If they reject the proposed attribute change, it will throw a propertyvetoException.
Similar to the association, your monitoring bean can implement the VetoableChangeListener interface, and the VETOABLECHANGE method itself, you can also use beanbox to generate an event hookup adapter class to provide this implementation for your bean. If you use beanbox to generate an adapter class, then listen to Beans does not need to implement the VetoableChangeListener interface. You just need to implement the VETOABECHANGE method, just like the VOTER JAVA BEAN is implemented in the following code:
Public Void VetoableChange (propertychangeeevent x)
Hrows propertyvetoException {
IF (vetoall) {
Throw New PropertyvetoException ("NO!", X);
}
}