List of usage examples for com.google.gwt.user.client Window confirm
public static boolean confirm(String msg)
From source file:org.guvnor.organizationalunit.manager.client.editor.OrganizationalUnitManagerViewImpl.java
License:Apache License
@UiHandler("btnDeleteOrganizationalUnit") public void onClickDeleteOrganizationalUnitButton(final ClickEvent event) { final int selectedOrganizationalUnitIndex = lstOrganizationalUnits.getSelectedIndex(); if (selectedOrganizationalUnitIndex < 0) { return;// w w w .j ava 2 s.c o m } final OrganizationalUnit organizationalUnit = sortedOrganizationalUnits .get(selectedOrganizationalUnitIndex); if (Window.confirm(OrganizationalUnitManagerConstants.INSTANCE .ConfirmOrganizationalUnitDeletion0(organizationalUnit.getName()))) { presenter.deleteOrganizationalUnit(organizationalUnit); } }
From source file:org.guvnor.structure.client.editors.repository.clone.CloneRepositoryForm.java
License:Apache License
@UiHandler("clone") public void onCloneClick(final ClickEvent e) { if (gitURLTextBox.getText() == null || gitURLTextBox.getText().trim().isEmpty()) { urlGroup.setType(ControlGroupType.ERROR); urlHelpInline.setText(CoreConstants.INSTANCE.URLMandatory()); return;/*from w ww . j a va 2 s. c o m*/ } else if (!URIUtil.isValid(gitURLTextBox.getText().trim())) { urlGroup.setType(ControlGroupType.ERROR); urlHelpInline.setText(CoreConstants.INSTANCE.InvalidUrlFormat()); return; } else { urlGroup.setType(ControlGroupType.NONE); } final String organizationalUnit = organizationalUnitDropdown .getValue(organizationalUnitDropdown.getSelectedIndex()); if (mandatoryOU && !availableOrganizationalUnits.containsKey(organizationalUnit)) { organizationalUnitGroup.setType(ControlGroupType.ERROR); organizationalUnitHelpInline.setText(CoreConstants.INSTANCE.OrganizationalUnitMandatory()); return; } else { organizationalUnitGroup.setType(ControlGroupType.NONE); } if (nameTextBox.getText() == null || nameTextBox.getText().trim().isEmpty()) { nameGroup.setType(ControlGroupType.ERROR); nameHelpInline.setText(CoreConstants.INSTANCE.RepositoryNaneMandatory()); return; } else { repositoryService.call(new RemoteCallback<String>() { @Override public void callback(String normalizedName) { if (!nameTextBox.getText().equals(normalizedName)) { if (!Window.confirm(CoreConstants.INSTANCE.RepositoryNameInvalid() + " \"" + normalizedName + "\". " + CoreConstants.INSTANCE.DoYouAgree())) { return; } nameTextBox.setText(normalizedName); } lockScreen(); final String scheme = "git"; final String alias = nameTextBox.getText().trim(); final String origin = gitURLTextBox.getText().trim(); final String username = usernameTextBox.getText().trim(); final String password = passwordTextBox.getText().trim(); final Map<String, Object> env = new HashMap<String, Object>(3); env.put("username", username); env.put("crypt:password", password); env.put("origin", origin); repositoryService.call(new RemoteCallback<Repository>() { @Override public void callback(Repository o) { BusyPopup.close(); Window.alert(CoreConstants.INSTANCE.RepoCloneSuccess()); hide(); placeManager.goTo(new DefaultPlaceRequest("RepositoryEditor").addParameter("alias", o.getAlias())); } }, new ErrorCallback<Message>() { @Override public boolean error(final Message message, final Throwable throwable) { try { throw throwable; } catch (RepositoryAlreadyExistsException ex) { ErrorPopup.showMessage(CoreConstants.INSTANCE.RepoAlreadyExists()); } catch (Throwable ex) { ErrorPopup.showMessage( CoreConstants.INSTANCE.RepoCloneFail() + " \n" + throwable.getMessage()); } unlockScreen(); return true; } }).createRepository(availableOrganizationalUnits.get(organizationalUnit), scheme, alias, env); } }).normalizeRepositoryName(nameTextBox.getText()); } }
From source file:org.guvnor.structure.client.editors.repository.clone.CloneRepositoryViewImpl.java
License:Apache License
@Override public boolean showAgreeNormalizeNameWindow(final String normalizedName) { return Window.confirm(CoreConstants.INSTANCE.RepositoryNameInvalid() + " \"" + normalizedName + "\". " + CoreConstants.INSTANCE.DoYouAgree()); }
From source file:org.guvnor.structure.client.editors.repository.create.CreateRepositoryForm.java
License:Apache License
@UiHandler("create") public void onCreateClick(final ClickEvent e) { final String organizationalUnit = organizationalUnitDropdown .getValue(organizationalUnitDropdown.getSelectedIndex()); if (mandatoryOU && !availableOrganizationalUnits.containsKey(organizationalUnit)) { organizationalUnitGroup.setType(ControlGroupType.ERROR); organizationalUnitHelpInline.setText(CoreConstants.INSTANCE.OrganizationalUnitMandatory()); return;/*from w w w .ja v a 2 s .c o m*/ } else { organizationalUnitGroup.setType(ControlGroupType.NONE); } if (nameTextBox.getText() == null || nameTextBox.getText().trim().isEmpty()) { nameGroup.setType(ControlGroupType.ERROR); nameHelpInline.setText(CoreConstants.INSTANCE.RepositoryNaneMandatory()); return; } else { repositoryService.call(new RemoteCallback<String>() { @Override public void callback(String normalizedName) { if (!nameTextBox.getText().equals(normalizedName)) { if (!Window.confirm(CoreConstants.INSTANCE.RepositoryNameInvalid() + " \"" + normalizedName + "\". " + CoreConstants.INSTANCE.DoYouAgree())) { return; } nameTextBox.setText(normalizedName); } final String scheme = "git"; final String alias = nameTextBox.getText().trim(); final Map<String, Object> env = new HashMap<String, Object>(3); repositoryService.call(new RemoteCallback<Repository>() { @Override public void callback(Repository o) { Window.alert(CoreConstants.INSTANCE.RepoCreationSuccess()); hide(); placeManager.goTo(new DefaultPlaceRequest("RepositoryEditor").addParameter("alias", o.getAlias())); } }, new ErrorCallback<Message>() { @Override public boolean error(final Message message, final Throwable throwable) { try { throw throwable; } catch (RepositoryAlreadyExistsException ex) { ErrorPopup.showMessage(CoreConstants.INSTANCE.RepoAlreadyExists()); } catch (Throwable ex) { ErrorPopup.showMessage( CoreConstants.INSTANCE.RepoCreationFail() + " \n" + throwable.getMessage()); } return true; } }).createRepository(availableOrganizationalUnits.get(organizationalUnit), scheme, alias, env); } }).normalizeRepositoryName(nameTextBox.getText()); } }
From source file:org.guvnor.structure.client.editors.repository.list.RepositoriesViewImpl.java
License:Apache License
@Override public boolean confirmDeleteRepository(final Repository repository) { return Window.confirm(CoreConstants.INSTANCE.ConfirmDeleteRepository0(repository.getAlias())); }
From source file:org.guvnor.structure.client.file.DeletePopup.java
License:Apache License
public DeletePopup(final CommandWithCommitMessage command) { super(CommonImages.INSTANCE.edit(), CommonConstants.INSTANCE.DeletePopupTitle()); checkNotNull("command", command); //Make sure it appears on top of other popups getElement().getStyle().setZIndex(Integer.MAX_VALUE); checkInCommentTextBox.setTitle(CommonConstants.INSTANCE.CheckInComment()); checkInCommentTextBox.setWidth("200px"); addAttribute(CommonConstants.INSTANCE.CheckInCommentColon(), checkInCommentTextBox); final GenericModalFooter footer = new GenericModalFooter(); footer.addButton(CommonConstants.INSTANCE.DeletePopupDelete(), new Command() { @Override//from w w w . j a v a 2 s. c om public void execute() { if (!Window.confirm(CommonConstants.INSTANCE.DeletePopupRenameNamePrompt())) { return; } hide(); command.execute(checkInCommentTextBox.getText()); } }, IconType.REMOVE, ButtonType.PRIMARY); footer.addButton(CommonConstants.INSTANCE.Cancel(), new Command() { @Override public void execute() { hide(); } }, ButtonType.DEFAULT); add(footer); }
From source file:org.gwtbootstrap3.demo.client.application.extras.FullCalendarView.java
License:Apache License
@UiHandler("configuring") public void configuring(final ClickEvent event) { if (configuringCalendar != null) { return;/*from ww w . j a v a 2 s. c o m*/ } CalendarConfig config = new CalendarConfig(); ClickAndHoverConfig clickHover = new ClickAndHoverConfig(new ClickAndHoverEventCallback() { @Override public void eventMouseover(JavaScriptObject calendarEvent, NativeEvent event, JavaScriptObject viewObject) { } @Override public void eventMouseout(JavaScriptObject calendarEvent, NativeEvent event, JavaScriptObject viewObject) { } @Override public void eventClick(JavaScriptObject calendarEvent, NativeEvent event, JavaScriptObject viewObject) { Event calEvent = new Event(calendarEvent); System.out.println("id " + calEvent.getId() + " start: " + calEvent.getStart() + " end: " + calEvent.getEnd() + " all day: " + calEvent.isAllDay()); if (Window.confirm("Delete '" + calEvent.getTitle() + "'?")) configuringCalendar.removeEvent(calEvent.getId()); } @Override public void dayClick(JavaScriptObject moment, NativeEvent event, JavaScriptObject viewObject) { // TODO Auto-generated method stub } }); config.setClickHoverConfig(clickHover); SelectConfig selectConfig = new SelectConfig(new SelectEventCallback() { @Override public void select(JavaScriptObject start, JavaScriptObject end, NativeEvent event, JavaScriptObject viewObject) { Event tempEvent = new Event("" + System.currentTimeMillis(), "New event"); tempEvent.setStart(start); tempEvent.setEnd(end); if (tempEvent.getEnd().getHours() == tempEvent.getStart().getHours() && tempEvent.getEnd().getMinutes() == tempEvent.getStart().getMinutes()) tempEvent.setAllDay(true); if (Window.confirm("Create event?")) { configuringCalendar.unselect(); configuringCalendar.addEvent(tempEvent); } } @Override public void unselect(JavaScriptObject viewObject, NativeEvent event) { // System.out.println("unselect"); } }); config.setSelectConfig(selectConfig); DragAndResizeConfig dr = new DragAndResizeConfig(new DragAndResizeCallback() { @Override public void eventResizeStop(JavaScriptObject calendarEvent, NativeEvent nativeEvent) { // System.out.println("eventResizeStop"); } @Override public void eventResizeStart(JavaScriptObject calendarEvent, NativeEvent nativeEvent) { // System.out.println("eventResizeStart"); } @Override public void eventResize(JavaScriptObject calendarEvent, JavaScriptObject revertFunction, NativeEvent nativeEvent) { // System.out.println("eventResize"); } @Override public void eventDrop(JavaScriptObject calendarEvent, JavaScriptObject revertFunction, NativeEvent nativeEvent) { // System.out.println("eventDrop"); Event evt = new Event(calendarEvent); System.out.println("eventDrop: " + evt.getStartFromYearMonthDay()); } @Override public void eventDragStop(JavaScriptObject calendarEvent, NativeEvent nativeEvent) { // System.out.println("eventDragStop"); } @Override public void eventDragStart(JavaScriptObject calendarEvent, NativeEvent nativeEvent) { // System.out.println("eventDragStart"); } }); config.setDragResizeConfig(dr); config.setSelectable(true); config.setSelectHelper(true); GeneralDisplay gd = new GeneralDisplay(); config.setGeneralDisplay(gd); configuringCalendar = new FullCalendar("" + System.currentTimeMillis(), ViewOption.agendaWeek, config, true); configuringCalendar.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { addEvents(configuringCalendar); } }); configuringPanel.add(configuringCalendar); }
From source file:org.gwtportlets.portlet.client.edit.PageEditor.java
License:Open Source License
private void deleteWidget(LayoutEditor src, Widget widget) { raiseOverlay();/*from w w w . ja v a 2 s. c o m*/ hideAllResizers(); moveIndicator(heldIndicator, widget); if (Window.confirm("Are you sure you want to delete this widget?")) { beginUndo("Delete " + getWidgetDescription(widget)); widget.removeFromParent(); src.getContainer().layout(); onWidgetDeleted(widget); } showAllResizers(); discardHeldWidget(); }
From source file:org.gwtportlets.portlet.client.edit.PageEditor.java
License:Open Source License
/** * Replace old with nw. Prompts for confirmation, creates unto record * etc. If addOldToNew is true is a Container then old is added to it * i.e. it takes the place of old but contains old. *///from w ww. j av a 2 s. c o m private void replaceWidget(Widget old, Widget nw, boolean addOldToNew, boolean addPlaceholder, boolean refresh) { if (!addOldToNew) { hideAllResizers(); moveIndicator(heldIndicator, old); boolean ok = Window .confirm("Are you sure you want to " + "replace this widget with " + getWidgetDescription(nw)); showAllResizers(); discardHeldWidget(); if (!ok) { return; } } beginUndo("Replace " + getWidgetDescription(old) + " with " + getWidgetDescription(nw)); replaceWidgetImpl(old, nw, addOldToNew, addOldToNew && addPlaceholder ? createPlaceholder() : null); if (refresh) { refresh(nw); } if (addOldToNew) { setEditDepth(editDepth + 1); } }
From source file:org.jahia.ajax.gwt.client.widget.toolbar.action.UnmountActionItem.java
License:Open Source License
public void onComponentSelection() { GWTJahiaNode selection = linker.getSelectionContext().getSingleSelection(); if (selection != null) { if (selection.isLocked()) { Window.alert(Messages.get("failure.unmountLock1.label") + " " + selection.getName() + Messages.get("failure.unmountLock2.label") + " " + selection.getLockInfos()); } else if (Window.confirm(Messages.get("confirm.unmount.label") + " " + selection.getName() + " ?")) { linker.loading(Messages.get("statusbar.unmounting.label")); List<String> selectedPaths = new ArrayList<String>(1); selectedPaths.add(selection.getPath()); JahiaContentManagementService.App.getInstance().deletePaths(selectedPaths, new BaseAsyncCallback() { public void onApplicationFailure(Throwable throwable) { Window.alert( Messages.get("failure.unmount.label") + "\n" + throwable.getLocalizedMessage()); linker.loaded();// w ww . j a v a2s . com } public void onSuccess(Object o) { linker.loaded(); linker.refresh(Linker.REFRESH_FOLDERS); } }); } } }