本文整理了Java中com.google.gwt.uibinder.rebind.XMLElement.consumeChildElements()
方法的一些代码示例,展示了XMLElement.consumeChildElements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLElement.consumeChildElements()
方法的具体详情如下:
包路径:com.google.gwt.uibinder.rebind.XMLElement
类名称:XMLElement
方法名:consumeChildElements
[英]Consumes and returns all child elements.
[中]使用并返回所有子元素。
代码示例来源:origin: com.google.gwt/gwt-servlet
elem.consumeChildElements(new Interpreter<Boolean>() {
public Boolean interpretElement(XMLElement child)
throws UnableToCompleteException {
代码示例来源:origin: com.google.gwt/gwt-servlet
final Children children = new Children();
elem.consumeChildElements(new XMLElement.Interpreter<Boolean>() {
public Boolean interpretElement(XMLElement child)
throws UnableToCompleteException {
代码示例来源:origin: com.google.gwt/gwt-servlet
final Children children = new Children();
elem.consumeChildElements(new XMLElement.Interpreter<Boolean>() {
public Boolean interpretElement(XMLElement child)
throws UnableToCompleteException {
代码示例来源:origin: com.google.gwt/gwt-servlet
final Children children = new Children();
elem.consumeChildElements(new XMLElement.Interpreter<Boolean>() {
public Boolean interpretElement(XMLElement child)
throws UnableToCompleteException {
代码示例来源:origin: com.google.gwt/gwt-servlet
public void parse(final XMLElement elem, String fieldName, JClassType type,
UiBinderWriter writer) throws UnableToCompleteException {
this.fieldName = fieldName;
this.writer = writer;
OwnerFieldClass ownerFieldClass = OwnerFieldClass.getFieldClass(type,
writer.getLogger(), uiBinderCtx);
uiChildMethods = ownerFieldClass.getUiChildMethods();
// Parse children.
elem.consumeChildElements(new Interpreter<Boolean>() {
public Boolean interpretElement(XMLElement child)
throws UnableToCompleteException {
if (isValidChildElement(elem, child)) {
handleChild(child);
return true;
}
return false;
}
});
}
代码示例来源: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, "Expecting only widgets in %s", elem);
}
FieldWriter childField = writer.parseElementToField(child);
writer.addStatement("%1$s.add(%2$s);", fieldName,
childField.getNextReference());
}
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
elem.consumeChildElements(interpreter);
代码示例来源: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
JMethod method = methodPair.left;
int limit = methodPair.right;
Iterator<XMLElement> children = child.consumeChildElements().iterator();
代码示例来源:origin: com.google.gwt/gwt-servlet
public void parse(XMLElement elem, String fieldName, JClassType type,
UiBinderWriter writer) throws UnableToCompleteException {
for (XMLElement child : elem.consumeChildElements()) {
代码示例来源:origin: com.google.gwt/gwt-servlet
for (XMLElement child : elem.consumeChildElements()) {
JClassType childType = writer.findFieldType(child);
代码示例来源:origin: com.google.gwt/gwt-servlet
for (XMLElement child : elem.consumeChildElements()) {
JClassType childType = writer.findFieldType(child);
代码示例来源:origin: com.google.gwt/gwt-servlet
public void parse(XMLElement elem, String fieldName, JClassType type,
UiBinderWriter writer) throws UnableToCompleteException {
for (XMLElement child : elem.consumeChildElements()) {
String ns = child.getNamespaceUri();
String tagName = child.getLocalName();
if (ns != null && ns.equals(elem.getNamespaceUri())
&& localTagNameIsCell(tagName)) {
// It's a cell element, so parse its single child as a widget.
XMLElement widget = child.consumeSingleChildElement();
FieldWriter childField = writer.parseElementToField(widget);
writer.addStatement("%1$s.add(%2$s);", fieldName, childField.getNextReference());
// Parse the cell tag's alignment & size attributes.
parseCellAttributes(child, fieldName, childField, writer);
} else {
if (!writer.isWidgetElement(child)) {
writer.die(elem, "Expected a widget or <%s:%s>, found %s",
elem.getPrefix(), CELL_TAG.toLowerCase(Locale.ROOT), child);
}
// It's just a normal child, so parse it as a widget.
FieldWriter childField = writer.parseElementToField(child);
writer.addStatement("%1$s.add(%2$s);", fieldName, childField.getNextReference());
}
}
}
代码示例来源: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: com.google.gwt/gwt-servlet
for (XMLElement child : elem.consumeChildElements()) {
if (CAPTION.equals(child.getLocalName())) {
if (caption != 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()) {
// Parse position element.
if (isPositionElement(elem, child)) {
// Parse position.
String left = child.consumeRequiredIntAttribute("left");
String top = child.consumeRequiredIntAttribute("top");
// Add child widget.
XMLElement widgetElem = child.consumeSingleChildElement();
FieldWriter widgetField = writer.parseElementToField(widgetElem);
writer.addStatement("%1$s.add(%2$s, %3$s, %4$s);", fieldName,
widgetField.getNextReference(), left, top);
continue;
}
// Parse Widget.
if (writer.isWidgetElement(child)) {
FieldWriter widgetFieldName = writer.parseElementToField(child);
writer.addStatement("%1$s.add(%2$s);", fieldName, widgetFieldName.getNextReference());
continue;
}
// die
writer.die(child, "Expecting only <%s:%s> or widget children in %s",
elem.getPrefix(), AT, elem);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
for (XMLElement child : elem.consumeChildElements()) {
代码示例来源:origin: com.google.gwt/gwt-servlet
for (XMLElement tabElem : panelElem.consumeChildElements()) {
内容来源于网络,如有侵权,请联系作者删除!