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

com.jpattern.gwt.client.navigationevent.ANavigationEventWrapper Maven / Gradle / Ivy

package com.jpattern.gwt.client.navigationevent;

import java.util.Map;

import com.jpattern.gwt.client.ApplicationProxy;
import com.jpattern.gwt.client.IApplicationProvider;
import com.jpattern.gwt.client.presenter.IPresenter;

/**
 * 
 * @author Francesco Cina'
 *
 * 12/ago/2011
 */
public abstract class ANavigationEventWrapper extends ABaseNavigationEvent implements INavigationEventWrapper {

	/**
	 * 
	 * @param eventName the unique event name
	 */
	public ANavigationEventWrapper(String eventName) {
		this(eventName, false, new String[0]);
	}
	
	/**
	 * 
	 * @param eventName
	 * @param requireAuthentication whether the user have to be logged-in to access the presenter
	 * @param allowedRoles = The list of roles allowed to access this presenter.
	 * If a user doesn't belong to the roles list, the presenter will not be executed
	 * An empty array means no restriction to the access (default behaviour).
	 */
	public ANavigationEventWrapper(String eventName, boolean requireAuthentication, String[] allowedRoles) {
		this(eventName, requireAuthentication, allowedRoles, ApplicationProxy.getInstance().getApplicationProvider());
	}
	
	/**
	 * 
	 * @param eventName
	 * @param provider
	 */
	public ANavigationEventWrapper(String eventName, IApplicationProvider provider) {
		this(eventName , false, new String[0], provider);
	}
	
	/**
	 * 
	 * @param eventName
	 * @param requireAuthentication whether the user have to be logged-in to access the presenter
	 * @param allowedRoles = The list of roles allowed to access this presenter.
	 * If a user doesn't belong to the roles list, the presenter will not be executed
	 * An empty array means no restriction to the access (default behaviour).
	 * @param provider
	 */
	public ANavigationEventWrapper(String eventName, boolean requireAuthentication, String[] allowedRoles, IApplicationProvider provider) {
		super(eventName, requireAuthentication, allowedRoles, provider);
	}
	
	
	@Override
	public final void notifyNavigationEvent(final IPresenter parentPresenter, final Map queryStringValues, final String[] childrenEvent, final boolean registerEvent) {
		INavigationEventWrapperCallback callback = new INavigationEventWrapperCallback() {
			@Override
			public void exec(INavigationEvent navigationEvent) {
				navigationEvent.notifyNavigationEvent(parentPresenter, queryStringValues, childrenEvent, registerEvent);
			}
		};
		executeCallback(callback);
	}

	protected abstract void executeCallback(INavigationEventWrapperCallback callback);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy