Java Code Examples for com.google.gwt.user.client.ui.Anchor#wrap()
The following examples show how to use
com.google.gwt.user.client.ui.Anchor#wrap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WordCloudApp.java From swcv with MIT License | 6 votes |
private void createLuckyWikiButton() { Anchor rndWikiButton = Anchor.wrap(Document.get().getElementById("btn_rnd_wiki")); final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text")); rndWikiButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { wcService.getRandomWikiUrl(new AsyncCallback<String>() { public void onSuccess(String result) { textArea.setText(result); } public void onFailure(Throwable caught) { textArea.setText("http://en.wikipedia.org/wiki/Special:random"); } }); } }); }
Example 2
Source File: WordCloudApp.java From swcv with MIT License | 6 votes |
private void createLuckyTwitterButton() { Anchor rndWikiButton = Anchor.wrap(Document.get().getElementById("btn_rnd_twitter")); final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text")); rndWikiButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { wcService.getRandomTwitterUrl(new AsyncCallback<String>() { public void onSuccess(String result) { textArea.setText(result); } public void onFailure(Throwable caught) { textArea.setText("twitter: hot trend"); } }); } }); }
Example 3
Source File: WordCloudApp.java From swcv with MIT License | 6 votes |
private void createLuckyYoutubeButton() { Anchor rndWikiButton = Anchor.wrap(Document.get().getElementById("btn_rnd_youtube")); final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text")); rndWikiButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { wcService.getRandomYoutubeUrl(new AsyncCallback<String>() { public void onSuccess(String result) { textArea.setText(result); } public void onFailure(Throwable caught) { textArea.setText("https://www.youtube.com"); } }); } }); }
Example 4
Source File: WordCloudApp.java From swcv with MIT License | 6 votes |
private void createLuckyGoogleButton() { Anchor rndGoogleButton = Anchor.wrap(Document.get().getElementById("btn_rnd_google")); final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text")); rndGoogleButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { wcService.getRandomGoogleUrl(new AsyncCallback<String>() { public void onSuccess(String result) { textArea.setText(result); } public void onFailure(Throwable caught) { textArea.setText("google: hot trend"); } }); } }); }
Example 5
Source File: WordCloudDetailApp.java From swcv with MIT License | 5 votes |
private void addSaveAsLinks(WordCloud cloud) { Anchor link = Anchor.wrap(Document.get().getElementById("save-as-svg")); link.setHref("/cloud/download?ft=svg&id=" + cloud.getId()); Anchor linkPNG = Anchor.wrap(Document.get().getElementById("save-as-png")); linkPNG.setHref("/cloud/download?ft=png&id=" + cloud.getId()); Anchor linkPDF = Anchor.wrap(Document.get().getElementById("save-as-pdf")); linkPDF.setHref("/cloud/download?ft=pdf&id=" + cloud.getId()); }
Example 6
Source File: WordCloudApp.java From swcv with MIT License | 4 votes |
private void createShowAdvancedButton() { final String COOKIE_NAME = "show-adv-options"; final Anchor showAdvancedButton = Anchor.wrap(Document.get().getElementById("adv_link")); final Panel settingArea = RootPanel.get("settingContainer"); showAdvancedButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (showAdvancedButton.getText().equals("Show Advanced Options")) { settingArea.removeStyleName("hide"); showAdvancedButton.setText("Hide Advanced Options"); Cookies.setCookie(COOKIE_NAME, "1", new Date(System.currentTimeMillis() + (86400 * 7 * 1000))); } else { settingArea.addStyleName("hide"); showAdvancedButton.setText("Show Advanced Options"); Cookies.removeCookie(COOKIE_NAME); } } }); boolean needToShow = "1".equals(Cookies.getCookie(COOKIE_NAME)); if (needToShow) showAdvancedButton.fireEvent(new GwtEvent<ClickHandler>() { @Override public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() { return ClickEvent.getType(); } @Override protected void dispatch(ClickHandler handler) { handler.onClick(null); } }); }