001package votorola.g.web.gwt.event; // Copyright 2012, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003
004/** An event source that may be suppressed during dispatch.  The meaning may vary, but it
005  * is intended to support a method of cancelling events.  This method requires two event
006  * sources: a suppressable source and an ordinary source.  Each event is pre-dispatched
007  * from the suppressable source.  The event is cancelled if it gets suppressed, otherwise
008  * it is re-dispatched from the ordinary source.  This method is reliable only if the
009  * source is guaranteed to fire events one at a time, without overlap.
010  */
011public final class SuppressableSource
012{
013
014    // Cf. GWTEvent.isLive().  It has protected access so we cannot use it for this
015    // purpose.  It also serves a slightly different purpose internally, which might not
016    // be safe to overload.  And it wouldn't cover all cases, because GWTEvent is not the
017    // most basic event type.
018
019
020    /** Answers whether this event source is suppressed.
021      */
022    public boolean isSuppressed() { return isSuppressed; }
023
024
025        private boolean isSuppressed;
026
027
028
029    /** Sets whether this event source is suppressed.
030      */
031    public void setSuppressed( final boolean is ) { isSuppressed = is; }
032
033
034}