Trinidad 2.2.1's datatable detailstamp resolves to null when customizing the prompt facet

95 views Asked by At

We're in the middle of upgrading from JSF 1.2 to 2.2 and we hit a blockade when upgrading trinidad.

In Trinidad 2.2.1, the detailstamp of a datatable will resolve to null when you're customizing the prompt facet. Anybody else knows why this happens?

This was tested on Wildfly (10.1.0.Final) with Mojarra 2.2.13.SP1, Java 8 (1.8.0_131), JSF 2.2 and Trinidad 2.2.1 (issue also exists on 2.2).

Java:

@Named
@RequestScoped
public class ProductBean {

    private final AtomicBoolean seeded = new AtomicBoolean(false);
    private final List<Product> products = Collections.synchronizedList(new ArrayList<>());

    @PostConstruct
    public void init() {
        if (!seeded.get()) {
            products.add(new Product(1, new ProductInfo("product 1", "1")));
            products.add(new Product(2, new ProductInfo("product 2", "2")));
            products.add(new Product(3, null));

            seeded.set(true);
        }
    }

    public List<Product> getProducts() {
        return products;
    }

    public static class Product {
        private final int id;
        private final ProductInfo info;

        public Product(int id, ProductInfo info) {
            this.id = id;
            this.info = info;
        }

        public int getId() {
            return id;
        }

        public ProductInfo getInfo() {
            return info;
        }
    }

    public static class ProductInfo {
        private final String name;
        private final String code;

        public ProductInfo(String name, String code) {
            this.name = name;
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public String getCode() {
            return code;
        }
    }
}

xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<tr:document xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:trh="http://myfaces.apache.org/trinidad/html"
    xmlns:tr="http://myfaces.apache.org/trinidad"
    xmlns:ui="http://java.sun.com/jsf/facelets">

    <tr:page>
        <tr:form id="mainForm">
            <tr:table id="products" value="#{productBean.products}"
                var="product">
                <tr:column headerText="Id">
                    <tr:outputText value="#{product.id}"></tr:outputText>
                </tr:column>
                <tr:column headerText="Naam">
                                    #{product.info.name}
                                </tr:column>
                <f:facet name="detailStamp">
                    <f:facet name="prompt">
                        <tr:outputText value="Details" />
                    </f:facet>
                        #{product.id} | #{product.info.name}
                    </f:facet>
            </tr:table>
        </tr:form>
    </tr:page>
</tr:document>
1

There are 1 answers

0
V. Polfliet On BEST ANSWER

I'm an idiot. Trinidad works fine. The prompt facet should be outside of the detailStamp facet.

<f:facet name="detailStamp">
    #{product.id} | #{product.info.name}
</f:facet>
<f:facet name="prompt">
    <tr:outputText value="Details" />
</f:facet>