
com.jpattern.gwt.client.history.GWTHistoryEngine Maven / Gradle / Ivy
package com.jpattern.gwt.client.history;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
/**
*
* @author Francesco Cina
*
* 02/ago/2011
*/
public class GWTHistoryEngine implements IHistoryEngine, ValueChangeHandler {
private IHistoryManager historyManager;
@Override
public void init(IHistoryManager historyManager) {
this.historyManager = historyManager;
History.fireCurrentHistoryState();
History.addValueChangeHandler(this);
}
@Override
public void registerEvent(String token) {
History.newItem(token);
}
@Override
public void onValueChange(ValueChangeEvent event) {
historyManager.onEvent(event.getValue());
}
@Override
public void updateState() {
String initToken = History.getToken();
historyManager.onEvent(initToken);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy