Java Code Examples for com.google.gwt.user.client.History#fireCurrentHistoryState()

The following examples show how to use com.google.gwt.user.client.History#fireCurrentHistoryState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Playground.java    From caja with Apache License 2.0 6 votes vote down vote up
public void onModuleLoad() {
  gui = new PlaygroundView(this);
  gui.setLoading(true);
  cajolingService.getBuildInfo(new AsyncCallback<String>() {
    public void onFailure(Throwable caught) {
      gui.setLoading(false);
      gui.addRuntimeMessage(caught.getMessage());
      gui.setVersion("Unknown");
    }

    public void onSuccess(String result) {
      gui.setLoading(false);
      gui.setVersion(result);
    }
  });
  History.addValueChangeHandler(this);
  History.fireCurrentHistoryState();
}
 
Example 2
Source File: AppController.java    From EasyML with Apache License 2.0 5 votes vote down vote up
public void go(final HasWidgets container) {
	logger.info("app view going...");
	this.container = container;

	if ("".equals(History.getToken())) {
		History.newItem("monitor");
	} else {
		History.fireCurrentHistoryState();
	}
}
 
Example 3
Source File: HistoryGwtApi.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void initHandler() {
    handlerRegistration = History.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            String historyToken = event.getValue();
            if (isForward) {
                isForward = false;
                // here we assume that "forward" action was performed
                // and if current history token equals to TOP_HISTORY_TOKEN
                // then this is true, otherwise we ignore
                if (TOP_HISTORY_TOKEN.equals(historyToken)) {
                    handleHistoryStep();
                }
            } else {
                if (!TOP_HISTORY_TOKEN.equals(historyToken)) {
                    // if current history token equals to previous history token
                    // then we assume that "back" action was performed
                    if (previousHistoryToken.equals(historyToken)) {
                        isForward = true;
                    } else {
                        // otherwise we assume that some handmade token was processed
                        // and replace it with PREVIOUS_HISTORY_TOKEN
                        previousHistoryToken = historyToken;
                        History.newItem(PREVIOUS_HISTORY_TOKEN);
                    }
                }
                // we always must have TOP_HISTORY_TOKEN on top of history stack
                // if it is, then History will ignore the call of newItem method.
                History.newItem(TOP_HISTORY_TOKEN);
            }
        }
    });
    if (isFireHistoryState)
        History.fireCurrentHistoryState();
}
 
Example 4
Source File: WebClient.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * This is the entry point method.
 */
@Override
public void onModuleLoad() {

  ErrorHandler.install();

  ClientEvents.get().addWaveCreationEventHandler(
      new WaveCreationEventHandler() {

        @Override
        public void onCreateRequest(WaveCreationEvent event, Set<ParticipantId> participantSet) {
          LOG.info("WaveCreationEvent received");
          if (channel == null) {
            throw new RuntimeException("Spaghetti attack.  Create occured before login");
          }
          openWave(WaveRef.of(idGenerator.newWaveId()), true, participantSet);
        }
      });

  setupLocaleSelect();
  setupConnectionIndicator();

  HistorySupport.init(new HistoryProviderDefault());
  HistoryChangeListener.init();

  websocket = new WaveWebSocketClient(websocketNotAvailable(), getWebSocketBaseUrl());
  websocket.connect();

  if (Session.get().isLoggedIn()) {
    loggedInUser = new ParticipantId(Session.get().getAddress());
    idGenerator = ClientIdGenerator.create();
    loginToServer();
  }

  setupUi();
  setupStatistics();

  History.fireCurrentHistoryState();
  LOG.info("SimpleWebClient.onModuleLoad() done");
}
 
Example 5
Source File: WebClient.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * This is the entry point method.
 */
@Override
public void onModuleLoad() {

  ErrorHandler.install();

  ClientEvents.get().addWaveCreationEventHandler(
      new WaveCreationEventHandler() {

        @Override
        public void onCreateRequest(WaveCreationEvent event, Set<ParticipantId> participantSet) {
          LOG.info("WaveCreationEvent received");
          if (channel == null) {
            throw new RuntimeException("Spaghetti attack.  Create occured before login");
          }
          openWave(WaveRef.of(idGenerator.newWaveId()), true, participantSet);
        }
      });

  setupLocaleSelect();
  setupConnectionIndicator();

  HistorySupport.init(new HistoryProviderDefault());
  HistoryChangeListener.init();

  websocket = new WaveWebSocketClient(websocketNotAvailable(), getWebSocketBaseUrl());
  websocket.connect();

  if (Session.get().isLoggedIn()) {
    loggedInUser = new ParticipantId(Session.get().getAddress());
    idGenerator = ClientIdGenerator.create();
    loginToServer();
  }

  setupUi();
  setupStatistics();

  History.fireCurrentHistoryState();
  LOG.info("SimpleWebClient.onModuleLoad() done");
}
 
Example 6
Source File: DefaultHistoryProxy.java    From mvp4g with Apache License 2.0 4 votes vote down vote up
public void fireCurrentHistoryState() {
  History.fireCurrentHistoryState();
}