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

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

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

XMLElement.consumeAttribute介绍

[英]Consumes the given attribute as a literal or field reference. The type parameter is required to determine how the value is parsed and validated.
[中]将给定属性用作文本或字段引用。类型参数是确定如何解析和验证值所必需的。

代码示例

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

private String consumeTimeZone(XMLElement elem, UiBinderWriter writer)
  throws UnableToCompleteException {
 String timeZone = elem.consumeAttribute("timezone",
   writer.getOracle().findType(TimeZone.class.getCanonicalName()));
 String timeZoneOffset = elem.consumeAttribute("timezoneOffset",
   getIntType(writer.getOracle()));
 if (timeZone != null && timeZoneOffset != null) {
  writer.die(elem, AT_MOST_ONE_SPECIFIED_TIME_ZONE);
 }
 if (timeZone != null) {
  return timeZone;
 }
 if (timeZoneOffset != null) {
  return TimeZone.class.getCanonicalName() + ".createTimeZone("
    + timeZoneOffset + ")";
 }
 return null;
}

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

private String consumeCurrency(XMLElement elem, UiBinderWriter writer)
  throws UnableToCompleteException {
 String currencyData = elem.consumeAttribute("currencyData",
   writer.getOracle().findType(CurrencyData.class.getCanonicalName()));
 String currencyCode = elem.consumeStringAttribute("currencyCode");
 if (currencyData != null && currencyCode != null) {
  writer.die(elem, AT_MOST_ONE_SPECIFIED_CURRENCY);
 }
 return currencyData != null ? currencyData : currencyCode;
}

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

private String consumeFormat(XMLElement elem, UiBinderWriter writer)
  throws UnableToCompleteException {
 String format = elem.consumeAttribute("format",
   writer.getOracle().findType(DateTimeFormat.class.getCanonicalName()));
 String predefinedFormat = elem.consumeAttribute("predefinedFormat",
   writer.getOracle().findType(PredefinedFormat.class.getCanonicalName()));
 String customFormat = elem.consumeStringAttribute("customFormat");
 if (format != null) {
  if (predefinedFormat != null || customFormat != null) {
   writer.die(elem, AT_MOST_ONE_SPECIFIED_FORMAT);
  }
  return format;
 }
 if (predefinedFormat != null) {
  if (customFormat != null) {
   writer.die(elem, AT_MOST_ONE_SPECIFIED_FORMAT);
  }
  return makeGetFormat(predefinedFormat);
 }
 if (customFormat != null) {
  return makeGetFormat(customFormat);
 }
 return null;
}

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

