Example usage for com.google.gwt.user.client Cookies setCookie

List of usage examples for com.google.gwt.user.client Cookies setCookie

Introduction

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

Prototype

public static void setCookie(String name, String value) 

Source Link

Document

Sets a cookie.

Usage

From source file:cc.alcina.framework.gwt.persistence.client.ClientSession.java

License:Apache License

public void setInitialObjectsPersisted(boolean initialObjectsPersisted) {
    Cookies.setCookie(hasPersistedInitialObjectsCookieName, String.valueOf(initialObjectsPersisted));
}

From source file:cc.kune.gadget.client.statecookie.CookieStateStore.java

License:GNU Affero Public License

@Inject
public CookieStateStore(final Wave wave, final EventBus eventBus, @Named(COOKIE_NAME) final String cookieName) {
    this.wave = wave;
    this.cookieName = cookieName;
    factory = GWT.create(StateLocalFactory.class);
    restoreStateFromCookie();/*from w  ww  .j  av  a 2s. co  m*/
    eventBus.addHandler(StateUpdateEvent.TYPE, new StateUpdateEventHandler() {
        @Override
        public void onUpdate(final StateUpdateEvent event) {
            // Storing state in a cookie
            final AutoBean<StateLocal> stateLocal = factory.getStateLocal();
            final Map<String, String> map = new HashMap<String, String>();
            final State state = wave.getState();
            final JsArrayString keys = state.getKeys();
            for (int i = 0; i < keys.length(); i++) {
                final String key = keys.get(i);
                final String value = state.get(key);
                map.put(key, value);
            }
            stateLocal.as().setMap(map);
            // Saving the cookie
            Cookies.setCookie(cookieName, AutoBeanCodex.encode(stateLocal).getPayload());
        }
    });
}

From source file:client.tools.page.ConsoleSettingsPage.java

License:Open Source License

/**
 * @param level/*from w w  w .  j  a  v  a 2  s.  c o  m*/
 */
private final void setValue(final int level) {
    Cookies.setCookie("LogLevel", level + "");

    GuiLogger.setLogLevel(level);

    final HTML text = new HTML("LogLevel successfully changed!");

    final InfoDialog dialog = new InfoDialog("Console Settings", text);

    dialog.show();
    dialog.center();
}

From source file:co.edu.udea.iw.rtf.client.activity.LoginActivity.java

License:Open Source License

/**
 * Mtodo usado para validar un usuario que desea loguearse en el sistema.
 * /*from  w  w  w .  ja  v a 2 s  . c o  m*/
 * @return true si el usuario tiene permisos de acceso, false en caso
 *         contrario.
 * */
@Override
public Boolean testUsuario() {
    if (validarCampos()) {

        LoginView view = clientFactory.getLoginView();
        PasswordTextBox textBoxClave = view.getTextBoxClave();
        TextBox textBoxLogin = view.getTextBoxLogin();
        final String clave = textBoxClave.getText();
        final String login = textBoxLogin.getText();
        SolicitudesService.Util.getInstance().testUser(login, clave, new AsyncCallback<Boolean>() {

            @Override
            public void onSuccess(Boolean result) {
                if (result) {
                    Cookies.setCookie("login", login);
                    goTo(new SolicitudesPlace(login));
                } else {
                    Window.alert("Usuario o contrasea invalidos por favor intente de nuevo.");
                }
            }

            @Override
            public void onFailure(Throwable caught) {
                Window.alert("Usuario o contrasea no validos");
            }
        });
    }

    return null;

}

From source file:com.adamantium.company.gwtp.client.application.details.address.AddressPresenter.java

License:Apache License

@Override
protected void onReset() {
    super.onReset();

    dispatcher.execute(new GetAddressAction(companyId), new AsyncCallback<GetAddressResult>() {
        @Override/*from   ww w. ja  va 2s .co m*/
        public void onFailure(Throwable caught) {
            getView().setAddress("");
            Window.alert("Error: unable to get company address from server");
        }

        @Override
        public void onSuccess(GetAddressResult result) {
            if (Cookies.getCookie("JSESSIONID") == null) {
                System.out.println("Set security cookie.");
                Cookies.setCookie("JSESSIONID", "JSESSIONID");
            }
            getView().setAddress(result.getAddress());
        }
    });
}

From source file:com.adamantium.company.gwtp.client.application.details.description.CompanyDescriptionPresenter.java

License:Apache License

