com.google.gwt.user.client.ui.Hyperlink类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中com.google.gwt.user.client.ui.Hyperlink类的一些代码示例,展示了Hyperlink类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hyperlink类的具体详情如下:
包路径:com.google.gwt.user.client.ui.Hyperlink
类名称:Hyperlink

Hyperlink介绍

[英]A widget that serves as an "internal" hyperlink. That is, it is a link to another state of the running application. When clicked, it will create a new history frame using com.google.gwt.user.client.History#newItem, but without reloading the page.

If you want an HTML hyperlink (<a> tag) without interacting with the history system, use Anchor instead.

Being a true hyperlink, it is also possible for the user to "right-click, open link in new window", which will cause the application to be loaded in a new window at the state specified by the hyperlink.

Built-in Bidi Text Support

This widget is capable of automatically adjusting its direction according to its content. This feature is controlled by #setDirectionEstimator or passing a DirectionEstimator parameter to the constructor, and is off by default.

CSS Style Rules

  • .gwt-Hyperlink { }

Example

com.google.gwt.examples.HistoryExample
[中]用作“内部”超链接的小部件。也就是说,它是指向正在运行的应用程序的另一个状态的链接。单击时,它将使用com创建一个新的历史框架。谷歌。gwt。使用者客户历史记录#新建项,但不重新加载页面。
如果希望HTML超链接(<a>标记)不与历史记录系统交互,请改用锚定。
作为真正的超链接,用户还可以“右键单击,在新窗口中打开链接”,这将导致应用程序以超链接指定的状态加载到新窗口中。
####内置Bidi文本支持
此小部件能够根据其内容自动调整其方向。此功能由#setDirectionStimator控制,或将DirectionStimator参数传递给构造函数,默认情况下关闭。
####CSS样式规则

  • .gwt超链接{}
    ####范例
    通用域名格式。谷歌。gwt。例子。历史例子

代码示例

代码示例来源:origin: stackoverflow.com

Hyperlink link = new Hyperlink();
Image image = new Image(someUrl);
...
link.getElement().appendChild(image.getElement());

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Creates a hyperlink with its text and target history token specified.
 *
 * @param text the hyperlink's text
 * @param asHTML <code>true</code> to treat the specified text as html
 * @param targetHistoryToken the history token to which it will link
 * @see #setTargetHistoryToken
 */
