Theme
afterdark
afternoon
afterwork
aristo
black-tie
blitzer
bluesky
bootstrap
casablanca
cruze
cupertino
dark-hive
delta
dot-luv
eggplant
excite-bike
flick
glass-x
home
hot-sneaks
humanity
le-frog
midnight
mint-choc
omega
overcast
pepper-grinder
redmond
rocket
sam
smoothness
south-street
start
sunny
swanky-purse
trontastic
ui-darkness
ui-lightness
vader
TriStateManyCheckbox
With inline converter:
With f:converter:
With Validator, 0 is not allowed:
Selected Values
  • Cat 1
  • Fish 2
  • Dog 0
  • Cat 0
  • Fish 0
  • Dog 0
  • Tamara state = 1
  • Mauricio state = 1
Source
<!-- This group is for coding -->
<p:growl id="growl" showDetail="false"/>
<h:panelGrid id="triStateGrid" columns="2" style="margin-bottom:10px" cellpadding="5">

    <h:outputText value="With inline converter:"/>
    <pe:triStateManyCheckbox id="TriBasicConverter"
                             value="#{triSateManyCheckBoxController.selectedOptionsTriStateConvertedInline}"
                             converter="triStateManyCheckboxConverter">
        <f:selectItems value="#{triSateManyCheckBoxController.basicOptions}"/>
    </pe:triStateManyCheckbox>
    
    <h:outputText value="With f:converter:"/>
    <pe:triStateManyCheckbox id="TriBasicConverterInline"
                             value="#{triSateManyCheckBoxController.selectedOptionsTriStateConverted}">
        <f:converter converterId="triStateManyCheckboxConverter"/>
        <f:selectItems value="#{triSateManyCheckBoxController.basicOptions}"/>
    </pe:triStateManyCheckbox>    

    <h:outputText value="With Validator, 0 is not allowed:"/>
    <pe:triStateManyCheckbox id="TriAjax"
                             value="#{triSateManyCheckBoxController.selectedOptionsTriStateAjax}"
                             stateOneIcon="ui-icon-home"
                             stateTwoIcon="ui-icon-heart"
                             stateThreeIcon="ui-icon-star"
                             validatorMessage="State 0 is not allowed">
        <f:selectItem itemLabel="Tamara" itemValue="Tamara"/>
        <f:selectItem itemLabel="Mauricio" itemValue="Mauricio"/>
        <f:validateLongRange minimum="1"/>
        <p:ajax update="growl" listener="#{triSateManyCheckBoxController.addMessage}"/>
    </pe:triStateManyCheckbox>
</h:panelGrid>

<p:commandButton value="Submit" update="display" oncomplete="PF('dlg').show()"/>

<p:dialog header="Selected Values" modal="false" showEffect="fade" hideEffect="fade" widgetVar="dlg" width="240">
    <p:outputPanel id="display">
         <p:dataList value="#{triSateManyCheckBoxController.selectedOptionsTriStateConvertedInline.keySet().toArray()}"
                    var="optionsB">
            #{optionsB} #{triSateManyCheckBoxController.selectedOptionsTriStateConvertedInline.get(optionsB)}
        </p:dataList>
        
        <p:dataList value="#{triSateManyCheckBoxController.selectedOptionsTriStateConverted.keySet().toArray()}"
                    var="optionsB">
            #{optionsB} #{triSateManyCheckBoxController.selectedOptionsTriStateConverted.get(optionsB)}
        </p:dataList>

        <p:dataList value="#{triSateManyCheckBoxController.selectedOptionsTriStateAjax.keySet().toArray()}"
                    var="optionsA">
            #{optionsA} state = #{triSateManyCheckBoxController.selectedOptionsTriStateAjax.get(optionsA)}
        </p:dataList>
    </p:outputPanel>
</p:dialog>
            
Components and more
Use Cases
Documentation pe:triStateManyCheckbox
Attributes (move mouse over the names to see data types)
Name Description
idUnique identifier of the component in a namingContainer.
rendered Boolean value to specify the rendering of the component, when set to false component will not be rendered.
bindingAn EL expression referring to a server side UIComponent instance in a backing bean.
valueValue of the component.
converter An EL expression or a literal text that defines a converter for the component. When it's an EL expression, it's resolved to a converter instance. In case it's a static text, it must refer to a converter id.
immediate When set true, process validations logic is executed at apply request values phase for this component. Default is false.
requiredMarks component as required.
validatorA method expression referring to a method validationg the input.
valueChangeListenerA method binding expression referring to a method for handling a valuchangeevent.
requiredMessageMessage to display when required field validation fails.
converterMessageMessage to display when conversion fails.
validatorMessageMessage to display when validation fails.
widgetVarName of the client side widget.
disabledDisable the component.
labelUser presentable name.
layout Layout of the checkboxes, valid values are �lineDirection�(horizontal) and �pageDirection�(vertical).
onchangeCallback on change event.
styleInline style of the component.
styleClassStyle class of the main Layout container element. Default value is null.
stateOneIconIcon for StateOne as a css class.
stateTwoIconIcon for StateTwo as a css class.
stateThreeIconIcon for StateThree as a css class.
stateOneTitleTitle for StateOne.
stateTwoTitleTitle for StateTwo.
stateThreeTitleTitle for StateThree.
tabindexThe tab index to assign to the component, If not given, tabindex=0 will be assigned.
PrimeFaces Extensions Showcase - © 2011-2017, PrimeFaces: 6.1, PrimeFaces Extensions: 6.1.0, JSF: mojarra 2.2.8, Server: jetty/9.4.2.v20170220, Build time: 2017-04-19 16:13
occured!
Message:
Timestamp:
StackTrace:
Developers
Thomas Andraschko andraschko.thomas@gmail.com
Oleg Varaksin ovaraksin@googlemail.com
Nilesh Namdeo Mali nileshmali86@gmail.com
Mauricio Fenoglio fenoglio.mauricio@gmail.com
Pavol Slaný pavol.slany@gmail.com
Sudheer Jonna sudheer.jonna@gmail.com