当前位置: 首页>>代码示例>>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;未经允许,请勿转载。