private String consumeFormat(XMLElement elem, UiBinderWriter writer)
  throws UnableToCompleteException {
 String format = elem.consumeAttribute("format",
   writer.getOracle().findType(NumberFormat.class.getCanonicalName()));
 String predefinedFormat = elem.consumeRawAttribute("predefinedFormat");

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

String value = cellElem.consumeAttribute(HALIGN_ATTR, hAlignConstantType);
writer.addStatement("%1$s.setCellHorizontalAlignment(%2$s, %3$s);",
  fieldName, childField.getNextReference(), value);
String value = cellElem.consumeAttribute(VALIGN_ATTR, vAlignConstantType);
writer.addStatement("%1$s.setCellVerticalAlignment(%2$s, %3$s);",
  fieldName, childField.getNextReference(), value);

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

/**
 * Convenience method for parsing the named attribute as a String value or
 * reference.
 * 
 * @return an expression that will evaluate to a String value in the generated
 *         code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeStringAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getStringType());
}

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

/**
 * Convenience method for parsing the named attribute as a boolean value or
 * reference.
 * 
 * @return an expression that will evaluate to a boolean value in the
 *         generated code, or null if there is no such attribute
 * 
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeBooleanAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getBooleanType());
}

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

/**
 * Convenience method for parsing the named attribute as an ImageResource
 * value or reference.
 * 
 * @return an expression that will evaluate to an ImageResource value in the
 *         generated code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeImageResourceAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getImageResourceType());
}

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

/**
 * Convenience method for parsing the named attribute as a boolean value or
 * reference.
 * 
 * @return an expression that will evaluate to a boolean value in the
 *         generated code, or null if there is no such attribute
 * 
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeBooleanAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getBooleanType());
}

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

/**
 * Convenience method for parsing the named attribute as an ImageResource
 * value or reference.
 * 
 * @return an expression that will evaluate to an ImageResource value in the
 *         generated code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeImageResourceAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getImageResourceType());
}

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

/**
 * Convenience method for parsing the named attribute as a boolean value or
 * reference.
 * 
 * @return an expression that will evaluate to a boolean value in the
 *         generated code, or null if there is no such attribute
 * 
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeBooleanAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getBooleanType());
}

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

/**
 * Convenience method for parsing the named attribute as a String value or
 * reference.
 * 
 * @return an expression that will evaluate to a String value in the generated
 *         code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeStringAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getStringType());
}

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

/**
 * Convenience method for parsing the named attribute as a
 * {@link com.google.gwt.safehtml.shared.SafeHtml SafeHtml} value or
 * reference.
 * 
 * @return an expression that will evaluate to a
 *         {@link com.google.gwt.safehtml.shared.SafeHtml SafeHtml} value in
 *         the generated code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeSafeHtmlAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getSafeHtmlType());
}

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

/**
 * Convenience method for parsing the named attribute as an ImageResource
 * value or reference.
 * 
 * @return an expression that will evaluate to an ImageResource value in the
 *         generated code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeImageResourceAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getImageResourceType());
}

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

/**
 * Convenience method for parsing the named attribute as a String value or
 * reference.
 * 
 * @return an expression that will evaluate to a String value in the generated
 *         code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeStringAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getStringType());
}

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

/**
 * Convenience method for parsing the named attribute as a String value or
 * reference.
 * 
 * @return an expression that will evaluate to a String value in the generated
 *         code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeStringAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getStringType());
}

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

/**
 * Convenience method for parsing the named attribute as a
 * {@link com.google.gwt.safehtml.shared.SafeHtml SafeHtml} value or
 * reference.
 * 
 * @return an expression that will evaluate to a
 *         {@link com.google.gwt.safehtml.shared.SafeHtml SafeHtml} value in
 *         the generated code, or null if there is no such attribute
 * @throws UnableToCompleteException on unparseable value
 */
public String consumeSafeHtmlAttribute(String name) throws UnableToCompleteException {
 return consumeAttribute(name, getSafeHtmlType());
}

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

private String consumeCurrency(XMLElement elem, UiBinderWriter writer)
  throws UnableToCompleteException {
 String currencyData = elem.consumeAttribute("currencyData",
   writer.getOracle().findType(CurrencyData.class.getCanonicalName()));
 String currencyCode = elem.consumeStringAttribute("currencyCode");
 if (currencyData != null && currencyCode != null) {
  writer.die(elem, AT_MOST_ONE_SPECIFIED_CURRENCY);
 }
 return currencyData != null ? currencyData : currencyCode;
}

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

private String consumeCurrency(XMLElement elem, UiBinderWriter writer)
  throws UnableToCompleteException {
 String currencyData = elem.consumeAttribute("currencyData",
   writer.getOracle().findType(CurrencyData.class.getCanonicalName()));
 String currencyCode = elem.consumeStringAttribute("currencyCode");
 if (currencyData != null && currencyCode != null) {
  writer.die(elem, AT_MOST_ONE_SPECIFIED_CURRENCY);
 }
 return currencyData != null ? currencyData : currencyCode;
}

代码示例来源:origin: com.jhickman/gxt-uibinder

protected void applyColumnConfigProperties(UiBinderWriter writer,
    Map<String, JType> columnConfigSetterTypes, XMLElement child,
    String columnConfig) throws UnableToCompleteException {
  
  int attributeCount = child.getAttributeCount();
  for(int i = 0; i < attributeCount; i++) {
    // always get 0 because we're consuming them
    XMLAttribute attribute = child.getAttribute(0);
    String setterMethod = "set" + initialCap(attribute.getName());
    String value = child.consumeAttribute(attribute.getName(), columnConfigSetterTypes.get(setterMethod));
    writer.addStatement("%s.%s(%s);", columnConfig, setterMethod, value);
  }
}

相关文章

XMLElement类方法