@Override
protected void onReset() {
    super.onReset();
    dispatcher.execute(new GetDescriptionAction(companyId), new AsyncCallback<GetDescriptionResult>() {
        @Override/*from   ww  w  . j  a  v a 2  s  . c  om*/
        public void onFailure(Throwable caught) {
            getView().setCompanyDescription("");
            Window.alert("Error: unable to get company description from server");
        }

        @Override
        public void onSuccess(GetDescriptionResult result) {
            if (Cookies.getCookie("JSESSIONID") == null) {
                System.out.println("Set security cookie.");
                Cookies.setCookie("JSESSIONID", "JSESSIONID");
            }
            getView().setCompanyDescription(result.getDescription());
        }
    });
}

From source file:com.adamantium.company.gwtp.client.application.details.name.CompanyNamePresenter.java

License:Apache License

@Override
protected void onReset() {
    super.onReset();

    dispatcher.execute(new GetNameAction(companyId), new AsyncCallback<GetNameResult>() {
        @Override//from www  . j  a v  a 2 s .  c o  m
        public void onFailure(Throwable caught) {
            getView().setCompanyName("");
            Window.alert("Error: unable to get company name from server");
        }

        @Override
        public void onSuccess(GetNameResult result) {
            if (Cookies.getCookie("JSESSIONID") == null) {
                System.out.println("Set security cookie.");
                Cookies.setCookie("JSESSIONID", "JSESSIONID");
            }
            getView().setCompanyName(result.getName());
        }
    });
}

From source file:com.adamantium.company.gwtp.client.application.details.phone.PhonePresenter.java

License:Apache License

@Override
protected void onReset() {
    super.onReset();

    dispatcher.execute(new GetPhoneAction(companyId), new AsyncCallback<GetPhoneResult>() {
        @Override//  w  w  w. j  a  v  a2 s  . c  om
        public void onFailure(Throwable caught) {
            getView().setPhone("");
            Window.alert("Error: unable to get company phone from server");
        }

        @Override
        public void onSuccess(GetPhoneResult result) {
            if (Cookies.getCookie("JSESSIONID") == null) {
                System.out.println("Set security cookie.");
                Cookies.setCookie("JSESSIONID", "JSESSIONID");
            }
            getView().setPhone(result.getPhone());
        }
    });
}

From source file:com.adamantium.company.gwtp.client.application.list.ListPresenter.java

License:Apache License

@Override
protected void onReset() {
    super.onReset();

    //        List<CompanyTableInfo> Company = new ArrayList<>();
    //        Company.add(new CompanyTableInfo(1, "name1"));
    //        Company.add(new CompanyTableInfo(2, "name2"));
    //        Company.add(new CompanyTableInfo(3, "name3"));
    //        Company.add(new CompanyTableInfo(4, "name4"));
    //        getView().setRowData(Company);

    //        getView().setCompanyName(textToServer);
    //        getView().setServerResponse("Waiting for response...");

    dispatcher.execute(new GetCompanyListAction(), new AsyncCallback<GetCompanyListResult>() {
        @Override// w ww.  j  a va  2s. c o m
        public void onFailure(Throwable caught) {
            Window.alert("Error: unable to get company list from server");
        }

        @Override
        public void onSuccess(GetCompanyListResult result) {
            if (Cookies.getCookie("JSESSIONID") == null) {
                System.out.println("Set security cookie.");
                Cookies.setCookie("JSESSIONID", "JSESSIONID");
            }
            getView().setRowData(result.getCompanyList());
        }
    });
}

From source file:com.adamantium.company.gwtp.client.application.response.ResponsePresenter.java

License:Apache License

@Override
protected void onReset() {
    super.onReset();

    getView().setTextToServer(textToServer);
    getView().setServerResponse("Waiting for response...");

    dispatcher.execute(new SendTextToServerAction(textToServer), new AsyncCallback<SendTextToServerResult>() {
        @Override//from   w  w w . j a  va  2s .c o m
        public void onFailure(Throwable caught) {
            getView().setServerResponse("An error occured: " + caught.getMessage());
        }

        @Override
        public void onSuccess(SendTextToServerResult result) {
            if (Cookies.getCookie("JSESSIONID") == null) {
                System.out.println("Set security cookie.");
                Cookies.setCookie("JSESSIONID", "JSESSIONID");
            }
            getView().setServerResponse(result.getResponse());
        }
    });
}