List of usage examples for com.google.gwt.user.client Window prompt
public static String prompt(String msg, String initialValue)
From source file:io.apiman.manager.ui.client.local.pages.app.AppApiEntryDetails.java
License:Apache License
@PostConstruct protected void postConstruct() { copyButton.addClickHandler(new ClickHandler() { @Override/* w w w. j a v a2 s.c om*/ public void onClick(ClickEvent event) { String fullUrl = value.getHttpEndpoint(); if (fullUrl.contains("?")) { //$NON-NLS-1$ fullUrl += "&apikey=" + value.getApiKey(); //$NON-NLS-1$ } else { fullUrl += "?apikey=" + value.getApiKey(); //$NON-NLS-1$ } Window.prompt(i18n.format(AppMessages.APIS_REGISTRY_PLEASE_COPY), fullUrl); } }); }
From source file:main.client.ui.GoogleGadgetPortlet.java
License:Open Source License
public void configure() { String s = Window.prompt("Enter Google Gadget code or URL", ""); if (s != null) { if (s.startsWith(SCRIPT_SRC)) { s = s.substring(SCRIPT_SRC.length()); }// w w w. ja va 2s. c o m if (s.endsWith(SCRIPT_SRC_END)) { s = s.substring(0, s.length() - SCRIPT_SRC_END.length()); } setUrl(s); } }
From source file:main.client.ui.SourceBrowserPortlet.java
License:Open Source License
public void configure() { String s = Window.prompt("Enter name of class to display:", filename == null ? "" : filename); if (s != null) { filename = s;/* w ww .j ava 2 s.co m*/ refresh(); } }
From source file:net.sf.mmm.client.ui.gwt.widgets.richtext.RichTextToolbar.java
License:Apache License
/** * @param feature is the {@link RichTextFeature} to invoke (e.g. if according button has been clicked). *//*from w ww. j a va 2 s . co m*/ protected void invokeFeature(RichTextFeature feature) { switch (feature) { case BOLD: RichTextToolbar.this.formatter.toggleBold(); break; case ITALIC: RichTextToolbar.this.formatter.toggleItalic(); break; case UNDERLINE: RichTextToolbar.this.formatter.toggleUnderline(); break; case SUBSCRIPT: RichTextToolbar.this.formatter.toggleSubscript(); break; case SUPERSCRIPT: RichTextToolbar.this.formatter.toggleSuperscript(); break; case STRIKETHROUGH: RichTextToolbar.this.formatter.toggleStrikethrough(); break; case ALIGN_LEFT: RichTextToolbar.this.formatter.setJustification(Justification.LEFT); break; case ALIGN_CENTER: RichTextToolbar.this.formatter.setJustification(Justification.CENTER); break; case ALIGN_RIGHT: RichTextToolbar.this.formatter.setJustification(Justification.RIGHT); break; case UNORDERED_LIST: RichTextToolbar.this.formatter.insertUnorderedList(); break; case ORDERED_LIST: RichTextToolbar.this.formatter.insertOrderedList(); break; case HORIZONTAL_LINE: RichTextToolbar.this.formatter.insertHorizontalRule(); break; case INSERT_IMAGE: String url = Window.prompt(this.bundle.labelEnterImageUrl().getLocalizedMessage(), "http://"); if (url != null) { RichTextToolbar.this.formatter.insertImage(url); } break; case INSERT_LINK: url = Window.prompt(this.bundle.labelEnterLinkUrl().getLocalizedMessage(), "http://"); if (url != null) { RichTextToolbar.this.formatter.createLink(url); // this.linkMode = true; } break; case REMOVE_FORMAT: this.formatter.removeFormat(); this.formatter.removeLink(); break; case FONT_FAMILY: final DialogBox popup = new DialogBox(); popup.setStylePrimaryName("Popup"); popup.setText("Please choose font"); Grid content = new Grid(3, 2); content.setWidget(0, 0, new Label("Font-Family")); final ListBox dropdownFontFamily = new ListBox(false); for (String font : JavaScriptUtil.getInstance().getAvailableFonts()) { dropdownFontFamily.addItem(font); } content.setWidget(0, 1, dropdownFontFamily); content.setWidget(1, 0, new Label("Font-Size")); final ListBox dropdownFontSize = new ListBox(false); for (FontSize size : FONT_SIZES) { dropdownFontSize.addItem(Integer.toString(size.getNumber())); } content.setWidget(1, 1, dropdownFontSize); Button widget = new Button("OK"); ClickHandler handler = new ClickHandler() { @Override public void onClick(ClickEvent event) { popup.hide(); String fontFamily = dropdownFontFamily.getValue(dropdownFontFamily.getSelectedIndex()); RichTextToolbar.this.formatter.setFontName(fontFamily); String fontSize = dropdownFontSize.getValue(dropdownFontSize.getSelectedIndex()); for (FontSize size : FONT_SIZES) { if (Integer.toString(size.getNumber()).equals(fontSize)) { RichTextToolbar.this.formatter.setFontSize(size); } } } }; widget.addClickHandler(handler); content.setWidget(2, 0, widget); popup.setGlassEnabled(true); popup.setWidget(content); popup.center(); popup.show(); break; case FONT_SIZE: JsSelection selection = JavaScriptUtil.getInstance() .getSelection(RichTextToolbar.this.richTextArea.getElement()); Window.alert(selection.getText() + "\n" + selection.getHtml()); // RichTextToolbar.this.formatter.setFontSize(fontSize); break; case INDENT: RichTextToolbar.this.formatter.rightIndent(); break; case OUTDENT: RichTextToolbar.this.formatter.leftIndent(); break; case UNDO: RichTextToolbar.this.formatter.undo(); break; case REDO: RichTextToolbar.this.formatter.redo(); break; default: break; } }
From source file:org.codesearch.searcher.client.ui.fileview.FileViewImpl.java
License:Open Source License
/** * Shows an input dialog for the go to line feature. *//*from w w w .j ava 2 s . c om*/ private void goToLineWithDialog() { String input = Window.prompt("Go to line:", ""); try { int lineNumber = Integer.parseInt(input); goToLine(lineNumber); } catch (NumberFormatException ex) { } }
From source file:org.datacleaner.monitor.dashboard.widgets.DashboardGroupSelectionPanel.java
License:Open Source License
public DashboardGroupSelectionPanel(ClientConfig clientConfig, DashboardServiceAsync service, SimplePanel targetPanel) {/* w w w . ja v a 2 s .c o m*/ super(); _tenant = clientConfig.getTenant(); _service = service; _targetPanel = targetPanel; _isDashboardEditor = clientConfig.isDashboardEditor(); _displayDefaultGroup = clientConfig.isDefaultDashboardGroupDisplayed(); _displayInfomercial = clientConfig.isInformercialDisplayed(); _anchors = new HashMap<String, Anchor>(); _anchorPanel = new FlowPanel(); _anchorPanel.setStyleName("AnchorPanel"); addStyleName("DashboardGroupSelectionPanel"); // need to get history token as very first thing to see what happens // before the token is manipulated final String historyToken = History.getToken(); if (_displayDefaultGroup) { // add the default/"welcome" group addGroup(null); // this method sets the default group panel assert _defaultGroupPanel != null; } // load all other groups _service.getDashboardGroups(_tenant, new DCAsyncCallback<List<DashboardGroup>>() { @Override public void onSuccess(List<DashboardGroup> result) { sortDashboardGroups(result); for (DashboardGroup group : result) { addGroup(group); } initializeSelectedAnchor(); // check if a new timeline is requested through history token initializeNewTimelineIfNeeded(historyToken); } private void sortDashboardGroups(List<DashboardGroup> result) { Collections.sort(result, new Comparator<DashboardGroup>() { @Override public int compare(DashboardGroup o1, DashboardGroup o2) { return o1.getName().compareToIgnoreCase(o2.getName()); } }); } }); final Anchor createNewGroupAnchor = new Anchor(); createNewGroupAnchor.setVisible(_isDashboardEditor); createNewGroupAnchor.setStyleName("CreateNewDashboardGroupAnchor"); createNewGroupAnchor.setText("New group"); createNewGroupAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String name = Window.prompt("Name of the new group?", ""); boolean validName = name != null && name.trim().length() > 1; if (validName) { _service.addDashboardGroup(_tenant, name, new DCAsyncCallback<DashboardGroup>() { @Override public void onSuccess(DashboardGroup result) { addGroup(result); } }); } else { Window.alert("Please provide a valid group name of at least 2 characters"); } } }); add(_anchorPanel); add(createNewGroupAnchor); }
From source file:org.datacleaner.monitor.dashboard.widgets.SaveTimelineClickHandler.java
License:Open Source License
@Override public void onClick(ClickEvent event) { final boolean create; TimelineIdentifier timelineIdentifier = _timelinePanel.getTimelineIdentifier(); if (timelineIdentifier == null) { final String name = Window.prompt("Name of timeline?", ""); if (name == null || name.trim().length() == 0) { GWT.log("Not a valid timeline name: " + name); _timelinePanel.setTimelineDefinitionChanged(); return; }/*from w w w .ja v a 2s . com*/ final DashboardGroup timelineGroup = _timelinePanel.getTimelineGroupPanel().getTimelineGroup(); timelineIdentifier = new TimelineIdentifier(name, null, timelineGroup); create = true; } else { create = false; } TimelineDefinition timelineDefinition = _timelinePanel.getTimelineDefinition(); _timelinePanel.setTimelineDefinitionUnchanged(); if (create) { _service.createTimelineDefinition(_tenantIdentifier, timelineIdentifier, timelineDefinition, new DCAsyncCallback<TimelineIdentifier>() { @Override public void onSuccess(TimelineIdentifier result) { _timelinePanel.setTimelineIdentifier(result); Window.alert("Saved timeline '" + result.getName() + "'"); } }); } else { _service.updateTimelineDefinition(_tenantIdentifier, timelineIdentifier, timelineDefinition, new DCAsyncCallback<TimelineIdentifier>() { @Override public void onSuccess(TimelineIdentifier result) { Window.alert("Saved timeline '" + result.getName() + "'"); } }); } }
From source file:org.datacleaner.monitor.scheduling.command.CopyJobCommand.java
License:Open Source License
@Override public void execute() { _morePopup.hide();//from ww w . j a v a 2 s. c o m final String newJobName = Window.prompt("Enter new job name", _job.getName() + " (Copy)"); if (newJobName == null || newJobName.trim().length() == 0 || newJobName.equals(_job.getName())) { return; } final DCPopupPanel popup = new DCPopupPanel("Copying..."); popup.setWidget(new LoadingIndicator()); popup.center(); popup.show(); final String url = Urls.createRepositoryUrl(_tenant, "jobs/" + _job.getName() + ".copy"); final JSONObject payload = new JSONObject(); payload.put("name", new JSONString(newJobName)); final DCRequestBuilder requestBuilder = new DCRequestBuilder(RequestBuilder.POST, url); requestBuilder.setHeader("Content-Type", "application/json"); requestBuilder.send(payload.toString(), new DCRequestCallback() { @Override protected void onSuccess(Request request, Response response) { Window.Location.reload(); } }); }
From source file:org.datacleaner.monitor.scheduling.command.RenameJobCommand.java
License:Open Source License
@Override public void execute() { _morePopup.hide();/*from w ww. j a va2 s. co m*/ final String newName = Window.prompt("Enter job name", _job.getName()); if (newName == null || newName.trim().length() == 0 || newName.equals(_job.getName())) { return; } final DCPopupPanel popup = new DCPopupPanel("Renaming..."); popup.setWidget(new LoadingIndicator()); popup.center(); popup.show(); final String url = Urls.createRepositoryUrl(_tenant, "jobs/" + _job.getName() + ".modify"); final JSONObject payload = new JSONObject(); payload.put("name", new JSONString(newName)); final DCRequestBuilder requestBuilder = new DCRequestBuilder(RequestBuilder.POST, url); requestBuilder.setHeader("Content-Type", "application/json"); requestBuilder.send(payload.toString(), new DCRequestCallback() { @Override protected void onSuccess(Request request, Response response) { Window.Location.reload(); } @Override public void onNonSuccesfullStatusCode(Request request, Response response, int statusCode, String statusText) { popup.hide(); ErrorHandler.showErrorDialog(response.getText()); } }); }
From source file:org.daxplore.presenter.admin.view.PrefixListViewImpl.java
License:Open Source License
/** * {@inheritDoc}// w w w.jav a 2 s . co m */ @Override public String promptForPrefixName() { String prefix = Window.prompt( "Enter the name for the new prefix.\n\n" + "A single word using lowercase letters a-z.", ""); return prefix; }