com.google.gwt.user.client.ui.Widget.asWidgetOrNull()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(132)

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

Widget.asWidgetOrNull介绍

[英]This convenience method makes a null-safe call to IsWidget#asWidget().
[中]这个方便的方法对IsWidget#asWidget()进行空安全调用。

代码示例

代码示例来源:origin: fr.putnami.pwt/pwt

public void append(IsWidget child) {
  this.add(Widget.asWidgetOrNull(child), this.element);
}

代码示例来源:origin: Putnami/putnami-web-toolkit

public void append(IsWidget child) {
  this.add(Widget.asWidgetOrNull(child), this.element);
}

代码示例来源:origin: Putnami/putnami-web-toolkit

@UiChild(tagname = "left")
public void addLeft(IsWidget w) {
  StyleUtils.addStyle(Widget.asWidgetOrNull(w), Navbar.STYLE_NAVBAR_LEFT);
  this.add(w);
}

代码示例来源:origin: fr.putnami.pwt/pwt

@UiChild(tagname = "Brand")
public void addBrand(Widget w) {
  StyleUtils.addStyle(Widget.asWidgetOrNull(w), Navbar.STYLE_BRAND);
  this.headerContainer.add(w);
}

代码示例来源:origin: fr.putnami.pwt/pwt

@UiChild(tagname = "left")
public void addLeft(IsWidget w) {
  StyleUtils.addStyle(Widget.asWidgetOrNull(w), Navbar.STYLE_NAVBAR_LEFT);
  this.add(w);
}

代码示例来源:origin: Putnami/putnami-web-toolkit

@UiChild(tagname = "Brand")
public void addBrand(Widget w) {
  StyleUtils.addStyle(Widget.asWidgetOrNull(w), Navbar.STYLE_BRAND);
  this.headerContainer.add(w);
}

代码示例来源:origin: fr.putnami.pwt/pwt

@UiChild(tagname = "right")
public void addRight(IsWidget w) {
  StyleUtils.addStyle(Widget.asWidgetOrNull(w), Navbar.STYLE_NAVBAR_RIGHT);
  this.add(w);
}

代码示例来源:origin: Putnami/putnami-web-toolkit

@UiChild(tagname = "right")
public void addRight(IsWidget w) {
  StyleUtils.addStyle(Widget.asWidgetOrNull(w), Navbar.STYLE_NAVBAR_RIGHT);
  this.add(w);
}

代码示例来源:origin: Putnami/putnami-web-toolkit

@Override
public void redraw() {
  this.clear();
  StyleUtils
    .toggleStyle(Widget.asWidgetOrNull(this.label), FormGroup.STYLE_SCREAN_READER, this.type == Layout.INLINE);
  this.addIfNotNull(this.label, 3, 0, false);
  boolean ro = isReadOnly();
  this.editor = this.editorProvider.getEditor(ro);
  initFocusableEditor();
  if (!Boolean.FALSE.equals(this.readonly)) {
    this.addIfNotNull(editor, 9, 0, true);
  } else {
    this.addIfNotNull(editor, 9, 0, true);
    this.addIfNotNull(this.error, 9, 3, true);
    this.addIfNotNull(this.help, 9, 3, true);
  }
}

代码示例来源:origin: fr.putnami.pwt/pwt

@Override
public void redraw() {
  this.clear();
  StyleUtils
    .toggleStyle(Widget.asWidgetOrNull(this.label), FormGroup.STYLE_SCREAN_READER, this.type == Layout.INLINE);
  this.addIfNotNull(this.label, 3, 0, false);
  boolean ro = isReadOnly();
  this.editor = this.editorProvider.getEditor(ro);
  initFocusableEditor();
  if (!Boolean.FALSE.equals(this.readonly)) {
    this.addIfNotNull(editor, 9, 0, true);
  } else {
    this.addIfNotNull(editor, 9, 0, true);
    this.addIfNotNull(this.error, 9, 3, true);
    this.addIfNotNull(this.help, 9, 3, true);
  }
}

代码示例来源:origin: fr.putnami.pwt/pwt

private void addIfNotNull(Editor e, int size, int offset, boolean wrap) {
  if (e instanceof IsWidget) {
    boolean wrapInCol = wrap;
    wrapInCol &= this.type == Layout.HORIZONTAL;
    Widget toAdd = Widget.asWidgetOrNull((IsWidget) e);
    if (wrapInCol) {
      GridColumn column = new GridColumn();
      column.add(toAdd);
      column.setSize(size);
      column.setOffset(offset);
      toAdd = column;
    }
    if (this.type == Layout.HORIZONTAL) {
      if (size > 0) {
        StyleUtils.addStyle(toAdd, new GridColumn.SizeStyle(GridColumn.PREFIX_SIZE_MD, size));
      }
      if (offset > 0) {
        StyleUtils.addStyle(toAdd, new GridColumn.OffsetStyle(GridColumn.PREFIX_OFFSET_MD, offset));
      }
    }
    this.append(toAdd);
  }
}

代码示例来源:origin: Putnami/putnami-web-toolkit

private void addIfNotNull(Editor e, int size, int offset, boolean wrap) {
  if (e instanceof IsWidget) {
    boolean wrapInCol = wrap;
    wrapInCol &= this.type == Layout.HORIZONTAL;
    Widget toAdd = Widget.asWidgetOrNull((IsWidget) e);
    if (wrapInCol) {
      GridColumn column = new GridColumn();
      column.add(toAdd);
      column.setSize(size);
      column.setOffset(offset);
      toAdd = column;
    }
    if (this.type == Layout.HORIZONTAL) {
      if (size > 0) {
        StyleUtils.addStyle(toAdd, new GridColumn.SizeStyle(GridColumn.PREFIX_SIZE_MD, size));
      }
      if (offset > 0) {
        StyleUtils.addStyle(toAdd, new GridColumn.OffsetStyle(GridColumn.PREFIX_OFFSET_MD, offset));
      }
    }
    this.append(toAdd);
  }
}

相关文章