TheCoder4eu / BootsFaces-OSP

BootsFaces - Open Source Project
Apache License 2.0
246 stars 102 forks source link

Using bootsfaces tags inside custom tags #994

Closed vsvetoslavov closed 2 months ago

vsvetoslavov commented 6 years ago

Hi I am trying to use some of the bootsfaces tags inside my custom tags. There is a nasty limitation, however, that there are some attributes that trigger other attributes when set. For instance, one such attribute is b:inputText's typeaheadValues - it sets typeahead to true, no matter if value set is null or not. This makes it impossible to use this feature reasonably. A null check (or a check of the value set to a criteria that makes sense in the specific case) seems like a good idea. What do you think? Also, is there some way to work around this limitation? I want to have the possibility to delegate the typeahead feature to the party consuming the custom tag I am making.

stephanrauh commented 6 years ago

If you're using typeahead, you might want to try BootsFaces 1.3.1-SNAPSHOT. Accidentially, I've introduced a couple of errors in BF 1.3.0

Back to your question. I don't get it yet. Is typeaheadValues one of the values that may be passed as a parameter to your custom component?

vsvetoslavov commented 6 years ago

@stephanrauh yes, you did get it right, I want to be able to define whether to use the typeahead feature or not - i.e. <vs:myComponent typeahead="false" /> or <vs:myComponent typeaheadValues="#{myBean.typeaheadValues}" /> - something like this. Currently (1.2.0), setting typeaheadValues always sets typeahead to true, which in turn adds listeners and... you know what it does better than me ;)

geopossachs commented 4 years ago

Hello @vsvetoslavov, i cloud not reproduce the bug - this example works in my machine. Where is your code different, which leads to an error? Do you have an example where the error occurs?

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://xmlns.jcp.org/jsf/composite"
      xmlns:b="http://bootsfaces.net/ui">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="typeahead" type="java.lang.Boolean" default="false" /> 
        <cc:attribute name="typeaheadValues" type="java.lang.String" /> 
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>

        <b:inputText id="#{cc.id}_inputText"
                     typeahead="#{cc.attrs.typeahead}" 
                     typeaheadValues="#{cc.attrs.typeaheadValues}" >            
            <cc:insertFacet name="prepend"/>
            <cc:insertFacet name="append"/>
        </b:inputText>

    </cc:implementation>
</html>
   <tp:myTags id="myHead"
                           typeahead="true" 
                           typeaheadValues="Arch Enemy,Blind Guardian,Children of Bodom,Dimmu Borgir,Edge of Sanity,Fields of the Nephilim,Gates of Ishtar,Holy Moses,Iced Earth,Jethro Tull,Kreator,Lamb of God,Mekong Delta,Night in Gales,Old Dead Tree,Persefone,Running Wild,Skyclad,The Dillinger Escape Plan,Theater of Tragedy,Unleashed,Vanden Plas,Within Temptation,Xystus,Yes,Zenobia"/>
sebsoftware commented 4 years ago

Haven't tried it, but what about using with a check if the typeahead value is set inside the ?

geopossachs commented 4 years ago
        <b:inputText id="#{cc.id}_inputText">            
            <cc:insertFacet name="prepend"/>
            <cc:insertFacet name="append"/>
            <f:attribute name="typeahead" value="#{cc.attrs.typeahead}" />
            <c:if test="#{true eq true}">                
                <f:attribute name="typeaheadValues" value="#{cc.attrs.typeaheadValues}" />
            </c:if>
        </b:inputText>

this work, if you need it

stephanrauh commented 2 months ago

I'm afraid development of BootsFaces has slowed down considerably. We'll never manage to address this issue. Let's close it.