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; }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }
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; }
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; }
/** * Parses the root UiBinder element, and kicks off the parsing of the rest of * the document. */ public FieldWriter parse(XMLElement elem) throws UnableToCompleteException { if (!writer.isBinderElement(elem)) { writer.die(elem, "Bad prefix on <%s:%s>? The root element must be in " + "xml namespace \"%s\" (usually with prefix \"ui:\"), " + "but this has prefix \"%s\"", elem.getPrefix(), elem.getLocalName(), binderUri, elem.getPrefix()); } if (!TAG.equals(elem.getLocalName())) { writer.die(elem, "Root element must be %s:%s", elem.getPrefix(), TAG); } findResources(elem); messagesWriter.findMessagesConfig(elem); XMLElement uiRoot = elem.consumeSingleChildElement(); return writer.parseElementToField(uiRoot); }
/** * Parses the root UiBinder element, and kicks off the parsing of the rest of * the document. */ public FieldWriter parse(XMLElement elem) throws UnableToCompleteException { if (!writer.isBinderElement(elem)) { writer.die(elem, "Bad prefix on <%s:%s>? The root element must be in " + "xml namespace \"%s\" (usually with prefix \"ui:\"), " + "but this has prefix \"%s\"", elem.getPrefix(), elem.getLocalName(), binderUri, elem.getPrefix()); } if (!TAG.equals(elem.getLocalName())) { writer.die(elem, "Root element must be %s:%s", elem.getPrefix(), TAG); } findResources(elem); messagesWriter.findMessagesConfig(elem); XMLElement uiRoot = elem.consumeSingleChildElement(); return writer.parseElementToField(uiRoot); }
@Override public String parse(XMLElement elem) throws UnableToCompleteException { if (!writer.isBinderElement(elem)) { writer.die(elem, "Bad prefix on <%s:%s>? The root element must be in " + "xml namespace \"%s\" (usually with prefix \"ui:\"), " + "but this has prefix \"%s\"", elem.getPrefix(), elem.getLocalName(), binderUri, elem.getPrefix()); } if (!TAG.equals(elem.getLocalName())) { writer.die(elem, "Root element must be %s:%", elem.getPrefix(), TAG); } reflector.callMethod("findResources", new Class[]{XMLElement.class}, elem); findCustomResources(elem); MessagesWriter messagesWriter = reflector.getField("messagesWriter"); messagesWriter .findMessagesConfig(elem); XMLElement uiRoot = elem.consumeSingleChildElement(); return writer.parseElementToField(uiRoot); }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }