Article View: borland.public.jbuilder.java.language
Article #7289Re: firing a property veto exception
From: CLG
Date: Sat, 30 Jun 2001 17:08
Date: Sat, 30 Jun 2001 17:08
60 lines
2765 bytes
2765 bytes
I disagree. I am writing a bean, and I am the one responsible for creating
the methods. So i dont have any such objects premade and handed to me. I
am the maker in this event. So my question is what should the maker of this
object do. Or maybe Ill ask, what should I expect to get in a property
veto exception? the event will contain difrerent objects for old and even
though the change was vetoed??
--
Peace,
Carl L. Gilbert
http://www.rigidsoftware.com
ICQ 614395-currently stolen working to retrieve.
"Then said I, Wisdom [is] better than strength: nevertheless the poor man's
wisdom [is] despised, and his words are not heard." Ecclesiastes 9:16
"Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in message
news:3b3da103_1@dnews...
> dnoyeB > schrieb in Nachricht <3b3cee8f$1_2@dnews>...
> >When I fire a property veto exception it requires a property change
object
> >within it.
> >
> >Now since this change is vetoed, should oldvalue and newvalue both be
> >oldvalue?? since I really am not setting the newvalue?
>
> you don't create a new PropertyChangeEvent, rather you throw a
> PropertyVetoException inside a vetoableChange method of a
> VetoableChangeListener implementation. You get the PropertyChangeEvent as
a
> parameter, inspect the property change and fire a PropertyVetoException if
> you are not happy with the change. You send the original
PropertyChangeEvent
> with your exception.
>
> Here's some pseudo code (I have no JDK available at the moment, so don't
> mind any syntax errors):
>
> class SomeClass implements VetoableChangeListener {
> ...
> public void vetoableChange(PropertyChangeEvent pce) {
> if (!pce.getNewValue().isWhatYouHadExpected()) {
> throw new PropertyVetoException("I don't like this new
value",
> pce);
> }
> }
> ...
> }
>
> Torsten
>
>
>
>
Technical Details
Message-ID:
<3b3e0880$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3b3cee8f$1_2@dnews> <3b3da103_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,e79ac2a4b52682c7 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-30 10:25:07 PST From: "CLG" <lamont_gilbert @ rigidsoftware.com> Newsgroups: borland.public.jbuilder.java.language References: <3b3cee8f$1_2@dnews> <3b3da103_1@dnews> Subject: Re: firing a property veto exception Date: Sat, 30 Jun 2001 13:08:04 -0400 Lines: 62 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 24.181.226.14 Message-ID: <3b3e0880$1_2@dnews> X-Trace: dnews 993921152 24.181.226.14 (30 Jun 2001 10:12:32 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews