本文整理汇总了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");
}
});
}
});
}
示例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");
}
});
}
});
}
示例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");
}
});
}
});
}
示例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");
}
});
}
});
}
示例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());
}
示例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);
}
});
}