gpt4 book ai didi

com.google.gwt.uibinder.rebind.XMLElement.hasAttribute()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 08:01:05 26 4
gpt4 key购买 nike

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

XMLElement.hasAttribute介绍

[英]Determines whether the element has a given attribute.
[中]确定元素是否具有给定属性。

代码示例

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

private boolean hasCurrency(XMLElement elem) {
 return elem.hasAttribute("currencyData")
   || elem.hasAttribute("currencyCode");
}

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

private boolean hasTimeZone(XMLElement elem) {
 return elem.hasAttribute("timezone") || elem.hasAttribute("timezoneOffset");
}

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

public String interpretElement(XMLElement elem)
   throws UnableToCompleteException {
  String fieldName = writer.declareFieldIfNeeded(elem);
  if (fieldName != null) {
   String token = writer.declareDomField(elem, fieldName, element);

   if (elem.hasAttribute("id")) {
    writer.die(elem, String.format(
      "Cannot declare id=\"%s\" and %s=\"%s\" on the same element",
      elem.consumeRawAttribute("id"), writer.getUiFieldAttributeName(),
      fieldName));
   }

   elem.setAttribute("id", token);
  }

  /*
   * Return null because we don't want to replace the dom element with any
   * particular string (though we may have consumed its id or gwt:field)
   */
  return null;
 }
}

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

if (cellElem.hasAttribute(HALIGN_ATTR)) {
 String value = cellElem.consumeAttribute(HALIGN_ATTR, hAlignConstantType);
 writer.addStatement("%1$s.setCellHorizontalAlignment(%2$s, %3$s);",
if (cellElem.hasAttribute(VALIGN_ATTR)) {
 String value = cellElem.consumeAttribute(VALIGN_ATTR, vAlignConstantType);
 writer.addStatement("%1$s.setCellVerticalAlignment(%2$s, %3$s);",
if (cellElem.hasAttribute(WIDTH_ATTR)) {
 String value = cellElem.consumeStringAttribute(WIDTH_ATTR);
 writer.addStatement("%1$s.setCellWidth(%2$s, %3$s);", fieldName,
if (cellElem.hasAttribute(HEIGHT_ATTR)) {
 String value = cellElem.consumeStringAttribute(HEIGHT_ATTR);
 writer.addStatement("%1$s.setCellHeight(%2$s, %3$s);", fieldName,

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

public Boolean interpretElement(XMLElement child)
   throws UnableToCompleteException {
  // CustomButton can only contain Face elements.
  String ns = child.getNamespaceUri();
  String faceName = child.getLocalName();
  if (!ns.equals(elem.getNamespaceUri())) {
   writer.die(elem, "Invalid child namespace: %s", ns);
  }
  if (!faceNames.contains(faceName)) {
   writer.die(elem, "Invalid CustomButton face: %s:%s", ns, faceName);
  }
  HtmlInterpreter interpreter = HtmlInterpreter.newInterpreterForUiObject(
    writer, fieldName);
  String innerHtml = child.consumeInnerHtml(interpreter);
  if (innerHtml.length() > 0) {
   writer.addStatement("%s.%s().setHTML(%s);", fieldName,
     faceNameGetter(faceName), writer.declareTemplateCall(innerHtml,
       fieldName));
  }
  if (child.hasAttribute("image")) {
   String image = child.consumeImageResourceAttribute("image");
   writer.addStatement("%s.%s().setImage(new %s(%s));", fieldName,
     faceNameGetter(faceName), IMAGE_CLASS, image);
  }
  return true; // We consumed it
 }
});

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

public String interpretElement(XMLElement elem)
  throws UnableToCompleteException {
 // Must be in the format: <ui:string from="{myMsg.message}" />
 if (writer.isBinderElement(elem) && getLocalName().equals(elem.getLocalName())) {
  if (!elem.hasAttribute("from")) {
   logger.die(elem, "Attribute 'from' not found.");
  }
  if (!elem.getAttribute("from").hasComputedValue()) {
   logger.die(elem, "Attribute 'from' does not have a computed value");
  }
  // Make sure all computed attributes are interpreted first
  computedAttributeInterpreter.interpretElement(elem);
    String fieldRef = elem.consumeStringAttribute("from");
  // Make sure that "from" was the only attribute
  elem.assertNoAttributes();
  return "\" + " + fieldRef + " + \"";
 }
 return null;
}

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

if (!child.hasAttribute("direction")) {
 writer.die(elem, "Dock must specify the 'direction' attribute");

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

private boolean hasCurrency(XMLElement elem) {
 return elem.hasAttribute("currencyData")
   || elem.hasAttribute("currencyCode");
}

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

private boolean hasCurrency(XMLElement elem) {
 return elem.hasAttribute("currencyData")
   || elem.hasAttribute("currencyCode");
}

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

private boolean hasTimeZone(XMLElement elem) {
 return elem.hasAttribute("timezone") || elem.hasAttribute("timezoneOffset");
}

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

if (elem.hasAttribute("vertical")) {
 String vertical = elem.consumeBooleanAttribute("vertical");
 writer.setFieldInitializerAsConstructor(fieldName, vertical);

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

private boolean hasTimeZone(XMLElement elem) {
 return elem.hasAttribute("timezone") || elem.hasAttribute("timezoneOffset");
}

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

public void parse(XMLElement elem, String fieldName, JClassType type,
   UiBinderWriter writer) throws UnableToCompleteException {
  // Parse children.
  for (XMLElement child : elem.consumeChildElements()) {
   if (!writer.isWidgetElement(child)) {
    writer.die(child, "Widget required");
   }
   
   // Stack panel label comes from the StackPanel-text attribute of the child
   String stackItemLabel = null;
   String variableAttributeName = elem.getPrefix() + ":" + ATTRIBUTE_TEXT;
   if (child.hasAttribute(variableAttributeName)) {
    stackItemLabel = child.consumeRawAttribute(variableAttributeName);
   }

   FieldWriter childField = writer.parseElementToField(child);
   if (stackItemLabel == null) {
    writer.addStatement("%1$s.add(%2$s);", fieldName,
      childField.getNextReference());
   } else {
    writer.addStatement("%1$s.add(%2$s, \"%3$s\");", fieldName,
      childField.getNextReference(), stackItemLabel);
   }
  }
 }
}

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

public boolean isConsumed() {
 return !xmlElem.hasAttribute(w3cAttr.getName());
}

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

public boolean isConsumed() {
 return !xmlElem.hasAttribute(w3cAttr.getName());
}

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

/**
 * Confirm existence of an m:blah attribute on a non-message element, e.g.
 * {@code <span ui:ph="fnord"/>}
 */
public boolean hasMessageAttribute(String attName, XMLElement elem) {
 String fullAttName = getMessagesPrefix() + ":" + attName;
 return elem.hasAttribute(fullAttName);
}

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

/**
 * Confirm existence of an m:blah attribute on a non-message element, e.g.
 * {@code <span ui:ph="fnord"/>}
 */
public boolean hasMessageAttribute(String attName, XMLElement elem) {
 String fullAttName = getMessagesPrefix() + ":" + attName;
 return elem.hasAttribute(fullAttName);
}

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

private JClassType consumeTypeAttribute(XMLElement elem)
  throws UnableToCompleteException {
 if (!elem.hasAttribute(TYPE_ATTRIBUTE)) {
  return null;
 }
 String resourceTypeName = elem.consumeRawAttribute(TYPE_ATTRIBUTE);
 JClassType resourceType = oracle.findType(resourceTypeName);
 if (resourceType == null) {
  writer.die(elem, "No such type %s", resourceTypeName);
 }
 return resourceType;
}

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

private JClassType consumeTypeAttribute(XMLElement elem)
  throws UnableToCompleteException {
 if (!elem.hasAttribute(TYPE_ATTRIBUTE)) {
  return null;
 }
 String resourceTypeName = elem.consumeRawAttribute(TYPE_ATTRIBUTE);
 JClassType resourceType = oracle.findType(resourceTypeName);
 if (resourceType == null) {
  writer.die(elem, "No such type %s", resourceTypeName);
 }
 return resourceType;
}

代码示例来源:origin: laaglu/lib-gwt-svg

/**
 * Like {@link #consumeAttributeWithDefault(String, String, JType)}, but
 * accommodates more complex type signatures.
 */
public String consumeAttributeWithDefault(String name, String defaultValue, JType... types)
  throws UnableToCompleteException {
 if (!hasAttribute(name)) {
  if (defaultValue != null) {
   designTime.putAttribute(this, name + ".default", defaultValue);
  }
  return defaultValue;
 }
 AttributeParser parser = attributeParsers.getParser(types);
 return consumeAttributeWithParser(name, parser);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com