List of usage examples for com.google.gwt.user.client Window prompt
public static String prompt(String msg, String initialValue)
From source file:org.nuxeo.codenvy.client.action.AutomationOperationAction.java
License:Open Source License
public void actionPerformed(ActionEvent event) { Window.prompt("Create a new operation with name:", ""); }
From source file:org.opendatakit.aggregate.client.UIUtils.java
License:Apache License
public static String promptForFilterName(ArrayList<FilterGroup> currentFilters) throws Exception { boolean match = false; String newFilterName = Window.prompt(UIConsts.PROMPT_FOR_NAME_TXT, BasicConsts.EMPTY_STRING); while (true) { if (newFilterName != null) { for (FilterGroup filter : currentFilters) { if (filter.getName().equals(newFilterName)) { match = true;//www . j av a 2 s.c o m } } } if (newFilterName == null) { // cancel was pressed throw new Exception("User Cancelled"); // exit } else if (match) { match = false; newFilterName = Window.prompt(UIConsts.REPROMPT_FOR_NAME_TXT, BasicConsts.EMPTY_STRING); } else if (newFilterName.equals(BasicConsts.EMPTY_STRING)) { newFilterName = Window.prompt(UIConsts.ERROR_NO_NAME, BasicConsts.EMPTY_STRING); } else { break; } } return newFilterName; }
From source file:org.opendatakit.aggregate.client.UIUtils.java
License:Apache License
public static String promptForREDCapApiKey() throws Exception { String newApiKey = Window.prompt(UIConsts.PROMPT_FOR_REDCAP_APIKEY_TXT, BasicConsts.EMPTY_STRING); while (true) { if (newApiKey == null) { // cancel was pressed throw new Exception("User Cancelled"); // exit } else if (newApiKey.equals(BasicConsts.EMPTY_STRING)) { newApiKey = Window.prompt(UIConsts.REPROMPT_FOR_REDCAP_APIKEY_TXT, BasicConsts.EMPTY_STRING); } else {//from w ww. j a v a2s .c o m return newApiKey; } } }
From source file:org.opendatakit.aggregate.client.UIUtils.java
License:Apache License
public static String promptForEmailAddress() throws Exception { String newEmailName = Window.prompt(UIConsts.PROMPT_FOR_EMAIL_TXT, BasicConsts.EMPTY_STRING); while (true) { if (newEmailName == null) { // cancel was pressed throw new Exception("User Cancelled"); // exit } else if (newEmailName.equals(BasicConsts.EMPTY_STRING)) { newEmailName = Window.prompt(UIConsts.REPROMPT_FOR_EMAIL_TXT, BasicConsts.EMPTY_STRING); } else {//ww w.j a v a 2s.c o m String email = EmailParser.parseEmail(newEmailName); if (email != null) { if (Window.confirm(CONFIRM_OWNER_EMAIL_TXT + email.substring(EmailParser.K_MAILTO.length()) + CONFIRM_OWNER_EMAIL_TXT2)) { return email; } } newEmailName = Window.prompt(UIConsts.REPROMPT_FOR_EMAIL_TXT, BasicConsts.EMPTY_STRING); } } }
From source file:org.thechiselgroup.biomixer.client.workbench.workspace.command.ShareWorkspaceCommand.java
License:Apache License
@Override public void execute(AsyncCallback<Void> callback) { String emailAddress = Window.prompt( // "Enter email address of person who " // + "should be invited to work on this workspace", "Please enter the email address of the collaborator:", "example@example.org"); if (emailAddress == null) { // cancel was pressed callback.onSuccess(null);/*from w ww . j a va 2 s . c o m*/ return; } // TODO message persistenceManager.shareWorkspace(emailAddress, new AsyncCallbackDelegate<Void>(callback)); }
From source file:org.waveprotocol.wave.client.editor.harness.DefaultTestHarness.java
License:Apache License
/** * {@inheritDoc}//from w w w. j av a2s . co m */ public void onModuleLoad() { final EditorHarness editorHarness = new EditorHarness() { @Override public void extend(Registries registries) { FormDoodads.register(registries.getElementHandlerRegistry()); // We'll need an attachment manager FakeAttachmentsManager attachmentManager = new FakeAttachmentsManager(); // Create a few attachments attachmentManager.createFakeAttachment("pics/Snow.jpg", 120, 80); attachmentManager.createFakeAttachment("pics/yosemite.jpg", 120, 80); attachmentManager.createFakeAttachment("pics/hills.jpg", 120, 74); attachmentManager.createFakeAttachment("pics/wave.gif", 120, 74); ImageThumbnail.register(registries.getElementHandlerRegistry(), attachmentManager, new ThumbnailActionHandler() { @Override public boolean onClick(ImageThumbnailWrapper thumbnail) { ContentElement e = thumbnail.getElement(); String newId = Window.prompt( "New attachment id, or 'remove' to remove the attribute", e.getAttribute(ImageThumbnail.ATTACHMENT_ATTR)); if (newId == null) { // They hit escape return true; } if ("remove".equals(newId)) { newId = null; } e.getMutableDoc().setElementAttribute(e, ImageThumbnail.ATTACHMENT_ATTR, newId); return true; } }); LinkAnnotationHandler.register(registries, new LinkAttributeAugmenter() { @Override public Map<String, String> augment(Map<String, Object> annotations, boolean isEditing, Map<String, String> current) { return current; } }); Suggestion.register(registries.getElementHandlerRegistry()); DiffDeleteRenderer.register(registries.getElementHandlerRegistry()); } @Override public String[] extendSampleContent() { String hills = "pics/hills.jpg"; String yosemite = "pics/yosemite.jpg"; return new String[] { "abcd" + ImageThumbnail.constructXml(yosemite, "Yosemite").getXmlString() + ImageThumbnail.constructXml(hills, "Hills").getXmlString() + ImageThumbnail.constructXml(hills, true, "Hills").getXmlString(), ImageThumbnail.constructXml(yosemite, "Yosemite").getXmlString() + ImageThumbnail.constructXml(hills, "Hills").getXmlString() + "<line t=\"li\"/>Some stuff" }; } }; final SignalEventHarness eventHarness = new SignalEventHarness(); // Poor man's tab panel. Use a tab panel once OOPHM is fixed to not break with it, // in the same way as the oracle box. FlowPanel topLevel = new FlowPanel(); final ListBox selector = new ListBox(); selector.addItem("edit"); selector.addItem("event"); selector.getElement().setId(TestConstants.PAGE_MODE_SELECTOR); selector.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent e) { if (selector.isItemSelected(0)) { editorHarness.getElement().getStyle().setDisplay(Display.BLOCK); eventHarness.getElement().getStyle().setDisplay(Display.NONE); } else { editorHarness.getElement().getStyle().setDisplay(Display.NONE); eventHarness.getElement().getStyle().setDisplay(Display.BLOCK); } } }); topLevel.add(selector); topLevel.add(editorHarness); topLevel.add(eventHarness); RootPanel.get().add(topLevel); editorHarness.getEditor1().focus(true); }
From source file:org.waveprotocol.wave.client.editor.harness.LinkerHelper.java
License:Apache License
/** * Helper for insert links while editing a document * * @param editor the wave editor/*from w w w. j a v a 2 s . c o m*/ */ public static void onCreateLink(EditorContext editor) { FocusedRange range = editor.getSelectionHelper().getSelectionRange(); if (range == null || range.isCollapsed()) { Window.alert("Select some text to create a link."); return; } try { // We try to create a link with the current selection, if fails, we ask // for a link Range rg = range.asRange(); String text = DocHelper.getText(editor.getDocument(), rg.getStart(), rg.getEnd()); String linkAnnotationValue = Link.normalizeLink(text); EditorAnnotationUtil.setAnnotationOverSelection(editor, AnnotationConstants.LINK_PREFIX, linkAnnotationValue); } catch (InvalidLinkException e) { String rawLinkValue = Window.prompt("Enter link: URL or Wave ID.", WaveRefConstants.WAVE_URI_PREFIX); // user hit "ESC" or "cancel" if (rawLinkValue == null) { return; } try { String linkAnnotationValue = Link.normalizeLink(rawLinkValue); EditorAnnotationUtil.setAnnotationOverSelection(editor, AnnotationConstants.LINK_PREFIX, linkAnnotationValue); } catch (InvalidLinkException e2) { Window.alert(e2.getLocalizedMessage()); } } }
From source file:org.waveprotocol.wave.client.wavepanel.impl.edit.ParticipantController.java
License:Apache License
/** * Shows an add-participant popup./*from w ww.ja v a 2s. c om*/ */ private void handleAddButtonClicked(Element context) { String addressString = Window.prompt("Add a participant(s) (separate with comma ','): ", ""); if (addressString == null) { return; } ParticipantId[] participants; try { participants = buildParticipantList(localDomain, addressString); } catch (InvalidParticipantAddress e) { Window.alert(e.getMessage()); return; } ParticipantsView participantsUi = views.fromAddButton(context); Conversation conversation = models.getParticipants(participantsUi); for (ParticipantId participant : participants) { conversation.addParticipant(participant); } }
From source file:org.waveprotocol.wave.client.wavepanel.impl.toolbar.LinkerHelper.java
License:Apache License
/** * Helper for insert links while editing a document * * @param editor the wave editor/*from w w w. java 2s. co m*/ */ public static void onCreateLink(EditorContext editor) { FocusedRange range = editor.getSelectionHelper().getSelectionRange(); if (range == null || range.isCollapsed()) { Window.alert(messages.selectSomeText()); return; } try { // We try to create a link with the current selection, if fails, we ask // for a link Range rg = range.asRange(); String text = DocHelper.getText(editor.getDocument(), rg.getStart(), rg.getEnd()); String linkAnnotationValue = Link.normalizeLink(text); EditorAnnotationUtil.setAnnotationOverSelection(editor, AnnotationConstants.LINK_PREFIX, linkAnnotationValue); } catch (InvalidLinkException e) { String rawLinkValue = Window.prompt(messages.enterLink(), WaveRefConstants.WAVE_URI_PREFIX); // user hit "ESC" or "cancel" if (rawLinkValue == null) { return; } try { String linkAnnotationValue = Link.normalizeLink(rawLinkValue); EditorAnnotationUtil.setAnnotationOverSelection(editor, AnnotationConstants.LINK_PREFIX, linkAnnotationValue); } catch (InvalidLinkException e2) { Window.alert(e2.getLocalizedMessage()); } } }
From source file:org.waveprotocol.wave.examples.client.webclient.client.WaveView.java
License:Apache License
@UiHandler("addParticipant") void addParticipant(ClickEvent e) { ObservableConversation root = conversationView.getRoot(); // TODO(arb): why is root null? ah wait, WVSI isn't getting listeners String id = Window.prompt("Email address?", ""); LOG.info("adding " + id + " to wavelet " + null + " " + manager + " " + manager.view); root.addParticipant(new ParticipantId(id)); }