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

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

本文整理了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

  1. @Override
  2. protected com.google.gwt.user.client.Element getContainerElement() {
  3. return inner.cast();
  4. }
  5. }

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

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

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

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

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

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

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

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

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

  1. /**
  2. * This constructor may be used by subclasses to explicitly use an existing
  3. * element. This element must be a &lt;textarea&gt; element.
  4. *
  5. * @param element the element to be used
  6. */
  7. protected TextArea(Element element) {
  8. super(element.<Element>cast());
  9. TextAreaElement.as(element);
  10. }

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

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

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

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

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

  1. /**
  2. * Assert that the builder is in a state where an attribute can be added.
  3. *
  4. * @return the element on which the attribute can be set
  5. */
  6. protected E assertCanAddAttribute() {
  7. /*
  8. * An explicit parameterized return type on cast() is required by some javac
  9. * compilers.
  10. */
  11. return delegate.assertCanAddAttribute().<E> cast();
  12. }

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

  1. @Override
  2. protected InputElement getInputElement(Element parent) {
  3. return super.getInputElement(parent).<InputElement> cast();
  4. }
  5. }

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public void setFocus(Element parent, boolean focused) {
  3. Element focusable = parent.getFirstChildElement().cast();
  4. if (focused) {
  5. focusable.focus();
  6. } else {
  7. focusable.blur();
  8. }
  9. }
  10. }

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

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

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

  1. @Override
  2. protected void onFocus() {
  3. TableCellElement td = getKeyboardSelectedTableCellElement();
  4. if (td != null) {
  5. TableRowElement tr = td.getParentElement().cast();
  6. td.addClassName(style.keyboardSelectedCell());
  7. setRowStyleName(tr, style.keyboardSelectedRow(), style.keyboardSelectedRowCell(), true);
  8. }
  9. }

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

  1. @Override
  2. protected void onBlur() {
  3. TableCellElement td = getKeyboardSelectedTableCellElement();
  4. if (td != null) {
  5. TableRowElement tr = td.getParentElement().cast();
  6. td.removeClassName(style.keyboardSelectedCell());
  7. setRowStyleName(tr, style.keyboardSelectedRow(), style.keyboardSelectedRowCell(), false);
  8. }
  9. }

相关文章

Element类方法