![JAR search and dependency download from the Maven repository](/logo.png)
com.sencha.gxt.data.shared.loader.LoadExceptionEvent Maven / Gradle / Ivy
/**
* Sencha GXT 3.1.0-beta - Sencha for GWT
* Copyright(c) 2007-2014, Sencha, Inc.
* [email protected]
*
* http://www.sencha.com/products/gxt/license/
*/
package com.sencha.gxt.data.shared.loader;
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.data.shared.loader.LoadExceptionEvent.LoadExceptionHandler;
/**
* Event type for loader events.
*/
public class LoadExceptionEvent extends GwtEvent> {
/**
* A loader that implements this interface is a public source of
* {@link LoadExceptionEvent} events.
*/
public interface HasLoadExceptionHandlers {
/**
* Adds a {@link LoadExceptionEvent} handler.
*
* @param handler the handler
* @return the registration for the event
*/
public HandlerRegistration addLoadExceptionHandler(LoadExceptionHandler handler);
}
/**
* Handler class for {@link LoadExceptionEvent} events.
*/
public interface LoadExceptionHandler extends EventHandler {
/**
* Called when an exception occurs during a load operation.
*/
void onLoadException(LoadExceptionEvent 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 C loadConfig;
private Throwable exception;
/**
* Creates a load exception event for the given load config and exception.
*
* @param loadConfig the load config for this load exception event
* @param exception the exception for this load exception event
*/
public LoadExceptionEvent(C loadConfig, Throwable exception) {
this.loadConfig = loadConfig;
this.exception = exception;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Type> getAssociatedType() {
return (Type) TYPE;
}
/**
* Returns the load exception.
*
* @return the load exception
*/
public Throwable getException() {
return exception;
}
/**
* Returns the load config.
*
* @return the load config
*/
public C getLoadConfig() {
return loadConfig;
}
@SuppressWarnings("unchecked")
@Override
public Loader, C> getSource() {
return (Loader, C>) super.getSource();
}
@Override
protected void dispatch(LoadExceptionHandler handler) {
handler.onLoadException(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy