package 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. /** An event source that may be suppressed during dispatch. The meaning may vary, but it * is intended to support a method of cancelling events. This method requires two event * sources: a suppressable source and an ordinary source. Each event is pre-dispatched * from the suppressable source. The event is cancelled if it gets suppressed, otherwise * it is re-dispatched from the ordinary source. This method is reliable only if the * source is guaranteed to fire events one at a time, without overlap. */ public final class SuppressableSource { // Cf. GWTEvent.isLive(). It has protected access so we cannot use it for this // purpose. It also serves a slightly different purpose internally, which might not // be safe to overload. And it wouldn't cover all cases, because GWTEvent is not the // most basic event type. /** Answers whether this event source is suppressed. */ public boolean isSuppressed() { return isSuppressed; } private boolean isSuppressed; /** Sets whether this event source is suppressed. */ public void setSuppressed( final boolean is ) { isSuppressed = is; } }