de.swm.gwt.client.history.HistorySupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swm-gwt-client Show documentation
Show all versions of swm-gwt-client Show documentation
Plain GWT Swm erweiterungen, auch zur benutzung in mobilen Geraeten
package de.swm.gwt.client.history;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import de.swm.gwt.client.eventbus.IDispatcher;
import de.swm.gwt.client.eventbus.IEvent;
/**
* Support fuer event-Forwarding ueber History-Tokens.
*
* @author wiese.daniel
* copyright (C) 2011, SWM Services GmbH
*
* @param
* Haupt-Event Klasse
* @param
* eine optionale Sub-Event Klasse
*
*/
public class HistorySupport & IEvent, Z extends Enum & IEvent> implements
ValueChangeHandler {
private final HistoryTokenParser parser;
/**
* Default constructor.
*
* @param dispacher
* der anwendungsweite dispatcher
* @param plattformEventClass
* der Haupt-Event Klasse
* @param optionalSubEventClass
* eine optionale Sub-Event Klasse.
*/
public HistorySupport(IDispatcher dispacher, Class plattformEventClass, Class optionalSubEventClass) {
this.parser = new HistoryTokenParser(dispacher, plattformEventClass, optionalSubEventClass);
}
@Override
public void onValueChange(ValueChangeEvent event) {
final String historyValue = event.getValue();
handleHistoryEvent(historyValue);
}
/**
* History event mit dem Toen als String.
*
* @param historyValue
* der history token
*/
public void handleHistoryEvent(final String historyValue) {
if (historyValue != null) {
GWT.log("History-Change-Event: " + historyValue);
this.parser.parseTokenAndFireEvents(historyValue);
}
}
}