Example usage for javax.servlet.jsp.tagext BodyTag EVAL_BODY_BUFFERED

List of usage examples for javax.servlet.jsp.tagext BodyTag EVAL_BODY_BUFFERED

Introduction

In this page you can find the example usage for javax.servlet.jsp.tagext BodyTag EVAL_BODY_BUFFERED.

Prototype

int EVAL_BODY_BUFFERED

To view the source code for javax.servlet.jsp.tagext BodyTag EVAL_BODY_BUFFERED.

Click Source Link

Document

Request the creation of new buffer, a BodyContent on which to evaluate the body of this tag.

Usage

From source file:de.micromata.genome.gwiki.web.tags.GWikiHtmlRadioboxTag.java

public int doStartTag() throws JspException {
    prepare();//  w  w w. java  2s.c  o  m
    StringBuilder sb = new StringBuilder();
    GWikiTagRenderUtils.renderSimpleHtmlTag(this, "input", sb);
    GWikiTagRenderUtils.write(pageContext, sb.toString());
    return BodyTag.EVAL_BODY_BUFFERED;
}

From source file:de.micromata.genome.gwiki.web.tags.GWikiHtmlSelectTag.java

public int doStartTag() throws JspException {
    prepare();//from w ww  .j  a  v  a2s  .  c om
    StringBuilder sb = new StringBuilder();
    GWikiTagRenderUtils.renderOpenHtmlTag(this, "select", sb);
    GWikiTagRenderUtils.write(pageContext, sb.toString());
    pageContext.setAttribute(GWikiHtmlSelectTag_KEY, this);
    return BodyTag.EVAL_BODY_BUFFERED;
}

From source file:org.openmrs.web.taglib.ForEachEncounterTagTest.java

/**
 * @see ForEachEncounterTag#doStartTag()
 * @regression TRUNK-2465/*  w  w  w  .  j a va2 s  .  com*/
 */
@Test
@Verifies(value = "should sort encounters by encounterDatetime in descending order", method = "doStartTag()")
public void doStartTag_shouldSortEncountersByEncounterDatetimeInDescendingOrder() throws Exception {
    int num = 3;
    executeDataSet("org/openmrs/web/taglib/include/ForEachEncounterTagTest.xml");
    Patient patient = Context.getPatientService().getPatient(7);
    List<Encounter> encounters = Context.getEncounterService().getEncountersByPatient(patient);
    ForEachEncounterTag tag = new ForEachEncounterTag();
    tag.setPageContext(new MockPageContext());
    tag.setDescending(true);
    tag.setEncounters(encounters);
    tag.setVar("enc");
    tag.setNum(num);
    // the tag passes
    Assert.assertEquals(BodyTag.EVAL_BODY_BUFFERED, tag.doStartTag());
    //the match count should not exceed the limit
    Assert.assertTrue(num >= tag.matchingEncs.size());
    //check the sorting
    Assert.assertEquals(11, tag.matchingEncs.get(0).getId().intValue());
    Assert.assertEquals(16, tag.matchingEncs.get(1).getId().intValue());
    Assert.assertEquals(7, tag.matchingEncs.get(2).getId().intValue());
}

From source file:net.sourceforge.ajaxtags.tags.AbstractTagTest.java

/**
 * Test start of tag with body./*from w  w  w .j  av  a2  s.  c  o  m*/
 *
 * @throws JspException
 *             if an error occurred while processing this tag
 */
public void assertStartTagEvalBody() throws JspException {
    assertEquals("doStartTag() must return BodyTag.EVAL_BODY_BUFFERED", BodyTag.EVAL_BODY_BUFFERED,
            tag.doStartTag());
}

From source file:com.sun.faces.taglib.BaseComponentBodyTag.java

protected int getDoStartValue() throws JspException {
    return (BodyTag.EVAL_BODY_BUFFERED);
}

From source file:com.sun.faces.taglib.jsf_core.ViewTag.java

protected int getDoStartValue() throws JspException {
    return BodyTag.EVAL_BODY_BUFFERED;
}

From source file:org.hdiv.web.servlet.tags.form.OptionTagTests.java

public void testCanBeDisabledEvenWhenSelected() throws Exception {
    getPageContext().setAttribute(SelectTagHDIV.LIST_VALUE_PAGE_ATTRIBUTE,
            new BindStatus(getRequestContext(), "testBean.name", false));
    this.tag.setValue("bar");
    this.tag.setLabel("Bar");
    this.tag.setDisabled("true");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    result = this.tag.doEndTag();
    assertEquals(Tag.EVAL_PAGE, result);

    String output = getOutput();//from   ww  w  .jav a2 s .  c om

    assertOptionTagOpened(output);
    assertOptionTagClosed(output);

    String hdivValue = this.confidentiality ? "0" : "bar";
    assertContainsAttribute(output, "value", hdivValue);
    assertContainsAttribute(output, "disabled", "disabled");
    assertBlockTagContains(output, "Bar");
}

From source file:org.hdiv.web.servlet.tags.form.OptionTagTests.java

public void testRenderNotSelected() throws Exception {
    getPageContext().setAttribute(SelectTagHDIV.LIST_VALUE_PAGE_ATTRIBUTE,
            new BindStatus(getRequestContext(), "testBean.name", false));
    this.tag.setValue("bar");
    this.tag.setLabel("Bar");
    int result = this.tag.doStartTag();
    assertEquals(BodyTag.EVAL_BODY_BUFFERED, result);
    result = this.tag.doEndTag();
    assertEquals(Tag.EVAL_PAGE, result);

    String output = getOutput();/*from  w w w.  j a  v  a  2 s  .  c  o m*/

    assertOptionTagOpened(output);
    assertOptionTagClosed(output);

    String hdivValue = this.confidentiality ? "0" : "bar";
    assertContainsAttribute(output, "value", hdivValue);
    assertBlockTagContains(output, "Bar");
}

From source file:it.cnr.icar.eric.client.ui.thin.components.taglib.GraphMenuNodeTag.java

public int doStartTag() throws JspException {

    FacesContext context = FacesContext.getCurrentInstance();
    Graph graph = (Graph) ((Util.getValueBinding("#{sessionScope.graph_menu}").getValue(context)));
    // In the postback case, graph and the node exist already.So make sure
    // it doesn't created again.
    if (graph.findNodeByName(name) != null) {
        return BodyTag.EVAL_BODY_BUFFERED;
    }//from  w ww.ja  va 2 s .c  om
    Node node = new Node(name, label, action, icon, enabled, expanded);

    // get the immediate ancestor/parent of this node.
    GraphMenuNodeTag parentNode = null;
    try {
        parentNode = (GraphMenuNodeTag) TagSupport.findAncestorWithClass(this, GraphMenuNodeTag.class);
    } catch (Exception e) {
        System.out.println("Exception while locating GraphMenuNodeTag.class");
    }

    if (parentNode == null) {
        // then this should be root
        try {
            graph.setRoot(node);
        } catch (JAXRException ex) {
            log.error(ex);
        }
    } else {
        Node nodeToAdd = graph.findNodeByName(parentNode.getName());
        // this node should exist
        if (nodeToAdd != null) {
            try {
                nodeToAdd.addChild(node);
            } catch (JAXRException ex) {
                log.error(ex);
            }
        }
    }

    return BodyTag.EVAL_BODY_BUFFERED;
}

From source file:it.cnr.icar.eric.client.ui.thin.components.taglib.GraphTreeNodeTag.java

public int doStartTag() throws JspException {

    FacesContext context = FacesContext.getCurrentInstance();

    Graph graph = (Graph) ((Util.getValueBinding("#{sessionScope.graph_tree}").getValue(context)));
    // In the postback case, graph and the node exist already.So make sure
    // it doesn't created again.
    if (graph.findNodeByName(getName()) != null) {
        return BodyTag.EVAL_BODY_BUFFERED;
    }/*w w  w . j av a2 s.  c  o  m*/
    Node node = new Node(name, label, action, icon, enabled, expanded);

    // get the immediate ancestor/parent tag of this tag.
    GraphTreeNodeTag parentNode = null;
    try {
        parentNode = (GraphTreeNodeTag) TagSupport.findAncestorWithClass(this, GraphTreeNodeTag.class);
    } catch (Exception e) {
        System.out.println("Exception while locating GraphTreeNodeTag.class");
    }
    // if this tag has no parent that is a node tag,
    if (parentNode == null) {
        // then this should be root
        try {
            graph.setRoot(node);
        } catch (JAXRException ex) {
            log.error(ex);
        }
    } else {
        // add the node to its parent node.
        Node nodeToAdd = graph.findNodeByName(parentNode.getName());
        // this node should exist
        if (nodeToAdd != null) {
            try {
                nodeToAdd.addChild(node);
            } catch (JAXRException ex) {
                log.error(ex);
            }
        }
    }

    return BodyTag.EVAL_BODY_BUFFERED;
}