Example usage for com.google.gwt.user.client History newItem

List of usage examples for com.google.gwt.user.client History newItem

Introduction

In this page you can find the example usage for com.google.gwt.user.client History newItem.

Prototype

public static void newItem(String historyToken) 

Source Link

Document

Adds a new browser history entry.

Usage

From source file:asquare.gwt.tests.history.client.TabController.java

License:Apache License

public void onSelection(SelectionEvent<Integer> event) {
    int tabIndex = event.getSelectedItem();
    if (tabIndex != m_selectedTab) {
        History.newItem(m_tabs.getToken(tabIndex));
    }/*w  w w  .j a  v  a2 s  .c  o m*/
}

From source file:asquare.gwt.tk.demo.client.TabController.java

License:Apache License

public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
    if (tabIndex != m_selectedTab) {
        History.newItem(m_tabs.getToken(tabIndex));
    }
}

From source file:asquare.gwt.tkdemo.client.ui.TabBarClickControllerHistory.java

License:Apache License

public void onBrowserEvent(Widget widget, Event event) {
    CellId cellId = ((ListView) widget).getCellId(DOM.eventGetTarget(event));
    if (cellId != null) {
        String newToken = m_panels.getToken(((IndexedCellId) cellId).getIndex());
        History.newItem(newToken);
    }/*  ww  w . j  a v  a  2 s.  co  m*/
}

From source file:au.com.gworks.gwt.petstore.client.AccountController.java

License:Apache License

private void createAccount() {
    GWT.log("[TRACE] AccountController.createAccount", null);
    AccountInfo info = (AccountInfo) view.getInfo();
    ControllerCall cb = new ControllerCall() {
        public void onFailure(Throwable caught) {
            Window.alert("Account exist");
        }/*from   ww  w  . j a v a 2  s  .  co m*/

        public void onSuccess(Object result) {
            AccountInfo infoResult = (AccountInfo) result;
            if (infoResult != null) {
                GWT.log("[DEBUG] Account created and login", null);
                ((StoreCoordinator) coordinator).updateLoginStatus(true, infoResult);
                History.newItem("shopping");
            } else {
                History.newItem("welcome");
            }
        }
    };
    AccountRpcController.Util.getInstance().createAccount(info, cb);
}

From source file:au.com.gworks.gwt.petstore.client.AccountController.java

License:Apache License

private void updateAccount() {
    GWT.log("[TRACE] AccountController.updateAccount", null);
    AccountInfo info = (AccountInfo) view.getInfo();
    ControllerCall cb = new ControllerCall() {
        public void onFailure(Throwable caught) {
            Window.alert("Update failed.");
        }/*from ww  w.  j a  va2s .  c  o  m*/

        public void onSuccess(Object result) {
            AccountInfo infoResult = (AccountInfo) result;
            if (infoResult != null) {
                GWT.log("[DEBUG] Account updated and login.", null);
                ((StoreCoordinator) coordinator).updateLoginStatus(true, infoResult);
                History.newItem("shopping");
            } else {
                History.newItem("welcome");
            }
        }
    };
    AccountRpcController.Util.getInstance().updateAccount(info, cb);
}

From source file:au.com.gworks.gwt.petstore.client.AccountSignInController.java

License:Apache License

private void signIn() {
    GWT.log("[TRACE] AccountSignInController.signIn", null);
    AccountInfo info = (AccountInfo) view.getInfo();
    view.hide();// ww  w .ja  v a  2s . co  m
    ControllerCall cb = new ControllerCall() {
        public void onSuccess(Object result) {
            AccountInfo infoResult = (AccountInfo) result;
            if (infoResult != null) {
                GWT.log("[DEBUG] Login success.", null);
                ((StoreCoordinator) coordinator).updateLoginStatus(true, infoResult);
                History.newItem("shopping");
            } else {
                GWT.log("[DEBUG] Login failed.", null);
                Window.alert("Wrong username and password");
                History.newItem("welcome");
            }
        }
    };
    AccountRpcController.Util.getInstance().signIn(info, cb);
}

From source file:au.com.gworks.gwt.petstore.client.AccountSignInController.java

License:Apache License

private void registerAccount() {
    view.hide();
    ((StoreCoordinator) coordinator).getAccountController().setNewAccount(true);
    History.newItem("account");
}

From source file:au.com.gworks.gwt.petstore.client.AccountSignInController.java

License:Apache License

private void signOut() {
    GWT.log("[TRACE] AccountSignInController.signOut", null);
    ControllerCall cb = new ControllerCall() {
        public void onSuccess(Object result) {
            GWT.log("[DEBUG] Logout success.", null);
            History.newItem("welcome");
        }//from   w  w  w  .j a v a2  s  .co  m
    };
    AccountRpcController.Util.getInstance().signOut(cb);
    ((StoreCoordinator) coordinator).updateLoginStatus(false, null);
}

From source file:au.com.gworks.gwt.petstore.client.StoreSearchController.java

License:Apache License

public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
    if (row > -1) {
        String id = model[row].id;
        History.newItem("shopping" + HistoryUtils.QUERY_TOK + ShoppingController.PROD_ID + "=" + id);
    }/* w w  w .j a v  a  2 s  . c om*/
}

From source file:br.org.olimpiabarbacena.client.Menu.java

License:Apache License

public Menu(Principal principal) {
    this.principal = principal;
    initWidget(uiBinder.createAndBindUi(this));

    // If the application starts with no history token, redirect to a new
    // 'acervo' state.
    String initToken = History.getToken();
    if ((initToken.length() == 0) || (initToken.equals("acervo"))) {
        History.newItem("acervo");
        onLinkAcervoClick(null);//w  w w  .j a  v a  2s.c  o  m
    } else if (initToken.equals("membro")) {
        onLinkMembroClick(null);
    }

    // Now that we've setup our listener, fire the initial history state.
    History.fireCurrentHistoryState();
}