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; }
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; }
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; }
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");
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);
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
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; }
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; }
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); } }