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

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

Introduction

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

Prototype

public static String getCookie(String name) 

Source Link

Document

Gets the cookie associated with the given name.

Usage

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//  w w  w .  jav  a  2 s . c o m
        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  w  w  w  . jav a2  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//from   ww  w.j  ava2  s .c  o  m
        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/*www. jav  a 2  s  . 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  .ja va 2  s  .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());
        }
    });
}

From source file:com.agnie.useradmin.login.client.presenter.LoginPresenter.java

License:Open Source License

@Override
public boolean go() {
    super.go();/*from   ww  w  . j a v  a2 s.  c o  m*/
    RootPanel contentPanel = clientFactory.getRootPanelFactory().getContentPanel();
    contentPanel.clear();

    HTMLPanel centerPanel = viewFactory.getCenterContentPanel();
    centerPanel.clear();

    view = viewFactory.getLoginView();

    String status = Cookies.getCookie(Cokie.STATUS.getKey());
    Cookies.setCookie(Cokie.STATUS.getKey(), null);
    if (status != null && status.equals(DomainAuthException.class.getName())) {
        String username = Cookies.getCookie(Cokie.USER.getKey());
        Cookies.setCookie(Cokie.USER.getKey(), null);
        if (username == null) {
            username = "";
        }
        view.registerView(username);
    } else if (status != null && status.equals(RequestedException.class.getName())) {
        messagePanel.show(false);
        messagePanel.setType(MessageType.WARNING);
        messagePanel.setMessage(messages.regrequested());
    } else if (status != null && status.equals(RegistrationDisabledException.class.getName())) {
        messagePanel.show(false);
        messagePanel.setType(MessageType.WARNING);
        messagePanel.setMessage(messages.reg_disabled());
    }
    view.initLabels();
    centerPanel.add(messagePanel);
    centerPanel.add(view);
    contentPanel.add(centerPanel);
    return true;
}

From source file:com.agnie.useradmin.persistance.client.helper.UserAdminClientURLInfo.java

License:Open Source License

public String getSessionId() {
    return Cookies.getCookie(Cokie.AUTH.getKey());
}

From source file:com.arcbees.bourseje.client.application.confirmvote.ConfirmVotePresenter.java

License:Apache License

@Override
public void prepareFromRequest(PlaceRequest request) {
    if (Cookies.getCookie(CookieNames.VOTE_CODE) == null) {
        revealPlace(NameTokens.IDENTIFICATION);
        return;/*from w ww .  j a  va 2s. com*/
    }

    id = request.getParameter(NameTokens.PARAM_ID, "noSelection");
    setCandidateInView(id);
}

From source file:com.arcbees.bourseje.client.application.vote.VotePresenter.java

License:Apache License

@Override
public void prepareFromRequest(final PlaceRequest request) {
    if (Cookies.getCookie(CookieNames.VOTE_CODE) == null) {
        PlaceRequest placeRequest = new PlaceRequest.Builder().nameToken(NameTokens.IDENTIFICATION).build();

        placeManager.revealPlace(placeRequest);
    }/*from   w  w w  .j  a  v  a  2s.com*/
}

From source file:com.automaster.autoview.client.ui.paineis.login.Login.java

