Javabean 101 18

zhaozj2021-02-11  231

Constraint attributes in BeanBox

Similar to the association property, the steps of the Beanbox handling constraint attribute are as follows:

Put the Bean defined to the constraint attribute in Beanbox. Our example uses JellyBean. Put the SOGE in Bean BEANBOX, which can reject the proposed changes. In our example, we used Voter Beans that vetoed changes to attributes. Select the VetoableChange event for JellyBeans, select JellyBean from the Edit menu, select the Events> VetoableChange> VETOABLECHANGE menu item.

Connect the event by listening to Beans, and select the VetoableChange method. Connect Rubber Band with the Voter Bean instance. When the EventTargetDialog panel appears, select the VETOABLECHANGE method. Beanbox Generates an Event Hookup Adapter class. Test Constraint Properties, select JellyBean, and try to change its PriceNCents property in the property table. In the terminal window after Beanbox startup, you will see an information displayed, which indicates that an exception is thrown, this time the change in the proposed attribute is not allowed.

If you want to make more settings for properties, please see the next lesson: manipulating the attribute.

转载请注明原文地址:https://www.9cbs.com/read-4743.html

New Post(0)