| <?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:c="http://java.sun.com/jsp/jstl/core" |
| xmlns:tc="http://myfaces.apache.org/tobago/component" |
| xmlns:ui="http://java.sun.com/jsf/facelets"> |
| |
| <tc:section label="Test of the <tc:attribute mode='valueIfSet'>"> |
| |
| <tc:box label="Set value via <tc:attribute>"> |
| |
| <p> |
| The lable after the input field displays the expected string. |
| </p> |
| |
| <tc:segmentLayout medium="4seg 4seg 4seg"> |
| |
| <tc:label value="direct literal:"/> |
| <tc:in id="direct" label="literal value" labelLayout="segmentRight"> |
| <tc:attribute name="value" value="literal value" mode="valueIfSet"/> |
| </tc:in> |
| |
| <c:set var="value1" value="c:set variable"/> |
| <tc:label value="via c:set:"/> |
| <tc:in id="v1" label="c:set variable" labelLayout="segmentRight"> |
| <tc:attribute name="value" value="#{value1}" mode="valueIfSet"/> |
| </tc:in> |
| |
| <c:set var="value2" value="#{value1}"/> |
| <tc:label value="via c:set in c:set:"/> |
| <tc:in id="v2" label="c:set variable" labelLayout="segmentRight"> |
| <tc:attribute name="value" value="#{value2}" mode="valueIfSet"/> |
| </tc:in> |
| |
| <c:set var="value3" value="#{value1} with other text"/> |
| <tc:label value="via c:set in c:set with other text:"/> |
| <tc:in id="v3" label="c:set variable with other text" labelLayout="segmentRight"> |
| <tc:attribute name="value" value="#{value3}" mode="valueIfSet"/> |
| </tc:in> |
| |
| <c:set var="value4" value="#{attributeController.value}"/> |
| <tc:label value="java session variable"/> |
| <tc:in id="v4" label="value from model" labelLayout="segmentRight"> |
| <tc:attribute name="value" value="#{value4}" mode="valueIfSet"/> |
| </tc:in> |
| |
| <tc:label value="undefined variable (empty)"/> |
| <tc:in id="vu" label="" labelLayout="segmentRight"> |
| <tc:attribute name="value" value="#{value_undefined}" mode="valueIfSet"/> |
| </tc:in> |
| </tc:segmentLayout> |
| </tc:box> |
| |
| <tc:box label="Set id via <tc:attribute>" id="id-box"> |
| |
| <p> |
| The lable after the input field displays the expected id attribute. |
| </p> |
| |
| <tc:segmentLayout medium="4seg 4seg 4seg"> |
| |
| <tc:label value="id"/> |
| <tc:in label="page:mainForm:my_number_1::field" labelLayout="segmentRight"> |
| <tc:attribute name="id" value="my_number_1" mode="valueIfSet"/> |
| </tc:in> |
| |
| <tc:label value="id (not implemented)"/> |
| <tc:in label="'autogenerated'" labelLayout="segmentRight"> |
| <tc:attribute name="id" value="#{'my_number_2'}" mode="valueIfSet"/> |
| </tc:in> |
| |
| <c:set var="id3" value="my_number_3"/> |
| <tc:label value="id"/> |
| <tc:in label="page:mainForm:my_number_3::field" labelLayout="segmentRight"> |
| <tc:attribute name="id" value="#{id3}" mode="valueIfSet"/> |
| </tc:in> |
| |
| <tc:label value="id (undefined)"/> |
| <tc:in label="'autogenerated'" labelLayout="segmentRight"> |
| <tc:attribute name="id" value="#{id_undefined}" mode="valueIfSet"/> |
| </tc:in> |
| |
| </tc:segmentLayout> |
| </tc:box> |
| |
| </tc:section> |
| |
| </ui:composition> |