Robert Vojta wrote:

> Hallo,
> 
> is there a way how to consume event receieved from document's XEventListenrr?
> 
> I can listen for events, but I have no idea how to consume them. The
> goal is simple  - when I have non-modal JFrame opened, I would like to
> remove possibility to close document until my JFrame disappears.

Andreas already showed you the right way. Let me add a more general
comment on that.

If we allowed to consume a particular document event through our
document event API we would allow to consume *all* possible events as
the API is generic. From a design point of view it is impossible to
allow for "consuming" all document events. It would be disastrous to
leave it up to single listeners what other listeners might get notified
or if the event is allowed to happen at all.

Consider that you are the third listener in a list - if you consumed the
event the listeners before that already had been notified now would be
fooled. And even more disastrous: if events are considered to happen in
a syncronized manner (e.g. activate/deactivate) you could completely
screw up the whole application with one single "bad" listener.

If an application knows that some of its events can be "consumed" it
will provide a special API for this that allows to do that in a
controlled manor - and it will do it *before* any listener gets notified
about the occuring event. This is what e.g. the XCloseable API is about.

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to