當前位置: 首頁>>代碼示例>>Java>>正文


Java Anchor.wrap方法代碼示例

本文整理匯總了Java中com.google.gwt.user.client.ui.Anchor.wrap方法的典型用法代碼示例。如果您正苦於以下問題:Java Anchor.wrap方法的具體用法?Java Anchor.wrap怎麽用?Java Anchor.wrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.user.client.ui.Anchor的用法示例。


在下文中一共展示了Anchor.wrap方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createLuckyWikiButton

import com.google.gwt.user.client.ui.Anchor; //導入方法依賴的package包/類
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");
                }
            });

        }
    });
}
 
開發者ID:spupyrev,項目名稱:swcv,代碼行數:25,代碼來源:WordCloudApp.java

示例2: createLuckyTwitterButton

import com.google.gwt.user.client.ui.Anchor; //導入方法依賴的package包/類
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");
                }
            });

        }
    });
}
 
開發者ID:spupyrev,項目名稱:swcv,代碼行數:25,代碼來源:WordCloudApp.java

示例3: createLuckyYoutubeButton

import com.google.gwt.user.client.ui.Anchor; //導入方法依賴的package包/類
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");
                }
            });

        }
    });
}
 
開發者ID:spupyrev,項目名稱:swcv,代碼行數:25,代碼來源:WordCloudApp.java

示例4: createLuckyGoogleButton

import com.google.gwt.user.client.ui.Anchor; //導入方法依賴的package包/類
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");
                }
            });

        }
    });
}
 
開發者ID:spupyrev,項目名稱:swcv,代碼行數:25,代碼來源:WordCloudApp.java

示例5: addSaveAsLinks

import com.google.gwt.user.client.ui.Anchor; //導入方法依賴的package包/類
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());
}
 
開發者ID:spupyrev,項目名稱:swcv,代碼行數:12,代碼來源:WordCloudDetailApp.java

示例6: createShowAdvancedButton

import com.google.gwt.user.client.ui.Anchor; //導入方法依賴的package包/類
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);
            }
        });
}
 
開發者ID:spupyrev,項目名稱:swcv,代碼行數:44,代碼來源:WordCloudApp.java


注:本文中的com.google.gwt.user.client.ui.Anchor.wrap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。