001package votorola.s.gwt.scene; // Copyright 2011, 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
003import com.google.web.bindery.event.shared.*;
004import votorola.g.web.gwt.*;
005
006
007/** An event that signals a change in the filtering or bounding of the scene and other
008  * scoping-dependent views, such as the feed.
009  */
010public final class ScopeChangeEvent extends com.google.gwt.event.shared.GwtEvent<ScopeChangeHandler>
011{
012
013
014    /** Registers a handler to receive change events fired from any scoping model.  You
015      * must usually register a handler for {@linkplain Scenes#scene scene} changes as well,
016      * because a scene change implies a scope change.  This wrinkle could be smoothed out
017      * if necessary, but it currently poses no difficulty.
018      *
019      *     @see Scoping#addHandler(ScopeChangeHandler)
020      */
021    public static HandlerRegistration addHandler( final ScopeChangeHandler handler )
022    {
023        return GWTX.i().bus().addHandler( TYPE, handler );
024    }
025
026
027
028    /** The common type key for all scope change events.
029      */
030    public static final Type<ScopeChangeHandler> TYPE = new Type<ScopeChangeHandler>();
031
032
033
034   // - G w t - E v e n t ----------------------------------------------------------------
035
036
037    public @Override Type<ScopeChangeHandler> getAssociatedType() { return TYPE; }
038
039
040
041    protected @Override void dispatch( final ScopeChangeHandler handler )
042    {
043        handler.onScopeChange( ScopeChangeEvent.this );
044    }
045
046
047}