com.google.gwt.dom.client.Element.cast()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(152)

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

Element.cast介绍

暂无

代码示例

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

@Override
 protected com.google.gwt.user.client.Element getContainerElement() {
  return inner.cast();
 }
}

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

/**
 * Gets the src attribute of an img element. This method is paired with
 * {@link #setImgSrc(Element, String)} so that it always returns the correct
 * url.
 * 
 * @param img a non-null img whose src attribute is to be read.
 * @return the src url of the img
 */
public static String getImgSrc(Element img) {
 return img.<ImageElement> cast().getSrc();
}

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

/**
  * This constructor may be used by subclasses to explicitly use an existing
  * element. This element must be a &lt;button&gt; element with type reset.
  * 
  * @param element the element to be used
  */
 protected ResetButton(com.google.gwt.dom.client.Element element) {
  super(element);
  assert "reset".equalsIgnoreCase(element.<ButtonElement> cast().getType());
 }
}

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

/**
 * If given a PotentialElement, returns the real Element to be
 * built from it. Otherwise returns the given Element itself.
 * <p>
 * Note that a PotentialElement can only be resolved once.
 * Making repeated calls to this method with the same PotentialElement
 * is an error.
 */
public static Element resolve(Element maybePotential) {
 return maybePotential.<PotentialElement>cast().resolve();
}

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

/**
 * Sets the src attribute of an img element. This method ensures that imgs
 * only ever have their contents requested one single time from the server.
 * 
 * @param img a non-null img whose src attribute will be set.
 * @param src a non-null url for the img
 */
public static void setImgSrc(Element img, String src) {
 img.<ImageElement> cast().setSrc(src);
}

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

/**
 * This constructor may be used by subclasses to explicitly use an existing
 * element. This element must be a &lt;textarea&gt; element.
 *
 * @param element the element to be used
 */
protected TextArea(Element element) {
 super(element.<Element>cast());
 TextAreaElement.as(element);
}

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

/**
  * This constructor may be used by subclasses to explicitly use an existing
  * element. This element must be a &lt;button&gt; element with type submit.
  * 
  * @param element the element to be used
  */
 protected SubmitButton(com.google.gwt.dom.client.Element element) {
  super(element);
  assert "submit".equalsIgnoreCase(element.<ButtonElement> cast().getType());
 }
}

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

/**
 * This constructor may be used by subclasses to explicitly use an existing
 * element. This element must be a &lt;button&gt; element.
 * 
 * @param element the element to be used
 */
protected Button(com.google.gwt.dom.client.Element element) {
 super(element.<Element> cast());
 ButtonElement.as(element);
}

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

/**
 * Assert that the builder is in a state where an attribute can be added.
 * 
 * @return the element on which the attribute can be set
 */
protected E assertCanAddAttribute() {
 /*
  * An explicit parameterized return type on cast() is required by some javac
  * compilers.
  */
 return delegate.assertCanAddAttribute().<E> cast();
}

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

@Override
 protected InputElement getInputElement(Element parent) {
  return super.getInputElement(parent).<InputElement> cast();
 }
}

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

@Override
public ImageElement getImageElement(Image image) {
 return impl.getImgElement(image).cast();
}

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

/**
 * Creates an HTML OPTIONS element.
 * 
 * @return the newly-created element
 * @deprecated there is no "options" element; use {@link #createOption()}
 *             instead
 */
@Deprecated
public static com.google.gwt.user.client.Element createOptions() {
 return Document.get().createElement("options").cast();
}

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

/**
 * Creates an HTML element.
 * 
 * @param tagName the HTML tag of the element to be created
 * @return the newly-created element
 */
public static com.google.gwt.user.client.Element createElement(String tagName) {
 return Document.get().createElement(tagName).cast();
}

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

@Override
protected com.google.gwt.user.client.Element getContainerElement() {
 return impl.getContainerElement(getPopupImplElement()).cast();
}

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

@Override
protected com.google.gwt.user.client.Element getStyleElement() {
 return impl.getStyleElement(getPopupImplElement()).cast();
}

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

/**
 * Sets the option text of the given select object.
 * 
 * @param select the select object whose option text is being set
 * @param text the text to set
 * @param index the index of the option whose text should be set
 */
public static void setOptionText(Element select, String text, int index) {
 select.<SelectElement> cast().getOptions().getItem(index).setText(text);
}

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

@Override
 public void setFocus(Element parent, boolean focused) {
  Element focusable = parent.getFirstChildElement().cast();
  if (focused) {
   focusable.focus();
  } else {
   focusable.blur();
  }
 }
}

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

private void showImage(TreeItem treeItem, AbstractImagePrototype proto) {
 Element holder = treeItem.getImageHolderElement();
 Element child = DOM.getFirstChild(holder);
 if (child == null) {
  // If no image element has been created yet, create one from the
  // prototype.
  DOM.appendChild(holder, proto.createElement().<Element> cast());
 } else {
  // Otherwise, simply apply the prototype to the existing element.
  proto.applyTo(child.<ImagePrototypeElement> cast());
 }
}

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

@Override
protected void onFocus() {
 TableCellElement td = getKeyboardSelectedTableCellElement();
 if (td != null) {
  TableRowElement tr = td.getParentElement().cast();
  td.addClassName(style.keyboardSelectedCell());
  setRowStyleName(tr, style.keyboardSelectedRow(), style.keyboardSelectedRowCell(), true);
 }
}

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

@Override
protected void onBlur() {
 TableCellElement td = getKeyboardSelectedTableCellElement();
 if (td != null) {
  TableRowElement tr = td.getParentElement().cast();
  td.removeClassName(style.keyboardSelectedCell());
  setRowStyleName(tr, style.keyboardSelectedRow(), style.keyboardSelectedRowCell(), false);
 }
}

相关文章

微信公众号

最新文章

更多

Element类方法