public String handleFragment(String literal) { return "\"" + UiBinderWriter.escapeTextForJavaStringLiteral(literal) + "\""; }
public String handleFragment(String literal) { return "\"" + UiBinderWriter.escapeTextForJavaStringLiteral(literal) + "\""; }
public String handleFragment(String literal) { return "\"" + UiBinderWriter.escapeTextForJavaStringLiteral(literal) + "\""; }
/** * Escape text that will be part of a string literal to be interpreted at * runtime as HTML, optionally preserving whitespace. */ public static String escapeText(String text, boolean preserveWhitespace) { // Replace reserved XML characters with entities. Note that we *don't* // replace single- or double-quotes here, because they're safe in text // nodes. text = text.replaceAll("&", "&"); text = text.replaceAll("<", "<"); text = text.replaceAll(">", ">"); if (!preserveWhitespace) { text = text.replaceAll("\\s+", " "); } return escapeTextForJavaStringLiteral(text); }
/** * Escape text that will be part of a string literal to be interpreted at * runtime as HTML, optionally preserving whitespace. */ public static String escapeText(String text, boolean preserveWhitespace) { // Replace reserved XML characters with entities. Note that we *don't* // replace single- or double-quotes here, because they're safe in text // nodes. text = text.replaceAll("&", "&"); text = text.replaceAll("<", "<"); text = text.replaceAll(">", ">"); if (!preserveWhitespace) { text = text.replaceAll("\\s+", " "); } return escapeTextForJavaStringLiteral(text); }
/** * Escape text that will be part of a string literal to be interpreted at * runtime as HTML, optionally preserving whitespace. */ public static String escapeText(String text, boolean preserveWhitespace) { // Replace reserved XML characters with entities. Note that we *don't* // replace single- or double-quotes here, because they're safe in text // nodes. text = text.replaceAll("&", "&"); text = text.replaceAll("<", "<"); text = text.replaceAll(">", ">"); if (!preserveWhitespace) { text = text.replaceAll("\\s+", " "); } return escapeTextForJavaStringLiteral(text); }
/** * Escape text that will be part of a string literal to be interpreted at * runtime as HTML, optionally preserving whitespace. */ public static String escapeText(String text, boolean preserveWhitespace) { // Replace reserved XML characters with entities. Note that we *don't* // replace single- or double-quotes here, because they're safe in text // nodes. text = text.replaceAll("&", "&"); text = text.replaceAll("<", "<"); text = text.replaceAll(">", ">"); if (!preserveWhitespace) { text = text.replaceAll("\\s+", " "); } return escapeTextForJavaStringLiteral(text); }
public void visitText(Text t) { String escaped; if (escapeHtmlEntities) { escaped = UiBinderWriter.escapeText(t.getTextContent(), preserveWhiteSpace(t)); } else { escaped = t.getTextContent(); if (!preserveWhiteSpace(t)) { escaped = escaped.replaceAll("\\s+", " "); } escaped = UiBinderWriter.escapeTextForJavaStringLiteral(escaped); } buffer.append(escaped); }
public void visitText(Text t) { String escaped; if (escapeHtmlEntities) { escaped = UiBinderWriter.escapeText(t.getTextContent(), preserveWhiteSpace(t)); } else { escaped = t.getTextContent(); if (!preserveWhiteSpace(t)) { escaped = escaped.replaceAll("\\s+", " "); } escaped = UiBinderWriter.escapeTextForJavaStringLiteral(escaped); } buffer.append(escaped); }
@Override public void parse(XMLElement elem, FieldManager fieldManager, UiBinderWriter writer) throws UnableToCompleteException { String resourceName = elem.consumeRequiredRawAttribute("name"); //fieldManager.registerField(fieldType, fieldName); JClassType xtemplateType = writer.getOracle().findType("com.extjs.gxt.ui.client.core.XTemplate"); String innerHtml = elem.consumeInnerHtml(new TextInterpreter(writer)); String text = UiBinderWriter.escapeTextForJavaStringLiteral(innerHtml); FieldWriter fieldWriter = fieldManager.registerField(xtemplateType, resourceName); fieldWriter.setInitializer("com.extjs.gxt.ui.client.core.XTemplate.create(\"" + text + "\")"); } }
defaultMessage = UiBinderWriter.escapeTextForJavaStringLiteral(defaultMessage); attributeMessages.add(new AttributeMessage(attributeName, declareMessage( child, defaultMessage)));
defaultMessage = UiBinderWriter.escapeTextForJavaStringLiteral(defaultMessage); attributeMessages.add(new AttributeMessage(attributeName, declareMessage( child, defaultMessage)));
/** * Consume an attribute on a messages related element (as oppposed to a * messages attribute in some other kind of element), e.g. the description in * {@code <m:msg description="described!">} */ String consumeMessageElementAttribute(String attName, XMLElement elem) { if (elem.hasAttribute(attName)) { return UiBinderWriter.escapeTextForJavaStringLiteral(elem.consumeRawAttribute(attName)); } String fullAttName = getMessagesPrefix() + ":" + attName; if (elem.hasAttribute(fullAttName)) { String value = elem.consumeRawAttribute(fullAttName); logger.warn(elem, "Deprecated prefix \"%s:\" on \"%s\". Use \"%s\" instead.", getMessagesPrefix(), fullAttName, attName); return value; } return ""; }
/** * Consume an attribute on a messages related element (as oppposed to a * messages attribute in some other kind of element), e.g. the description in * {@code <m:msg description="described!">} */ String consumeMessageElementAttribute(String attName, XMLElement elem) { if (elem.hasAttribute(attName)) { return UiBinderWriter.escapeTextForJavaStringLiteral(elem.consumeRawAttribute(attName)); } String fullAttName = getMessagesPrefix() + ":" + attName; if (elem.hasAttribute(fullAttName)) { String value = elem.consumeRawAttribute(fullAttName); logger.warn(elem, "Deprecated prefix \"%s:\" on \"%s\". Use \"%s\" instead.", getMessagesPrefix(), fullAttName, attName); return value; } return ""; }