本文整理汇总了Java中com.google.gwt.user.client.ui.Anchor类的典型用法代码示例。如果您正苦于以下问题:Java Anchor类的具体用法?Java Anchor怎么用?Java Anchor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Anchor类属于com.google.gwt.user.client.ui包,在下文中一共展示了Anchor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UniTimeDialogBox
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
public UniTimeDialogBox(boolean autoHide, boolean modal) {
super(autoHide, modal);
setAnimationEnabled(true);
setGlassEnabled(true);
iContainer = new FlowPanel();
iContainer.addStyleName("dialogContainer");
iClose = new Anchor();
iClose.setTitle(MESSAGES.hintCloseDialog());
iClose.setStyleName("close");
iClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onCloseClick(event);
}
});
iClose.setVisible(autoHide);
iControls = new FlowPanel();
iControls.setStyleName("dialogControls");
iControls.add(iClose);
}
示例2: afterInitialization
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
@AfterInitialization
public void afterInitialization() {
authenticationServiceCaller.call(new RemoteCallback<User>() {
@Override
public void callback(User user) {
Label userLabel = new Label(
"User logged in: username=" + user.getIdentifier() + ", roles=" + user.getRoles());
RootPanel.get().add(userLabel);
SimplePanel panel = new SimplePanel();
Anchor logoutLink = new Anchor("Spring Security Logout URL", GWT.getHostPageBaseURL() + "logout");
panel.add(logoutLink);
RootPanel.get().add(panel);
initBtns();
}
}).getUser();
}
示例3: build
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
/**
* Build the Anchor with target="_blank"
*
* @return Anchor
*/
public Anchor build() {
final Anchor anchor = new Anchor();
if (image != null) {
anchor.getElement().appendChild(image.getElement());
}
if (text != null) {
anchor.setText(text);
}
if (title != null) {
anchor.setTitle(title);
}
if (bottomBorderOnMouseOver) {
anchor.addMouseOverHandler(getMouseOverhandler(anchor));
anchor.addMouseOutHandler(getMouseOutHandler(anchor));
}
anchor.setHref(href);
anchor.setTarget("_blank");
return anchor;
}
示例4: buildClick
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
public Anchor buildClick() {
Anchor anchor = new Anchor();
if (image != null) {
anchor.getElement().appendChild(image.getElement());
}
if (text != null) {
anchor.setText(text);
}
if (title != null) {
anchor.setTitle(title);
}
if (clickHandler != null) {
anchor.addClickHandler(clickHandler);
}
return anchor;
}
示例5: makeValidLink
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
/**
* Helper method to validify a hyperlink
* @param link the GWT anchor object to validify
* @param linktext the actual http link that the anchor should point to
*/
private void makeValidLink(Anchor link, String linktext) {
if (linktext == null) {
link.setText("N/A");
} else {
if (linktext.isEmpty()) {
link.setText("N/A");
} else {
linktext = linktext.toLowerCase();
// Validate link format, fill in http part
if (!linktext.startsWith("http")) {
linktext = "http://" + linktext;
}
link.setText(linktext);
link.setHref(linktext);
link.setTarget("_blank");
}
}
}
示例6: PageIndexWidget
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
/**
* THe basic constructor
* @param searchData the original search object with the pageIndex field indicating he currently selected page
* @param pageIndex the page index is the index for which this page-index widget is created
* @param isEnabled true to create the widget in the enabled mode, false in the disabled
* @param siteSectionPrefix the history token site section prefix
*/
public PageIndexWidget( final ForumSearchData searchData, final int pageIndex,
final boolean isEnabled, final String siteSectionPrefix ) {
this.isCurrentPage = (searchData.pageIndex == pageIndex );
//Create a copy in order to be able to set the proper search object index and not spoil the original search object
final ForumSearchData localSearchData = searchData.clone();
localSearchData.pageIndex = pageIndex;
hyperLink = new Anchor("" + pageIndex, CommonResourcesContainer.URI_HASH_SYMBOL + siteSectionPrefix + localSearchData.serialize(encoder));
if( isCurrentPage ) {
hyperLink.addStyleName( CommonResourcesContainer.CURRENT_PAGE_INDEX_STYLE );
//the current page index widget is always disabled
setEnabled( false );
} else {
//Set the link as enabled/disabled
setEnabled( isEnabled );
}
initWidget(hyperLink);
}
示例7: setEntity
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
@Override
public void setEntity(Synonym synonym) {
this.synonym = synonym;
Term term = synonym.getTerm();
int row = 0;
grid.setText(row++, 1, term.getOntology().getName());
if(UrlValidator.validate(term.getUrl())) {
Anchor a = new Anchor(term.getName(), term.getUrl().trim());
a.setTarget("TermUrl");
grid.setWidget(row++, 1, a);
} else {
grid.setText(row++, 1, term.getName());
}
grid.setText(row++, 1, synonym.getSynonym());
typeDropBox.setSelectedIndex(synonym.getType().ordinal());
}
示例8: FilterItem
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
FilterItem(E filterEntity, ImageResource imageRes, String bgClass, String text) {
this.filterEntity = filterEntity;
anchor = new Anchor();
add(anchor);
Element span = DOM.createElement("span");
span.setInnerText(text);
DOM.insertChild(anchor.getElement(), span, 0);
span = DOM.createElement("span");
DOM.insertChild(anchor.getElement(), span, 0);
span.addClassName(Utils.sandboxStyle.icon());
span.addClassName(Utils.sandboxStyle.fa());
if (bgClass != null) {
Element b = DOM.createElement("b");
b.addClassName(bgClass);
DOM.insertChild(span, b, 0);
}
if (imageRes != null) {
Image image = new Image(imageRes);
image.setTitle(text);
DOM.insertChild(span, image.getElement(), 0);
}
}
示例9: NavLinkBar
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
public NavLinkBar() {
getElement().setId("nav_bar_help_login");
loginLogoutLink = new Anchor();
loginLogoutLink.getElement().setId("nav_bar_help_login_item");
helpPanelToggleButton = new HelpSlidePanelToggleButton();
helpPanelToggleButton.getElement().setId("nav_bar_help_login_item");
helpBookButton = new HelpBookToggleButton();
helpBookButton.getElement().setId("nav_bar_help_login_item");
helpBalloonsToggleButton = new HelpDialogsToggleButton();
helpBalloonsToggleButton.getElement().setId("nav_bar_help_login_item");
FlexTable layout = new FlexTable();
layout.setWidget(0, 0, loginLogoutLink);
layout.setWidget(0, 1, helpPanelToggleButton);
layout.setWidget(0, 2, helpBookButton);
layout.setWidget(0, 3, helpBalloonsToggleButton);
layout.setWidget(0, 4, new HTML(HtmlConsts.TAB));
add(layout);
}
示例10: AboutViewGwtImpl
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
public AboutViewGwtImpl() {
String appVersion = Consts.APP_VERSION;
String mailTo = "mailto:[email protected]?subject=Traffic Flow ";
email = new Anchor();
initWidget(uiBinder.createAndBindUi(this));
if (MGWT.getOsDetection().isAndroid()) {
leftFlexSpacer.setVisible(false);
scrollPanel.setBounce(false);
email.setHref(mailTo + "Android App v" + appVersion);
} else if (MGWT.getOsDetection().isIOs()) {
email.setHref(mailTo + "iPhone App v" + appVersion);
} else {
email.setHref(mailTo + "Mobile App v" + appVersion);
}
}
示例11: appendChilds
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
private void appendChilds(TreeWidget rootEnt, JSONArray children) {
for (int i = 0; i < children.size(); ++i) {
nextEntityName = children.get(i).isString().stringValue();
Anchor a = new Anchor(nextEntityName + " (" + entities.get(nextEntityName).getLeft() + ")");
a.setWidth("100%");
a.setStyleName("font");
a.addClickHandler(new ClickHandler() {
String name = nextEntityName;
@Override
public void onClick(ClickEvent event) {
module.setSelectedEntity(name);
}
});
HorizontalPanel cPanel = new HorizontalPanel();
cPanel.setStyleName("tree");
cPanel.setWidth("100%");
cPanel.add(a);
TreeWidget c = new TreeWidget(cPanel);
rootEnt.addChild(c);
if (children.size() > 0) appendChilds(c, entities.get(nextEntityName).getRight());
}
}
示例12: generateTree
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
private void generateTree(TreeWidget c, JSONValue entity) {
nextEntityName = entity.isObject().get("entity").isString().stringValue();
Anchor a = new Anchor(nextEntityName);
a.setWidth("100%");
a.setStyleName("font");
a.addClickHandler(new ClickHandler() {
String name = nextEntityName;
@Override
public void onClick(ClickEvent event) {
setSelectedEntity(name);
}
});
HorizontalPanel cPanel = new HorizontalPanel();
cPanel.setStyleName("tree");
cPanel.setWidth("100%");
cPanel.add(a);
TreeWidget cc = new TreeWidget(cPanel);
c.addChild(cc);
results.put(nextEntityName, entity.isObject().get("results").isArray());
entities.add(nextEntityName);
for (int i = 0; i < entity.isObject().get("children").isArray().size(); ++i) {
generateTree(cc, entity.isObject().get("children").isArray().get(i));
}
}
示例13: appendChilds
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
private void appendChilds(TreeWidget rootEnt, JSONArray children) {
for (int i = 0; i < children.size(); ++i) {
nextEntityName = children.get(i).isString().stringValue();
Anchor a = new Anchor(nextEntityName + " (" + entities.get(nextEntityName).getLeft() + ")");
a.setWidth("100%");
a.setStyleName("font");
a.addClickHandler(new ClickHandler() {
String name = nextEntityName;
@Override
public void onClick(ClickEvent event) {
setSelectedEntity(name);
}
});
HorizontalPanel cPanel = new HorizontalPanel();
cPanel.setStyleName("tree");
cPanel.setWidth("100%");
cPanel.add(a);
TreeWidget c = new TreeWidget(cPanel);
rootEnt.addChild(c);
if (children.size() > 0) appendChilds(c, entities.get(nextEntityName).getRight());
}
}
示例14: AlertStackWidget
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
public AlertStackWidget() {
alertWidgets = new ArrayList<AlertWidget>();
VerticalPanel rootPanel = new VerticalPanel();
rootPanel.setWidth("100%");
alertsPanel = new VerticalPanel();
alertsPanel.setWidth("100%");
rootPanel.add(alertsPanel);
showHideAnchor = new Anchor(
I18nUtils.tr(visible ? "hide.alerts" : "show.alerts"));
showHideAnchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
visible = !visible;
alertsPanel.setVisible(visible);
showHideAnchor.setText(
I18nUtils.tr(visible ? "hide.alerts" : "show.alerts"));
}
});
showHideAnchor.addStyleName("alert-showhide-link");
showHideAnchor.setVisible(false);
rootPanel.add(showHideAnchor);
initWidget(rootPanel);
}
示例15: populate
import com.google.gwt.user.client.ui.Anchor; //导入依赖的package包/类
protected void populate(int row, DashboardInfo k) {
if (k.isDefault()) {
table.setWidget(row, 1, new Image(Gerrit.RESOURCES.greenCheck()));
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.getElement(row, 1).setTitle(Util.C.dashboardDefaultToolTip());
}
table.setWidget(
row,
2,
new Anchor(
k.path(),
"#" + PageLinks.toProjectDashboard(new Project.NameKey(k.project()), k.id())));
table.setText(row, 3, k.title() != null ? k.title() : k.path());
table.setText(row, 4, k.description());
if (k.definingProject() != null && !k.definingProject().equals(k.project())) {
table.setWidget(
row,
5,
new Anchor(
k.definingProject(),
"#" + PageLinks.toProjectDashboards(new Project.NameKey(k.definingProject()))));
}
setRowItem(row, k);
}