public Login() {

    //this.setBackgroundImage("../imagens/logo.jpg");
    //this.setBackgroundColor("#1BAEAE");
    //this.setLayoutAlign(Alignment.CENTER);
    this.usuario = new TextItem();
    principal = new TabSetPrincipal();
    Login.tabMonitoramento = new Tab(Info.titulosMsg.get("monitoramento"));
    Login.tabsMonitorar = new TabSetPrincipal();
    this.senha = new PasswordItem();
    this.setAlign(Alignment.CENTER);
    this.setWidth100();
    this.setHeight100();

    final VLayout painelMeio = new VLayout();
    //painelMeio.setPosition(Positioning.ABSOLUTE);
    painelMeio.setEdgeSize(15);//from   www  .  j a v a  2  s  .c  o  m
    painelMeio.setShowEdges(true);
    painelMeio.setBackgroundColor("#FFFFFF");
    painelMeio.setWidth(600);
    painelMeio.setHeight(500);
    painelMeio.setMargin(100);
    //painelMeio.setLayoutAlign(Alignment.CENTER);
    painelMeio.setAlign(Alignment.CENTER);

    VLayout painelForm = new VLayout();
    //painelForm.setShowEdges(true);
    painelForm.setWidth(250);
    painelForm.setLayoutAlign(Alignment.CENTER);
    painelForm.setAlign(Alignment.RIGHT);
    painelForm.setHeight(85);
    //distncia entre membros adicionados ao painel
    painelForm.setMembersMargin(5);
    painelForm.setMargin(5);

    HLayout painelLogo = new HLayout();
    painelLogo.setPosition(Positioning.ABSOLUTE);
    painelLogo.setWidth(350);
    //painelLogo.setShowEdges(true);
    painelLogo.setHeight(90);
    painelLogo.setMargin(5);
    painelLogo.setLayoutAlign(Alignment.CENTER);
    painelLogo.setAlign(Alignment.CENTER);
    Image logo = new Image("imagens/logo.jpg");
    logo.setWidth("300px");
    logo.setHeight("75px");
    logo.setTitle(Info.titulosMsg.get("tituloAutoMaster"));
    painelLogo.addMember(logo);
    logo.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() {

        @Override
        public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
            SC.say("Todos os direitos reservados AutoMaster 2015 &copy;.");
        }
    });

    form = new DynamicForm();
    //form.setWidth("30%");
    form.setLayoutAlign(Alignment.CENTER);
    form.setAutoFocus(true);

    //final TextItem usuario = new TextItem();
    //GWT.log("teste: "+Info.titulosMsg);
    usuario.setTitle(Info.titulosMsg.get("tituloUsuario"));
    usuario.setName("usuario");
    usuario.setKeyPressFilter("[a-zA-Z.[0-9]");
    usuario.setRequired(true);

    senha.setTitle(Info.titulosMsg.get("tituloSenha"));
    senha.setName("senha");
    senha.setKeyPressFilter("[@$%*&%,;a-zA-Z.[0-9]");
    senha.setRequired(true);
    form.focusInItem("senha");

    final IButton entrar = new IButton(Info.titulosMsg.get("tituloEntrar"));
    //entrar.setWidth(200);
    entrar.setLayoutAlign(Alignment.RIGHT);
    //entrar.setAlign(Alignment.CENTER);

    final LinkItem email = new LinkItem();
    email.setTitle(Info.titulosMsg.get("tituloAjuda"));
    email.setLinkTitle("<br>" + Info.titulosMsg.get("tituloEsqueceuSenha") + "<br>");
    email.setHeight(36);
    email.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
        public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
            SC.say(Info.titulosMsg.get("tituloEntreEmContato"));
        }
    });

    form.setFields(new FormItem[] { usuario, senha, email });

    entrar.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (form.validate() && verificaLogin) {
                verificaLogin = false;
                verificarUsuario(usuario.getValueAsString(), senha.getValueAsString());
            }
        }
    });

    usuario.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
                if (form.validate() && verificaLogin) {
                    verificaLogin = false;
                    verificarUsuario(usuario.getValueAsString(), senha.getValueAsString());
                }
            }
        }
    });

    senha.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
                if (form.validate() && verificaLogin) {
                    verificaLogin = false;
                    verificarUsuario(usuario.getValueAsString(), senha.getValueAsString());
                }
            }
        }
    });

    painelForm.addMember(form);
    painelForm.addMember(entrar);

    painelMeio.addMember(painelLogo);
    painelMeio.addMember(painelForm);
    GWT.log("Info.usuarioLogado.size(): " + Info.usuarioLogado.size());
    if (Cookies.getCookie("usuario") != null && Cookies.getCookie("senha") != null) {
        verificarUsuario(Cookies.getCookie("usuario"), Cookies.getCookie("senha"));
    } else {
        addMember(painelMeio);
    }

}