All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sencha.gxt.state.client.RestoreStateEvent Maven / Gradle / Ivy

There is a newer version: 3.1.1
Show newest version
/**
 * Sencha GXT 3.1.0 - Sencha for GWT
 * Copyright(c) 2007-2014, Sencha, Inc.
 * [email protected]
 *
 * http://www.sencha.com/products/gxt/license/
 */
package com.sencha.gxt.state.client;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.sencha.gxt.state.client.RestoreStateEvent.RestoreStateHandler;

/**
 * Fires after state has been restored.
 */
public class RestoreStateEvent extends GwtEvent> {

  public interface HasRestoreStateHandlers {

    /**
     * Adds a {@link RestoreStateHandler} handler for {@link RestoreStateEvent}
     * events.
     * 
     * @param handler the handler
     * @return the registration for the event
     */
    HandlerRegistration addRestoreStateHandler(RestoreStateHandler handler);
  }

  /**
   * Handler class for {@link RestoreStateEvent} events.
   */
  public interface RestoreStateHandler extends EventHandler {

    /**
     * Called after state has been restored.
     */
    void onRestoreState(RestoreStateEvent event);
  }

  /**
   * Handler type.
   */
  private static Type> TYPE;

  /**
   * Gets the type associated with this event.
   * 
   * @return returns the handler type
   */
  public static Type> getType() {
    return TYPE != null ? TYPE : (TYPE = new Type>());
  }
  
  private S state;
  private O target;
  
  public RestoreStateEvent(S state, O target) {
    this.state = state;
    this.target = target;
  }
  
  @SuppressWarnings({"unchecked", "rawtypes"})
  @Override
  public Type> getAssociatedType() {
    return (Type) TYPE;
  }

  /**
   * Returns the state.
   * 
   * @return the state
   */
  public S getState() {
    return state;
  }

  /**
   * Returns the target object.
   * 
   * @return the target
   */
  public O getTarget() {
    return target;
  }

  @Override
  protected void dispatch(RestoreStateHandler handler) {
    handler.onRestoreState(this);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy