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

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

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

XMLElement.consumeRawAttribute介绍

[英]Consumes the given attribute and returns its trimmed value, or null if it was unset. The returned string is not escaped.
[中]使用给定属性并返回其修剪后的值,如果未设置,则返回null。返回的字符串不会被转义。

代码示例

代码示例来源: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

String format = elem.consumeAttribute("format",
  writer.getOracle().findType(NumberFormat.class.getCanonicalName()));
String predefinedFormat = elem.consumeRawAttribute("predefinedFormat");
String customFormat = elem.consumeStringAttribute("customFormat");

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

writer.die(elem, "Dock must specify the 'direction' attribute");
String value = child.consumeRawAttribute("direction");
String translated = values.get(value);
if (translated == null) {

代码示例来源: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 String consumeRawValue() {
 return xmlElem.consumeRawAttribute(w3cAttr.getName());
}

代码示例来源:origin: org.vectomatic/lib-gwt-svg

/**
 * Consumes the named attribute and parses it to an unparsed, unescaped array
 * of Strings. The strings in the attribute may be comma or space separated
 * (or a mix of both).
 * 
 * @return array of String, empty if the attribute was not set.
 */
public String[] consumeRawArrayAttribute(String name) {
 String raw = consumeRawAttribute(name, null);
 if (raw == null) {
  return EMPTY;
 }
 return raw.split("[,\\s]+");
}

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

/**
 * Consumes the named attribute, or dies if it is missing.
 */
public String consumeRequiredRawAttribute(String name) throws UnableToCompleteException {
 String value = consumeRawAttribute(name);
 if (value == null) {
  failRequired(name);
 }
 return value;
}

代码示例来源:origin: org.vectomatic/lib-gwt-svg

/**
 * Consumes the named attribute, or dies if it is missing.
 */
public String consumeRequiredRawAttribute(String name) throws UnableToCompleteException {
 String value = consumeRawAttribute(name);
 if (value == null) {
  failRequired(name);
 }
 return value;
}

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

/**
 * Consumes the named attribute, or dies if it is missing.
 */
public String consumeRequiredRawAttribute(String name) throws UnableToCompleteException {
 String value = consumeRawAttribute(name);
 if (value == null) {
  failRequired(name);
 }
 return value;
}

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

private JClassType consumeCssResourceType(XMLElement elem)
  throws UnableToCompleteException {
 String typeName = elem.consumeRawAttribute(TYPE_ATTRIBUTE, null);
 if (typeName == null) {
  return cssResourceType;
 }
 return findCssResourceType(elem, typeName);
}

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

private JClassType consumeCssResourceType(XMLElement elem)
  throws UnableToCompleteException {
 String typeName = elem.consumeRawAttribute(TYPE_ATTRIBUTE, null);
 if (typeName == null) {
  return cssResourceType;
 }
 return findCssResourceType(elem, typeName);
}

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

/**
 * Consumes the named attribute, or dies if it is missing.
 */
public String consumeRequiredRawAttribute(String name) throws UnableToCompleteException {
 String value = consumeRawAttribute(name);
 if (value == null) {
  failRequired(name);
 }
 return value;
}

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

/**
 * Consume an m:blah attribute on a non-message element, e.g.
 * {@code <span m:ph="fnord"/>}
 * 
 * @param attName name of the attribute (to be prefixed with "msgprefix:")
 * @param elem element to search
 * @param defaultValue default value to return if the attribute is not present
 * @return attribute value, or {@code defaultValue} if not found
 */
public String consumeMessageAttribute(String attName, XMLElement elem, String defaultValue) {
 String fullAttName = getMessagesPrefix() + ":" + attName;
 return elem.consumeRawAttribute(fullAttName, defaultValue);
}

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

/**
 * Consume an m:blah attribute on a non-message element, e.g.
 * {@code <span m:ph="fnord"/>}
 * 
 * @param attName name of the attribute (to be prefixed with "msgprefix:")
 * @param elem element to search
 * @param defaultValue default value to return if the attribute is not present
 * @return attribute value, or {@code defaultValue} if not found
 */
public String consumeMessageAttribute(String attName, XMLElement elem, String defaultValue) {
 String fullAttName = getMessagesPrefix() + ":" + attName;
 return elem.consumeRawAttribute(fullAttName, defaultValue);
}

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

private String consumeAttributeWithParser(String name, AttributeParser parser)
  throws UnableToCompleteException {
 String value = parser.parse(this, consumeRawAttribute(name));
 designTime.putAttribute(this, name, value);
 return value;
}

代码示例来源:origin: org.vectomatic/lib-gwt-svg

private String consumeAttributeWithParser(String name, AttributeParser parser)
  throws UnableToCompleteException {
 String value = parser.parse(this, consumeRawAttribute(name));
 designTime.putAttribute(this, name, value);
 return value;
}

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

private String consumeAttributeWithParser(String name, AttributeParser parser)
  throws UnableToCompleteException {
 String value = parser.parse(this, consumeRawAttribute(name));
 designTime.putAttribute(this, name, value);
 return value;
}

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

private String consumeAttributeWithParser(String name, AttributeParser parser)
  throws UnableToCompleteException {
 String value = parser.parse(this, consumeRawAttribute(name));
 designTime.putAttribute(this, name, value);
 return value;
}

代码示例来源: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;
}

相关文章

XMLElement类方法