本文整理了Java中com.google.gwt.uibinder.rebind.XMLElement.consumeStringAttribute()
方法的一些代码示例,展示了XMLElement.consumeStringAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLElement.consumeStringAttribute()
方法的具体详情如下:
包路径:com.google.gwt.uibinder.rebind.XMLElement
类名称:XMLElement
方法名:consumeStringAttribute
[英]Convenience method for parsing the named attribute as a String value or reference.
[中]将命名属性解析为字符串值或引用的方便方法。
代码示例来源: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
public void parse(XMLElement elem, String fieldName, JClassType type,
UiBinderWriter writer) throws UnableToCompleteException {
String debugId = elem.consumeStringAttribute("debugId", null);
if (null != debugId) {
writer.addStatement("%s.ensureDebugId(%s);", fieldName, debugId);
String styleName = elem.consumeStringAttribute("styleName", null);
String stylePrimaryName = elem.consumeStringAttribute("stylePrimaryName",
null);
代码示例来源:origin: com.google.gwt/gwt-servlet
public void parse(XMLElement elem, String fieldName, JClassType type,
final UiBinderWriter writer) throws UnableToCompleteException {
String customTag = elem.consumeStringAttribute("tag", null);
if (null != customTag) {
OwnerField uiField = writer.getOwnerClass().getUiField(fieldName);
if (uiField != null && uiField.isProvided()) {
writer.die("UiField %s for FlowPanel cannot set tag when it is also provided.", fieldName);
}
writer.setFieldInitializerAsConstructor(fieldName, customTag);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private void parseRows(XMLElement elem, String fieldName,
UiBinderWriter writer, List<RowContent> matrix)
throws UnableToCompleteException {
for (XMLElement child : elem.consumeChildElements()) {
String tagName = child.getLocalName();
if (!tagName.equals(ROW_TAG)
|| !elem.getPrefix().equals(child.getPrefix())) {
writer.die(
"%1$s:Grid elements must contain only %1$s:%2$s children, found %3$s:%4$s",
elem.getPrefix(), ROW_TAG, child.getPrefix(), tagName);
}
RowContent newRow = new RowContent();
newRow.setStyleName(child.consumeStringAttribute(STYLE_NAME_ATTRIBUTE, null));
matrix.add(newRow);
parseColumns(fieldName, writer, newRow, child);
}
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private void parseColumns(String fieldName, UiBinderWriter writer,
RowContent row, XMLElement child)
throws UnableToCompleteException {
String tagName;
for (XMLElement cell : child.consumeChildElements()) {
tagName = cell.getLocalName();
if (!tagName.equals(CELL_TAG) && !tagName.equals(CUSTOMCELL_TAG)
|| !cell.getPrefix().equals(child.getPrefix())) {
writer.die("Grid's row tag in %s may only contain %s or %s element.",
fieldName, CELL_TAG, CUSTOMCELL_TAG);
}
CellContent newColumn = null;
String styleName = cell.consumeStringAttribute(STYLE_NAME_ATTRIBUTE, null);
if (tagName.equals(CELL_TAG)) {
HtmlInterpreter htmlInt = HtmlInterpreter.newInterpreterForUiObject(
writer, fieldName);
String html = cell.consumeInnerHtml(htmlInt);
newColumn = new CellContent(tagName, html, styleName);
}
if (tagName.equals(CUSTOMCELL_TAG)) {
FieldWriter field = writer.parseElementToField(cell.consumeSingleChildElement());
newColumn = new CellContent(tagName, field.getNextReference(),
styleName);
}
row.addColumn(newColumn);
}
}
代码示例来源: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()) {
String tagName = child.getLocalName();
if (!tagName.equals(ITEM_TAG)) {
writer.die(elem, "Invalid ListBox child element: " + tagName);
}
String value = child.consumeStringAttribute("value");
String innerText = child.consumeInnerTextEscapedAsStringLiteral(
new TextInterpreter(writer));
if (value != null) {
writer.addStatement("%s.addItem(\"%s\", %s);", fieldName, innerText, value);
} else {
writer.addStatement("%s.addItem(\"%s\");", fieldName, innerText);
}
}
}
代码示例来源: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
writer.getOracle().findType(NumberFormat.class.getCanonicalName()));
String predefinedFormat = elem.consumeRawAttribute("predefinedFormat");
String customFormat = elem.consumeStringAttribute("customFormat");
代码示例来源: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
String value = cellElem.consumeStringAttribute(WIDTH_ATTR);
writer.addStatement("%1$s.setCellWidth(%2$s, %3$s);", fieldName,
childField.getNextReference(), value);
String value = cellElem.consumeStringAttribute(HEIGHT_ATTR);
writer.addStatement("%1$s.setCellHeight(%2$s, %3$s);", fieldName,
childField.getNextReference(), value);
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
public String consumeStringValue() throws UnableToCompleteException {
return xmlElem.consumeStringAttribute(w3cAttr.getName());
}
代码示例来源:origin: net.wetheinter/gwt-user
public String consumeStringValue() throws UnableToCompleteException {
return xmlElem.consumeStringAttribute(w3cAttr.getName());
}
代码示例来源:origin: com.google.gwt/gwt-servlet
String customTag = elem.consumeStringAttribute("tag", null);
代码示例来源:origin: com.google.gwt/gwt-servlet
String tabCaption = tabElem.consumeStringAttribute("text");
代码示例来源:origin: com.google.gwt/gwt-servlet
String customTag = elem.consumeStringAttribute("tag", null);
代码示例来源: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: 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: net.wetheinter/gwt-user
public void parse(XMLElement elem, String fieldName, JClassType type,
final UiBinderWriter writer) throws UnableToCompleteException {
String customTag = elem.consumeStringAttribute("tag", null);
if (null != customTag) {
OwnerField uiField = writer.getOwnerClass().getUiField(fieldName);
if (uiField != null && uiField.isProvided()) {
writer.die("UiField %s for FlowPanel cannot set tag when it is also provided.", fieldName);
}
writer.setFieldInitializerAsConstructor(fieldName, customTag);
}
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
public void parse(XMLElement elem, String fieldName, JClassType type,
final UiBinderWriter writer) throws UnableToCompleteException {
String customTag = elem.consumeStringAttribute("tag", null);
if (null != customTag) {
OwnerField uiField = writer.getOwnerClass().getUiField(fieldName);
if (uiField != null && uiField.isProvided()) {
writer.die("UiField %s for FlowPanel cannot set tag when it is also provided.", fieldName);
}
writer.setFieldInitializerAsConstructor(fieldName, customTag);
}
}
代码示例来源:origin: com.jhickman/gxt-uibinder
public void parse(XMLElement elem, String fieldName, JClassType type, UiBinderWriter writer) throws UnableToCompleteException {
XMLElement menu = elem.consumeSingleChildElement();
if ( ! isMenuElement(writer, menu)) {
writer.die(elem, "%s must contain a Menu, but found %s", elem, menu);
}
String menuItemText = elem.consumeStringAttribute("text");
String menuFieldName = writer.parseElementToField(menu);
writer.setFieldInitializerAsConstructor(fieldName, type, menuItemText, menuFieldName);
}
内容来源于网络,如有侵权,请联系作者删除!