public Hyperlink(@IsSafeHtml String text, boolean asHTML, String targetHistoryToken) {
 this();
 directionalTextHelper.setTextOrHtml(text, asHTML);
 setTargetHistoryToken(targetHistoryToken);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * @deprecated Use {@link Anchor#addClickHandler} instead and call
 *     History.newItem from the handler if you need to process the
 *     click before the history token is set.
 */
@Deprecated
public HandlerRegistration addClickHandler(ClickHandler handler) {
 return addHandler(handler, ClickEvent.getType());
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
  * <b>Affected Elements:</b>
  * <ul>
  * <li>-wrapper = the div around the link.</li>
  * </ul>
  * 
  * @see UIObject#onEnsureDebugId(String)
  */
 @Override
 protected void onEnsureDebugId(String baseID) {
  ensureDebugId(anchorElem, "", baseID);
  ensureDebugId(getElement(), baseID, "wrapper");
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

protected Hyperlink(Element elem) {
 if (elem == null) {
  setElement(anchorElem);
 } else {
  setElement(elem);
  DOM.appendChild(getElement(), anchorElem);
 }
 sinkEvents(Event.ONCLICK);
 setStyleName("gwt-Hyperlink");
 directionalTextHelper = new DirectionalTextHelper(anchorElem,
   /* is inline */ true);
}

代码示例来源:origin: org.kuali.student.core/ks-common-ui

private static void createLink(String name, final String viewPath){
  Hyperlink link = new Hyperlink(name, viewPath);
  links.add(link);
  addToPanel(link);
}

代码示例来源:origin: org.kuali.student.core/ks-common-ui

/**
 * Use this when you simply want to Navigate to other internal, KS screens.
 * @param text - label
 * @param location - relative internal path to screen
 */
public void addNavLinkWidget(String text, String location){
  Hyperlink hyperlink = new Hyperlink(text, location);
  hyperlink.addStyleName("contentBlock-navLink");
  listLayout.add(hyperlink);
}

代码示例来源:origin: org.switchyard.console.wildfly/switchyard-console-wildfly-extension

@Override
public void setValue(T value) {
  _link.setText(_valueAdapter.getText(value));
  _link.setTargetHistoryToken(_valueAdapter.getTargetHistoryToken(value));
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public void onBrowserEvent(Event event) {
 super.onBrowserEvent(event);
 if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
  History.newItem(getTargetHistoryToken());
  event.preventDefault();
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public void setHTML(SafeHtml html) {
 setHTML(html.asString());
}

代码示例来源:origin: net.wetheinter/gwt-user

protected Hyperlink(Element elem) {
 if (elem == null) {
  setElement(anchorElem);
 } else {
  setElement(elem);
  DOM.appendChild(getElement(), anchorElem);
 }
 sinkEvents(Event.ONCLICK);
 setStyleName("gwt-Hyperlink");
 directionalTextHelper = new DirectionalTextHelper(anchorElem,
   /* is inline */ true);
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
  * <b>Affected Elements:</b>
  * <ul>
  * <li>-wrapper = the div around the link.</li>
  * </ul>
  * 
  * @see UIObject#onEnsureDebugId(String)
  */
 @Override
 protected void onEnsureDebugId(String baseID) {
  ensureDebugId(anchorElem, "", baseID);
  ensureDebugId(getElement(), baseID, "wrapper");
 }
}

代码示例来源:origin: org.switchyard.console.wildfly/switchyard-console-wildfly-extension

/**
 * Create a new ClickableTextItem.
 * 
 * @param name the name of the bean member.
 * @param title the label text.
 * @param valueAdapter the adapter for the field value.
 */
public ClickableTextItem(String name, String title, ValueAdapter<T> valueAdapter) {
  super(name, title);
  _link = new Hyperlink();
  _valueAdapter = valueAdapter;
  resetMetaData();
}

代码示例来源:origin: org.eagle-i/eagle-i-search-gwt

public void setReferences(final Map<EIEntity, List<EIInstanceMinimal>> listReferences) {
    setVisible( false );
    if ( listReferences == null || listReferences.size() == 0 ) {
      return;
    }
    linksPanel.clear();

    final List<EIEntity> instanceTypes = new LinkedList<EIEntity>( listReferences.keySet() );
    Collections.sort( instanceTypes );
    for (final EIEntity instanceType : instanceTypes) {
      final String rootTypeString = EIOntPlurals.plurals.containsKey( instanceType.getLabel() ) ? EIOntPlurals.plurals.get( instanceType.getLabel() ) : instanceType.getLabel();
      final Label rootTypeLabel = new Label( rootTypeString );
      rootTypeLabel.setStyleName( "relatedResourcesGroupTitle" );
      linksPanel.add( rootTypeLabel );
      final List<EIInstanceMinimal> references = listReferences.get( instanceType );
      Collections.sort( references );
      for (final EIInstanceMinimal eiInstanceMinimal : references) {
        final Hyperlink instanceLink = new Hyperlink( InstanceWidgetUtils.formatText( eiInstanceMinimal.getInstanceLabel() ),
            INSTANCE_PAGE_TOKEN + "?" + URI_KEY + "=" + eiInstanceMinimal.getInstanceURI().toString() );
        linksPanel.add( instanceLink );
        instanceLink.addStyleName( "link" );
      }
    }
    setVisible( true );
  }
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
public void onBrowserEvent(Event event) {
 super.onBrowserEvent(event);
 if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
  History.newItem(getTargetHistoryToken());
  event.preventDefault();
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

public void setHTML(SafeHtml html) {
 setHTML(html.asString());
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

protected Hyperlink(Element elem) {
 if (elem == null) {
  setElement(anchorElem);
 } else {
  setElement(elem);
  DOM.appendChild(getElement(), anchorElem);
 }
 sinkEvents(Event.ONCLICK);
 setStyleName("gwt-Hyperlink");
 directionalTextHelper = new DirectionalTextHelper(anchorElem,
   /* is inline */ true);
}

代码示例来源:origin: stackoverflow.com

Hyperlink link = new Hyperlink();
Image image = new Image(someUrl);
...
link.getElement().getFirstChild().appendChild(image.getElement());

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
  * <b>Affected Elements:</b>
  * <ul>
  * <li>-wrapper = the div around the link.</li>
  * </ul>
  * 
  * @see UIObject#onEnsureDebugId(String)
  */
 @Override
 protected void onEnsureDebugId(String baseID) {
  ensureDebugId(anchorElem, "", baseID);
  ensureDebugId(getElement(), baseID, "wrapper");
 }
}

代码示例来源:origin: de.esoco/gewt

/***************************************
   * {@inheritDoc}
   */
  @Override
  @SuppressWarnings("unchecked")
  public W createWidget(Component rComponent, StyleData rStyle)
  {
    Widget aWidget = null;
    if (rStyle.hasFlag(StyleFlag.HYPERLINK))
    {
      aWidget = new Hyperlink();
    }
    else
    {
      LabelStyle eLabelStyle =
        rStyle.getProperty(UserInterfaceProperties.LABEL_STYLE,
                  LabelStyle.DEFAULT);
      aWidget = createLabelWidget(rComponent, eLabelStyle, rStyle);
    }
    return (W) aWidget;
  }
}

相关文章