List of usage examples for com.google.gwt.user.client Cookies removeCookie
public static void removeCookie(String name)
From source file:anzsoft.xmpp4gwt.client.Bosh2Connector.java
License:Open Source License
public void reset() { state = State.disconnected;// w w w . ja v a2 s .c o m Cookies.removeCookie(user.getResource() + "sid"); Cookies.removeCookie(user.getResource() + "rid"); this.errorCounter = 0; this.activeRequests.clear(); this.activeScriptRequests.clear(); this.sid = null; this.rid = (long) (Math.random() * 10000000); }
From source file:anzsoft.xmpp4gwt.client.User.java
License:Open Source License
public void reset() { Cookies.removeCookie(COOKIENAME); password = ""; priority = 0;//from w ww . j a v a2s .c om domainname = ""; username = ""; resource = ""; }
From source file:anzsoft.xmpp4gwt.client.User.java
License:Open Source License
public boolean resume() { String cookie = Cookies.getCookie(COOKIENAME); if (cookie == null || cookie.length() == 0) return false; JSONObject jUser = JSONParser.parse(cookie).isObject(); if (jUser == null) return false; this.username = jUser.get(STORAGE_USERNAME).isString().stringValue(); this.domainname = jUser.get(STORAGE_DOMAIN).isString().stringValue(); //this.password = jUser.get("password").isString().stringValue(); //jUser.put("priority", new JSONString(String.valueOf(priority))); this.resource = jUser.get(STORAGE_RESOURCE).isString().stringValue(); this.priority = Integer.parseInt(jUser.get(STORAGE_PRIORITY).isString().stringValue()); Cookies.removeCookie(COOKIENAME); if (username.length() == 0 || domainname.length() == 0) return false; return true;/* w ww.j av a 2s .co m*/ }
From source file:bingo.client.Bingo.java
License:Open Source License
/** * This is the entry point method./*from w w w. j a v a 2 s .co m*/ */ public void onModuleLoad() { Label titleLabel = new Label(); titleLabel.setText(strings.title()); RootPanel.get("title").add(titleLabel); // This is the general notification text box RootPanel.get("message").add(message); // Cheking if the user has already an user id final String cookie = Cookies.getCookie(COOKIE_ID); // Validating the cookie bingoService.statusUserId(cookie, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); Cookies.removeCookie(COOKIE_ID); } @Override public void onSuccess(Integer status) { // TODO: Control the logged status (I should not get a user if s/he is already logged) if (status.intValue() == BingoService.NO_LOGGED || status.intValue() == BingoService.LOGGED) { bingoService.getUserId(new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { message.setText(strings.errorUserCreation()); } @Override public void onSuccess(String result) { userId = result; } }); message.setHTML(""); // Showing image to enter ImageResource imageResource = BingoResources.INSTANCE.entry(); Image entryImage = new Image(imageResource.getSafeUri()); RootPanel.get("buttons").add(entryImage); // Selecting behavior (admin / voter) HorizontalPanel entryPoint = new HorizontalPanel(); entryPoint.setStyleName("mainSelectorPanel"); entryPoint.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); entryPoint.setSpacing(50); // // CREATING A BINGO // VerticalPanel leftPanel = new VerticalPanel(); leftPanel.setStyleName("selectorPanel"); Label leftPanelTitle = new Label(); leftPanelTitle.setStyleName("selectorPanelTitle"); leftPanelTitle.setText(strings.leftPanelTitle()); leftPanel.add(leftPanelTitle); leftPanel.setCellHorizontalAlignment(leftPanelTitle, HasHorizontalAlignment.ALIGN_CENTER); Grid leftSubPanel = new Grid(2, 2); leftSubPanel.setWidget(0, 0, new Label(strings.createBingoName())); final TextBox bingoNameBox = new TextBox(); leftSubPanel.setWidget(0, 1, bingoNameBox); leftSubPanel.setWidget(1, 0, new Label(strings.createBingoPassword())); final PasswordTextBox bingoPasswordBox = new PasswordTextBox(); leftSubPanel.setWidget(1, 1, bingoPasswordBox); leftPanel.add(leftSubPanel); final Button createButton = new Button("Create"); createButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { bingoService.createBingo(userId, bingoNameBox.getText(), bingoPasswordBox.getText(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(final String gameId) { final BingoGrid bingoGrid = new BingoGrid(); initAdminGrid(userId, bingoGrid, false); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); message.setText(strings.welcomeMessageCreation()); // Setting the cookie Date expirationDate = new Date(); expirationDate.setHours(expirationDate.getHours() + EXPIRATION_VALUE); Cookies.setCookie(COOKIE_ID, userId, expirationDate); } }); } }); leftPanel.add(createButton); leftPanel.setCellHorizontalAlignment(createButton, HasHorizontalAlignment.ALIGN_CENTER); entryPoint.add(leftPanel); // // JOINING // VerticalPanel rightPanel = new VerticalPanel(); rightPanel.setStyleName("selectorPanel"); Label rightPanelTitle = new Label(); rightPanelTitle.setStyleName("selectorPanelTitle"); rightPanelTitle.setText(strings.rightPanelTitle()); rightPanel.add(rightPanelTitle); rightPanel.setCellHorizontalAlignment(rightPanelTitle, HasHorizontalAlignment.ALIGN_CENTER); Grid rightSubPanel = new Grid(2, 2); rightSubPanel.setWidget(0, 0, new Label(strings.joinToBingoName())); final ListBox joinExistingBingoBox = new ListBox(); bingoService.getBingos(new AsyncCallback<String[][]>() { @Override public void onFailure(Throwable caught) { joinExistingBingoBox.addItem(strings.noBingos()); } @Override public void onSuccess(String[][] result) { if (result == null) { joinExistingBingoBox.addItem(strings.noBingos()); } else { for (int i = 0; i < result.length; i++) { String gameName = result[i][0]; String gameId = result[i][1]; joinExistingBingoBox.addItem(gameName, gameId); } } } }); rightSubPanel.setWidget(0, 1, joinExistingBingoBox); rightSubPanel.setWidget(1, 0, new Label(strings.joinToBingoPassword())); final PasswordTextBox joinBingoPasswordBox = new PasswordTextBox(); rightSubPanel.setWidget(1, 1, joinBingoPasswordBox); rightPanel.add(rightSubPanel); final Button joinButton = new Button("Join"); joinButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int index = joinExistingBingoBox.getSelectedIndex(); if (index < 0) message.setText(strings.noSelectedItem()); else { final String gameId = joinExistingBingoBox.getValue(index); if (gameId == null) message.setText(strings.noSelectedItem()); else { bingoService.joinBingo(userId, gameId, joinBingoPasswordBox.getText(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Void result) { final BingoGrid bingoGrid = new BingoGrid(); initUserGrid(bingoGrid); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); message.setText(strings.welcomeMessageJoin()); // Setting the cookie Date expirationDate = new Date(); expirationDate .setHours(expirationDate.getHours() + EXPIRATION_VALUE); Cookies.setCookie(COOKIE_ID, userId, expirationDate); } }); } } } }); rightPanel.add(joinButton); rightPanel.setCellHorizontalAlignment(joinButton, HasHorizontalAlignment.ALIGN_CENTER); entryPoint.add(rightPanel); RootPanel.get("bingoTable").add(entryPoint); } else if (status.intValue() == BingoService.ADMIN) { message.setText("Detected cookie: " + cookie + " as admin"); userId = cookie; bingoService.statusBingo(userId, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { message.setText(caught.getMessage()); } @Override public void onSuccess(Integer result) { int status = result.intValue(); final BingoGrid bingoGrid = new BingoGrid(); if (status == BingoService.RUNNING) { initAdminGrid(userId, bingoGrid, false); message.setText(strings.welcomeMessageCreation()); } else if (status == BingoService.FINISHED) { initAdminGrid(userId, bingoGrid, true); message.setText(strings.finishMessage()); } RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); } }); } else if (status.intValue() == BingoService.PARTICIPANT) { message.setText("Detected cookie: " + cookie + " as participant"); userId = cookie; final BingoGrid bingoGrid = new BingoGrid(); initUserGrid(bingoGrid); updateUserGrid(bingoGrid, null); RootPanel.get("bingoTable").clear(); RootPanel.get("bingoTable").add(bingoGrid); } } }); }
From source file:cc.kune.core.client.cookies.CookiesManagerImpl.java
License:GNU Affero Public License
@Override public void removeAnonCookie() { Cookies.removeCookie(ANON); Cookies.setCookie(ANON, null, new Date(0), CookieUtils.getDomain(), "/", false); }
From source file:cc.kune.core.client.cookies.CookiesManagerImpl.java
License:GNU Affero Public License
@Override public void removeAuthCookie() { // FIXME: Remove cookie doesn't works in all browsers, know // issue:/*www . j a v a2s . c o m*/ // http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/ded86778ee56690/515dc513c7d085eb?lnk=st&q=remove+cookie#515dc513c7d085eb // http://code.google.com/p/google-web-toolkit/issues/detail?id=1735&q=removeCookie Cookies.removeCookie(SessionConstants.USERHASH); Cookies.removeCookie(SessionConstants.JSESSIONID); // Workaround: Cookies.setCookie(SessionConstants.USERHASH, null, new Date(0), CookieUtils.getDomain(), "/", WindowUtils.isHttps()); Cookies.setCookie(SessionConstants.JSESSIONID, null, new Date(0), CookieUtils.getDomain(), "/", WindowUtils.isHttps()); }
From source file:cc.kune.core.client.cookies.MotdManager.java
License:GNU Affero Public License
private void setCookie(final String motdCookieName, final Date expires) { Cookies.removeCookie(motdCookieName); Cookies.setCookie(motdCookieName, null, expires, null, "/", WindowUtils.isHttps()); }
From source file:com.Administration.client.Administration.java
License:Apache License
/** * ? UI//ww w . jav a2 s . c o m */ public void onModuleLoad() { label = new HTML(); // ? ? label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loginLabel = new HTML(); // ? ? loginLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); dialog = new PasswordDialog(); // list = new LinkedList<>(); // ? ? ProvidesKey<LinkData> KEY_PROVIDER = new ProvidesKey<LinkData>() { // - ?? @Override public Object getKey(LinkData item) { return item == null ? null : item.getId(); } }; cellTable = new CellTable<>(KEY_PROVIDER); // ? dataProvider = new ListDataProvider<>(); // dataProvider.addDataDisplay(cellTable); // ?, ???? ? sortHandler = new ListHandler<>(list); // ? cellTable.addColumnSortHandler(sortHandler); // ? SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); pager = new SimplePager(SimplePager.TextLocation.CENTER, pagerResources, false, 0, true); // pager - ? pager.setDisplay(cellTable); // ?, pager ? ? initTable(); // ? cellTable.setWidth("100%"); cellTable.setHeight("80%"); cellTable.setAutoHeaderRefreshDisabled(true); cellTable.setAutoFooterRefreshDisabled(true); // ? VerticalPanel VP = new VerticalPanel(); VP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); VP.add(cellTable); VP.add(pager); logoutButton = new Button("Logout"); // ? HorizontalPanel loginHP = new HorizontalPanel(); loginHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loginHP.setSpacing(5); loginHP.add(loginLabel); loginHP.add(logoutButton); logoutButton.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { // Cookies.removeCookie(cookieName); // ? // ? ??? loginLabel.setHTML(""); loginLabel.setVisible(false); label.setHTML(""); cellTable.setVisible(false); pager.setVisible(false); logoutButton.setVisible(false); dataProvider.getList().clear(); // ? dialog.show(); // dialog.center(); } }); logoutButton.setVisible(false); // RootPanel.get("Login").add(loginHP); RootPanel.get("Data").add(VP); RootPanel.get("Data").add(label); // ? cellTable.setVisible(false); pager.setVisible(false); dialog.Login(); }
From source file:com.agnie.useradmin.session.client.helper.Helper.java
License:Open Source License
/** * Note: this will only set cookie value to zero and don't initiate backend api call. * */ public void logout() { Cookies.removeCookie(Cokie.AUTH.getKey()); }
From source file:com.automaster.autoview.client.ui.paineis.Topo.java
public Topo() { this.setWidth100(); this.setHeight(67); this.setBackgroundImage("../imagens/backgroundCinza.png"); this.setBackgroundRepeat(BackgroundRepeat.REPEAT_X); //setAlign(Alignment.CENTER); //final HLayout topoAux = this; final Image logo = new Image("imagens/autoView.png"); logo.setTitle("autoView"); logo.setAltText("AutoView Web"); logo.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() { @Override//ww w . ja v a 2 s.c om public void onClick(ClickEvent event) { SC.say("Verso 1.31. Todos os direitos reservados AutoMaster 2016 ©. Develop tool: [Adriano Vale]."); } }); HLayout painelLogo = new HLayout(); painelLogo.setMargin(5); painelLogo.setHeight(60); painelLogo.setWidth("80%"); painelLogo.setLayoutAlign(Alignment.LEFT); painelLogo.addMember(logo); final Image logoAuto = new Image("imagens/autoMaster.png"); logo.setTitle("autoView"); logoAuto.setAltText("AutoMaster"); logoAuto.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() { @Override public void onClick(ClickEvent event) { SC.say("Verso 1.31. Todos os direitos reservados AutoMaster 2016 ©. Develop tool: [Adriano Vale]."); } }); HLayout painelLogoAuto = new HLayout(); painelLogoAuto.setMargin(5); //painelLogoAuto.setWidth(210); painelLogoAuto.setHeight(60); painelLogoAuto.setWidth("70%"); painelLogoAuto.setLayoutAlign(Alignment.CENTER); painelLogoAuto.addMember(logoAuto); /*Label label = new Label("<strong><h3>AutoView Web</h3></strong>"); label.setAlign(Alignment.CENTER); label.setWidth100();*/ final Label labelDataHora = new Label(); labelDataHora.setAlign(Alignment.CENTER); labelDataHora.setWidth(180); labelDataHora.setHeight(30); Info.relogio = new Timer() { @Override public void run() { if (Info.validaConexao()) { final String dataAtual = DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG) .format(new Timestamp(System.currentTimeMillis()), TimeZone.createTimeZone(180)); final String hora = DateTimeFormat.getFormat(PredefinedFormat.TIME_MEDIUM) .format(new Timestamp(System.currentTimeMillis()), TimeZone.createTimeZone(180)); labelDataHora.setContents("<strong> " + dataAtual + " " + hora + "</strong>"); } //GWT.log(""+new Timestamp(System.currentTimeMillis())); } }; Info.relogio.scheduleRepeating(1000); Menu menuUsuario = new Menu(); menuUsuario.setShowShadow(true); menuUsuario.setShadowDepth(10); menuUsuario.setWidth(180); final MenuItemSeparator separator = new MenuItemSeparator(); // MenuItem menuItemNovoUsuario = new MenuItem("Adicionar usurio de cliente", "../imagens/add.png"); // menuItemNovoUsuario.addClickHandler(new ClickHandler() { // // @Override // public void onClick(MenuItemClickEvent event) { // NovoUsuarioCliente novoUsuarioCliente = new NovoUsuarioCliente(); // novoUsuarioCliente.setAnimateTime(1200); // novoUsuarioCliente.animateShow(AnimationEffect.FADE); // } // }); MenuItem menuItemEditarSenha = new MenuItem("Editar minha senha", "../imagens/edit.png"); menuItemEditarSenha.addClickHandler(new ClickHandler() { @Override public void onClick(MenuItemClickEvent event) { EditarSenha editarSenha = new EditarSenha(); editarSenha.setAnimateTime(1200); editarSenha.animateShow(AnimationEffect.FADE); } }); MenuItem menuItemSair = new MenuItem("Sair", "../imagens/exit.png"); menuItemSair.addClickHandler(new ClickHandler() { @Override public void onClick(MenuItemClickEvent event) { SC.ask("Sair", Info.usuarioLogado.get("nomeUsuario") + " voc deseja realmente sair?", new BooleanCallback() { @Override public void execute(Boolean value) { if (value != null && value) { // usurio saiu do sistema // Cookies.removeCookie("usuario"); Cookies.removeCookie("senha"); Info.registrarLog(Integer.parseInt(Info.usuarioLogado.get("codUsuario")), 47, new Timestamp(System.currentTimeMillis()), "Usurio: " + Info.usuarioLogado.get("nomeUsuario")); Info.usuarioLogado.clear(); Info.enderecosResolvidos.clear(); Info.relogio.cancel(); TabFrota.atualizaFrota.cancel(); Info.atualizaVeiculosTodos.cancel(); Info.atualizaVeiculosNovasPosicoes.cancel(); Info.atualizaPosicoesSemEndereco.cancel(); Info.atualizaPosicoesSemEnderecoHistorico.cancel(); if (Info.atualizaVeiculosTodos.isRunning()) { GWT.log("CANCELOU: Info.atualizaVeiculosTodos.cancel();"); Info.atualizaVeiculosTodos.cancel(); GWT.log("CANCELOU: Info.atualizaVeiculosTodos.cancel();"); } Info.atualizaLogUsuario.cancel(); Info.painelPrincipal.trocarPainel(new Login()); } } }); } }); menuUsuario.setItems(menuItemEditarSenha, separator, menuItemSair); MenuButton menuButton = new MenuButton("<strong>" + Info.usuarioLogado.get("nomeUsuario") + "</strong>", menuUsuario); menuButton.setWidth(180); menuButton.setHeight(30); menuButton.setAlign(Alignment.CENTER); //painelLogo.addMember(menuButton); VLayout painelInformacoes = new VLayout(); painelInformacoes.setHeight(60); //painelInformacoes.setWidth(200); painelInformacoes.setAlign(Alignment.RIGHT); painelInformacoes.addMember(labelDataHora); painelInformacoes.addMember(menuButton); this.addMember(painelLogoAuto); this.addMember(painelLogo); this.addMember(painelInformacoes); }