List of usage examples for com.google.gwt.user.client Window confirm
public static boolean confirm(String msg)
From source file:com.appspot.hommkmessage.client.view.ListView.java
License:Open Source License
private void addDeleteLink(final MessageMetadata messageMetadata, final Panel parent) { if (!messageMetadata.isAllowedToBeDeleted()) { return;/*from w w w.j a v a 2 s . co m*/ } SubmitButton button = new SubmitButton( "<img src=\"images/cross_hand_drawn_linda_k_01_rotated.svg\" class=\"messageListEntryOptionIcon\" />"); button.addStyleName("messageListEntryOptionButton"); button.setTitle("Lschen"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!Window.confirm("Nachricht wirklich lschen?")) { return; } messagesService.deleteMessage(messageMetadata.getId(), password, localStorage.getUserId(), new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { parent.setVisible(false); } @Override public void onFailure(Throwable caught) { // if problems occur, add error message in the // future } }); } }); parent.add(button); }
From source file:com.arcbees.bourseje.client.admin.dashboard.AdminDashboardPresenter.java
License:Apache License
@Override public void onStartVoteClicked() { if (Window.confirm("Are you sure? This will reset all the votes.")) { setVoteState(VoteState.STARTED); }/* w w w .j a v a 2s .co m*/ }
From source file:com.arcbees.bourseje.client.admin.dashboard.candidate.CandidateAdminPresenter.java
License:Apache License
@Override public void onDelete() { if (Window.confirm("Are you sure you want to delete " + candidate.getName() + " ?")) { dispatch.execute(adminService.removeCandidate(candidate.getId()), new AdminRestCallback<Void>() { @Override//from w ww . j a v a2 s .co m public void onSuccess(Void result) { removeFromParentSlot(); } }); } }
From source file:com.axlight.gbrain.client.MainPane.java
License:Apache License
private void showConfirmDialog(String message, final ClickHandler okHandler) { if (GBrain.isIPhone) { if (Window.confirm(message)) { okHandler.onClick(null);/*from www .j av a 2 s . c om*/ } } else { final DialogBox dialog = new DialogBox(); dialog.setModal(true); dialog.setGlassEnabled(true); dialog.setText("Confirm"); Label label = new Label(message); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setSpacing(5); Button ok = new Button("OK"); buttonPanel.add(ok); Button cancel = new Button("Cancel"); buttonPanel.add(cancel); VerticalPanel basePanel = new VerticalPanel(); basePanel.setSpacing(10); basePanel.add(label); basePanel.add(buttonPanel); dialog.add(basePanel); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { okHandler.onClick(event); dialog.hide(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialog.hide(); } }); dialog.center(); } }
From source file:com.beyobe.client.App.java
License:Apache License
public static void registerEvents() { eventBus.addHandler(EditQuestionEvent.TYPE, new EditQuestionEventHandler() { @Override/*from w w w .j a v a 2 s. c om*/ public void onEditQuestion(EditQuestionEvent event) { App.question = event.getQuestion(); placeController.goTo(new QuestionPlace()); } }); eventBus.addHandler(TagClickedEvent.TYPE, new TagClickedEventHandler() { @Override public void onTagClicked(TagClickedEvent event) { final TagButton tagButton = event.getTagButton(); log.log(Level.INFO, "Tag clicked: " + tagButton); answerPopin = new PopinDialog(); RoundPanel answerPanel = new RoundPanel(); answerPanel.addStyleName("ttd-editAnswerPanel"); // HorizontalPanel menuBar = new HorizontalPanel(); // answerPanel.add(menuBar); Datum d = tagButton.getDatum(); if (d == null) { answerPanel.getElement().getStyle().setBackgroundColor("pink"); } else if (d.getAnswerStatus() != AnswerStatus.INFERRED) { answerPanel.getElement().getStyle().setBackgroundColor("#98FB98"); } else { answerPanel.getElement().getStyle().setBackgroundColor("light-gray"); } // Button closeButton = new Button("x"); // closeButton.setImportant(true); // closeButton.setSmall(true); Icons icons = GWT.create(Icons.class); Image closeIcon = new Image(icons.close32()); closeIcon.getElement().getStyle().setProperty("float", "right"); TouchDelegate closeTd = new TouchDelegate(closeIcon); closeTd.addTapHandler(new TapHandler() { @Override public void onTap(TapEvent event) { answerPopin.hide(); answerPopin.clear(); } }); answerPanel.add(closeIcon); Image unsubscribeIcon = new Image(icons.recycle32()); unsubscribeIcon.getElement().getStyle().setProperty("float", "top"); TouchDelegate unsubscribeTd = new TouchDelegate(unsubscribeIcon); unsubscribeTd.addTapHandler(new TapHandler() { @Override public void onTap(TapEvent event) { if (Window.confirm("Are you sure you want to unsubscribe from this question?")) { App.eventBus.fireEvent(new UnsubscribeEvent(tagButton)); } } }); answerPanel.add(unsubscribeIcon); //if user is admin or owner of the question, show the edit button if (isAdminUser() || session.getUserUid().equals(tagButton.getQuestion().getOwnerId())) { // Button editButton = new Button("edit"); // editButton.setSmall(true); // editButton.getElement().getStyle().setProperty("float", "right"); Image editIcon = new Image(icons.pencil32()); editIcon.getElement().getStyle().setProperty("float", "left"); TouchDelegate editTd = new TouchDelegate(editIcon); editTd.addTapHandler(new TapHandler() { @Override public void onTap(TapEvent event) { answerPopin.hide(); answerPopin.clear(); App.eventBus.fireEvent(new EditQuestionEvent(tagButton.getQuestion())); } }); answerPanel.add(editIcon); } answerPanel.add(new AnswerForm(tagButton)); answerPopin.add(answerPanel); answerPopin.show(); } }); eventBus.addHandler(DataCapturedEvent.TYPE, new DataCapturedEventHandler() { @Override public void onDataCaptured(DataCapturedEvent event) { TagButton tagButton = event.getTagButton(); if (answerPopin != null) answerPopin.hide(); tagButton.refreshAppearance(); dataBus.saveDatum(tagButton.getDatum(), tagButton.getQuestion()); } }); eventBus.addHandler(QuestionSavedEvent.TYPE, new QuestionSavedEventHandler() { @Override public void onQuestionSaved(QuestionSavedEvent event) { Question question = event.getQuestion(); // answerPopin.hide(); dataBus.saveQuestion(question); placeController.goTo(new TagdayPlace()); App.question = null; } }); eventBus.addHandler(UnsubscribeEvent.TYPE, new UnsubscribeEventHandler() { @Override public void onUnsubscribe(UnsubscribeEvent event) { TagButton tagButton = event.getTagButton(); tagButton.setVisible(false); dataBus.removeQuestion(tagButton); if (answerPopin != null) answerPopin.hide(); } }); }
From source file:com.bramosystems.oss.player.showcase.client.PlaylistPane.java
License:Apache License
@UiHandler("delButton") public void onDelClicked(ClickEvent event) { if (Window.confirm("Do you really want to remove the selected media from the playlist?")) { int index = list.getSelectedIndex(); MRL m = removeEntry(index);/*from w w w .j a va2 s.co m*/ delButton.setEnabled(false); fireEvent(new PlaylistChangeEvent(m, index, false)); } }
From source file:com.chinarewards.gwt.certificate.client.certificate.presenter.CertificateListPresenterImpl.java
private void initTableColumns() { Sorting<CertificateClient> ref = new Sorting<CertificateClient>() { @Override//from w ww .j av a2 s . co m public void sortingCurrentPage(Comparator<CertificateClient> comparator) { // listViewAdapter.sortCurrentPage(comparator); } @Override public void sortingAll(String sorting, String direction) { listViewAdapter.sortFromDateBase(sorting, direction); } }; cellTable.addColumn("??", new TextCell(), new GetValue<CertificateClient, String>() { @Override public String getValue(CertificateClient license) { return license.getName(); } }, ref, "name"); cellTable.addColumn("?", new TextCell(), new GetValue<CertificateClient, String>() { @Override public String getValue(CertificateClient license) { return license.getStatus().getDisplayName(); } }, ref, "status"); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<CertificateClient, String>() { @Override public String getValue(CertificateClient license) { if (license.getStatus() != null && license.getStatus() == CertificateStatus.NORMAL) return ""; else return "?"; } }, new FieldUpdater<CertificateClient, String>() { @Override public void update(int index, final CertificateClient o, String value) { String msgStr = ""; if (o.getStatus() != null && o.getStatus() == CertificateStatus.NORMAL) msgStr = "?"; else msgStr = "?"; win.confirm("??", msgStr, new ConfirmHandler() { @Override public void confirm() { // updateCertificateStatus(o.getId(), o.getStatus()); } }); } }); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<CertificateClient, String>() { @Override public String getValue(CertificateClient arg0) { return ""; } }, new FieldUpdater<CertificateClient, String>() { @Override public void update(int index, CertificateClient licenseClient, String value) { licenseClient.setThisAction(CertificateConstants.ACTION_CERTIFICATE_VIEW); Platform.getInstance().getEditorRegistry().openEditor(CertificateConstants.EDITOR_CERTIFICATE_VIEW, CertificateConstants.EDITOR_CERTIFICATE_VIEW + licenseClient.getId(), licenseClient); } }); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<CertificateClient, String>() { @Override public String getValue(CertificateClient arg0) { return ""; } }, new FieldUpdater<CertificateClient, String>() { @Override public void update(int index, final CertificateClient licenseClient, String value) { licenseClient.setThisAction(CertificateConstants.ACTION_CERTIFICATE_EDIT); Platform.getInstance().getEditorRegistry().openEditor(CertificateConstants.EDITOR_CERTIFICATE_EDIT, CertificateConstants.EDITOR_CERTIFICATE_EDIT + licenseClient.getId(), licenseClient); } }); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<CertificateClient, String>() { @Override public String getValue(CertificateClient license) { return ""; } }, new FieldUpdater<CertificateClient, String>() { @Override public void update(int index, CertificateClient o, String value) { if (Window.confirm("?")) { delteCertificate(o.getId()); } } }); }
From source file:com.chinarewards.gwt.license.client.license.presenter.LicenseListPresenterImpl.java
License:Open Source License
private void initTableColumns() { Sorting<LicenseClient> ref = new Sorting<LicenseClient>() { @Override//from w w w . j a v a2s. com public void sortingCurrentPage(Comparator<LicenseClient> comparator) { // listViewAdapter.sortCurrentPage(comparator); } @Override public void sortingAll(String sorting, String direction) { listViewAdapter.sortFromDateBase(sorting, direction); } }; cellTable.addColumn("??", new TextCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return license.getCorporationName(); } }, ref, "licenseName"); cellTable.addColumn("?", new TextCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return license.getLicenseTypeText(); } }, ref, ""); cellTable.addColumn("", new TextCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return license.getStaffNumber() + ""; } }, ref, ""); cellTable.addColumn("?", new TextCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return license.getMacaddress(); } }, ref, ""); cellTable.addColumn("", new DateCell(dateFormatAll), new GetValue<LicenseClient, Date>() { @Override public Date getValue(LicenseClient object) { return object.getNotafter(); } }, ref, "notafter"); cellTable.addColumn("", new TextCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return license.getDescription(); } }, ref, ""); cellTable.addColumn("?", new TextCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return license.getAwarduser(); } }, ref, "awarduser"); cellTable.addColumn("?", new DateCell(dateFormatAll), new GetValue<LicenseClient, Date>() { @Override public Date getValue(LicenseClient object) { return object.getIssued(); } }, ref, "issued"); cellTable.addColumn("?", new TextCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return license.getStatus().getDisplayName(); } }, ref, "status"); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient arg0) { return ""; } }, new FieldUpdater<LicenseClient, String>() { @Override public void update(int index, LicenseClient licenseClient, String value) { licenseClient.setThisAction(LicenseConstants.ACTION_LICENSE_VIEW); Platform.getInstance().getEditorRegistry().openEditor(LicenseConstants.EDITOR_LICENSE_VIEW, LicenseConstants.EDITOR_LICENSE_VIEW + licenseClient.getId(), licenseClient); } }); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient arg0) { return ""; } }, new FieldUpdater<LicenseClient, String>() { @Override public void update(int index, final LicenseClient licenseClient, String value) { licenseClient.setThisAction(LicenseConstants.ACTION_LICENSE_EDIT); Platform.getInstance().getEditorRegistry().openEditor(LicenseConstants.EDITOR_LICENSE_EDIT, LicenseConstants.EDITOR_LICENSE_EDIT + licenseClient.getId(), licenseClient); } }); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return ""; } }, new FieldUpdater<LicenseClient, String>() { @Override public void update(int index, LicenseClient o, String value) { if (Window.confirm("?")) { delteLicense(o.getId()); } } }); cellTable.addColumn("?", new HyperLinkCell(), new GetValue<LicenseClient, String>() { @Override public String getValue(LicenseClient license) { return ""; } }, new FieldUpdater<LicenseClient, String>() { @Override public void update(int index, LicenseClient license, String value) { if (RootPanel.get("downloadiframe") != null) { Widget widgetFrame = (Widget) RootPanel.get("downloadiframe"); widgetFrame.removeFromParent(); } NamedFrame frame = new NamedFrame("downloadiframe"); String url = ""; // url+=GWT.getModuleBaseURL(); url += "filedownload?licenseFileName=" + license.getLicenseFileName(); frame.setUrl(url); frame.setVisible(false); RootPanel.get().add(frame); } }); }
From source file:com.chinarewards.gwt.license.client.license.presenter.LicensePresenterImpl.java
License:Open Source License
private void initEvent() { // ?// w ww. java 2s .c o m registerHandler(display.getSaveClick().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { if (!validateSubmit()) { return; } LicenseVo licenseVo = LicenseAdapterClient.adapterDisplay(display); if (LicenseConstants.ACTION_LICENSE_ADD.equals(thisAction)) { licenseVo.setId(null); doSave(licenseVo); } else if (LicenseConstants.ACTION_LICENSE_EDIT.equals(thisAction)) { licenseVo.setId(display.getId().getValue()); doEdit(licenseVo); } else { win.alert(""); } } private void doSave(LicenseVo license) { dispatcher.execute(new EditLicenseRequest(license, sessionManager.getSession()), new AsyncCallback<EditLicenseResponse>() { @Override public void onFailure(Throwable t) { errorHandler.alert(t.toString()); } @Override public void onSuccess(EditLicenseResponse response) { // if(instanceId!=null||!instanceId.equals("")) Platform.getInstance().getEditorRegistry().openEditor( LicenseConstants.EDITOR_LICENSE_LIST, LicenseConstants.ACTION_LICENSE_LIST, instanceId); } }); } private void doEdit(LicenseVo license) { if (Window.confirm("?")) { dispatcher.execute(new EditLicenseRequest(license, sessionManager.getSession()), new AsyncCallback<EditLicenseResponse>() { @Override public void onFailure(Throwable t) { win.alert(""); Platform.getInstance().getEditorRegistry() .closeEditor(LicenseConstants.EDITOR_LICENSE_EDIT, instanceId); } @Override public void onSuccess(EditLicenseResponse arg0) { win.alert("?"); Platform.getInstance().getEditorRegistry().openEditor( LicenseConstants.EDITOR_LICENSE_LIST, LicenseConstants.ACTION_LICENSE_LIST, instanceId); } }); } } })); registerHandler(display.getBackClick().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { breadCrumbs.getGoHistory(); } })); }
From source file:com.chinarewards.gwt.license.client.user.presenter.UserSearchPresenterImpl.java
@Override public void bind() { // doSearch(); init();//from w w w . j a va 2 s.c om // search btn registerHandler(display.getSearchHandlers().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GWT.log("running click handlers. search"); doSearch(); } })); // add btn // Active btn registerHandler(display.getActiveHandlers().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GWT.log("running click handlers. Active"); win.alert("-"); } })); // LogOff btn registerHandler(display.getLogOffHandlers().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GWT.log("running click handlers. LogOff"); win.alert("-"); } })); // LogOff btn registerHandler(display.getDeleteHandlers().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GWT.log("running click handlers. delete"); if (Window.confirm("??")) { if (display.getSelectedUsers().size() < 1) { win.alert(",???."); return; } deleteUser(display.getSelectedUsers()); } } })); }