/** * Searches up the parent hierarchy for a Tag of the given type. * @return the tag of the given type or null if it could not be found */ protected Tag findAncestorWithClass(Class parentClass) { return findAncestorWithClass(getParent(), parentClass); }
/** * Executes the body of the tag and returns the result as a String. * * @return the text evaluation of the body */ protected String getBodyText() throws JellyTagException { return getBodyText(escapeText); }
public TagSupport(boolean shouldTrim) { setTrim( shouldTrim ); }
keyInput = this.key.evaluate(context); invokeBody(output); keyInput = getBodyText(); Tag t = findAncestorWithClass(this, BundleTag.class); if (t != null) {
/** * Invoke the body and produce no output. * @param output tag output, which is ignored. */ public void doTag(XMLOutput output) throws JellyTagException { super.invokeBody(new MuteXMLOutput()); }
/** * Evaluates this tag after all the tags properties have been initialized. * */ public void doTag(XMLOutput output) throws JellyTagException { MessageTag parent = null; Tag t = findAncestorWithClass(this, MessageTag.class); if (t != null) { parent = (MessageTag) t; } else { // must be nested inside a <fmt:message> action. throw new JellyTagException("must be nested inside a <fmt:message> action."); } Object valueInput = null; if (this.value != null) { valueInput = this.value.evaluate(context); } else { // get value from body valueInput = getBodyText(); } parent.addParam(valueInput); }
/** * Searches up the parent hierarchy from the given tag * for a Tag matching one or more of given types. * * @param from the tag to start searching from * @param tagClasses an array of types that might match * @return the tag of the given type or null if it could not be found * @see #findAncestorWithClass(Tag,Collection) */ public static Tag findAncestorWithClass(Tag from, Class[] tagClasses) { return findAncestorWithClass(from,Arrays.asList(tagClasses)); }
public boolean isTrim() { if ( this.shouldTrim == null ) { Tag parent = getParent(); if ( parent == null ) { return true; } else { if ( parent instanceof TagSupport ) { TagSupport parentSupport = (TagSupport) parent; this.shouldTrim = ( parentSupport.isTrim() ? Boolean.TRUE : Boolean.FALSE ); } else { this.shouldTrim = Boolean.TRUE; } } } return this.shouldTrim.booleanValue(); }
/** * Invokes the body of this tag using the given output */ public void invokeBody(XMLOutput output) throws JellyTagException { getBody().run(context, output); }
/** * Executes the body of the tag and returns the result as a String. * * @param shouldEscape Signal if the text should be escaped. * * @return the text evaluation of the body */ protected String getBodyText(boolean shouldEscape) throws JellyTagException { StringWriter writer = new StringWriter(); invokeBody(XMLOutput.createXMLOutput(writer, shouldEscape)); return writer.toString(); }
/** * Searches up the parent hierarchy from the given tag * for a Tag matching one or more of given types. * * @param from the tag to start searching from * @param tagClasses an array of types that might match * @return the tag of the given type or null if it could not be found * @see #findAncestorWithClass(Tag,Collection) */ public static Tag findAncestorWithClass(Tag from, Class[] tagClasses) { return findAncestorWithClass(from,Arrays.asList(tagClasses)); }
public boolean isTrim() { if ( this.shouldTrim == null ) { Tag parent = getParent(); if ( parent == null ) { return true; } else { if ( parent instanceof TagSupport ) { TagSupport parentSupport = (TagSupport) parent; this.shouldTrim = ( parentSupport.isTrim() ? Boolean.TRUE : Boolean.FALSE ); } else { this.shouldTrim = Boolean.TRUE; } } } return this.shouldTrim.booleanValue(); }
/** * Invokes the body of this tag using the given output */ public void invokeBody(XMLOutput output) throws JellyTagException { getBody().run(context, output); }
/** * Searches up the parent hierarchy for a Tag of one of the given types. * @return the tag of the given type or null if it could not be found * @see #findAncestorWithClass(Collection) */ protected Tag findAncestorWithClass(Class[] parentClasses) { return findAncestorWithClass(getParent(),parentClasses); }
/** * Executes the body of the tag and returns the result as a String. * * @param shouldEscape Signal if the text should be escaped. * * @return the text evaluation of the body */ protected String getBodyText(boolean shouldEscape) throws JellyTagException { StringWriter writer = new StringWriter(); invokeBody(XMLOutput.createXMLOutput(writer, shouldEscape)); return writer.toString(); }
/** * Searches up the parent hierarchy from the given tag * for a Tag matching one or more of given types. * * @param from the tag to start searching from * @param tagClasses an array of types that might match * @return the tag of the given type or null if it could not be found * @see #findAncestorWithClass(Tag,Collection) */ public static Tag findAncestorWithClass(Tag from, Class[] tagClasses) { return findAncestorWithClass(from,Arrays.asList(tagClasses)); }
/** * Executes the body of the tag and returns the result as a String. * * @return the text evaluation of the body */ protected String getBodyText() throws JellyTagException { return getBodyText(escapeText); }
/** * Invokes the body of this tag using the given output */ public void invokeBody(XMLOutput output) throws JellyTagException { getBody().run(context, output); }