blob: e7de8a73424412adc520799b6f24de5cf0ba006a [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<ui:composition template="/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<p>The tag <code class="language-markup">&lt;tc:selectBooleanCheckbox/></code> generate a classic boolean
checkbox.</p>
<tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png"
link="#{apiController.tldBase}/#{apiController.currentRelease}/tld/tc/selectBooleanCheckbox.html"/>
<tc:section label="Basics">
<demo-highlight language="markup">&lt;tc:selectBooleanCheckbox label="Checkbox" value="true"/&gt;</demo-highlight>
<tc:selectBooleanCheckbox id="s1" label="Normal Checkbox" value="true"/>
<tc:selectBooleanCheckbox id="s2" label="Read Only" readonly="true" value="true"/>
<tc:selectBooleanCheckbox id="s3" label="Disabled" disabled="true" value="true"/>
<tc:selectBooleanCheckbox id="s4" label="Required" required="true" value="true"/>
</tc:section>
<tc:section label="ItemLabel">
<tc:selectBooleanCheckbox id="checkboxItemlabel1" itemLabel="Normal Checkbox" value="true"/>
<tc:selectBooleanCheckbox id="checkboxItemlabel11" label="Large Label" itemLabel="Item Label" value="true"/>
<tc:selectBooleanCheckbox id="checkboxItemlabel2" itemLabel="Read Only" readonly="true" value="true"/>
<tc:selectBooleanCheckbox id="checkboxItemlabel3" itemLabel="Disabled" disabled="true" value="true"/>
<tc:selectBooleanCheckbox id="checkboxItemlabel4" itemLabel="Required" required="true" value="true"/>
</tc:section>
<tc:section label="Simple Usage">
<p>In this example, the selected items are displayed in an output field after the submit-button is pressed.</p>
<demo-highlight language="markup">&lt;tc:selectBooleanCheckbox label="A" value="\#{selectBooleanCheckboxController.a}"/>
&lt;tc:out label="Selected items: " value="\#{selectBooleanCheckboxController.selectedItems}"/></demo-highlight>
<tc:selectBooleanCheckbox id="selectA" label="A" value="#{selectBooleanCheckboxController.a}"/>
<tc:selectBooleanCheckbox id="selectB" label="B" value="#{selectBooleanCheckboxController.b}"/>
<tc:selectBooleanCheckbox id="selectC" label="C" value="#{selectBooleanCheckboxController.c}"/>
<tc:out id="submitOutput" label="Selected items: " value="#{selectBooleanCheckboxController.selectedItems}"/>
<tc:button id="submit" label="Submit"/>
</tc:section>
<tc:section label="Ajax">
<p>The output fields always shows the current value of the checkbox.
With <code class="language-markup">&lt;f:ajax render="output"/></code>, the output field will be rerendered,
after the value changed in the
<code class="language-markup">&lt;tc:selectBooleanCheckbox label="Character" value="#{selectBooleanCheckboxController.d}"/></code>.
The ID of the output field and the value in the <code>render</code> attribute of the ajax tag
has to be the same.</p>
<tc:selectBooleanCheckbox id="selectD" label="D" value="#{selectBooleanCheckboxController.d}">
<f:ajax render="outputD"/>
</tc:selectBooleanCheckbox>
<tc:out id="outputD" label="Value is" value="#{selectBooleanCheckboxController.d}"/>
<tc:selectBooleanCheckbox id="selectE" label="E" value="#{selectBooleanCheckboxController.e}">
<f:ajax render="outputE"/>
</tc:selectBooleanCheckbox>
<tc:out id="outputE" label="Value is" value="#{selectBooleanCheckboxController.e}"/>
<tc:selectBooleanCheckbox id="selectF" label="F" value="#{selectBooleanCheckboxController.f}">
<f:ajax render="outputF"/>
</tc:selectBooleanCheckbox>
<tc:out id="outputF" label="Value is" value="#{selectBooleanCheckboxController.f}"/>
</tc:section>
<tc:section label="Images">
<demo-highlight language="markup">&lt;tc:selectBooleanCheckbox itemLabel="Japanese Yen" itemImage="#{request.contextPath}/image/JPY-14.png"/>
&lt;tc:selectBooleanCheckbox itemLabel="Trinidad &amp; Tobago Dollar" itemImage="#{request.contextPath}/image/TTD-14.png"/>
&lt;tc:selectBooleanCheckbox itemLabel="US Dollar" itemImage="#{request.contextPath}/image/USD-14.png"/>
&lt;tc:selectBooleanCheckbox itemLabel="Euro" itemImage="#{request.contextPath}/image/EUR-14.png"/></demo-highlight>
<tc:selectBooleanCheckbox itemLabel="Japanese Yen" itemImage="#{request.contextPath}/image/JPY-14.png"/>
<tc:selectBooleanCheckbox itemLabel="Trinidad &amp; Tobago Dollar" itemImage="#{request.contextPath}/image/TTD-14.png"/>
<tc:selectBooleanCheckbox itemLabel="US Dollar" itemImage="#{request.contextPath}/image/USD-14.png"/>
<tc:selectBooleanCheckbox itemLabel="Euro" itemImage="#{request.contextPath}/image/EUR-14.png"/>
</tc:section>
</ui:composition>