| <?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://java.sun.com/jsf/facelets"> |
| |
| <p>The flex layout can be used with the <code><tc:flexLayout/></code> tag. |
| The two most important attributes are <code>columns</code> and <code>rows</code>. |
| If both attributes are set, only <code>rows</code> has an effect.</p> |
| <tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png" |
| link="#{apiController.base}/doc/#{apiController.currentRelease}/tld/tc/flexLayout.html"/> |
| |
| <tc:section label="Basics"> |
| <p>If no attributes set, the behavior of the flex layout is like a flow layout.</p> |
| <tc:flexLayout> |
| <tc:button label="Button"/> |
| <tc:button label="Another Button"/> |
| <tc:button label="3rd Button"/> |
| <tc:button label="Some Button"/> |
| <tc:button label="Any Button"/> |
| </tc:flexLayout> |
| </tc:section> |
| |
| <tc:section label="Columns"> |
| <p>In this example, the <code>columns</code> attribute is set to '200px;auto;1*;2*;10rem'. |
| This means:</p> |
| <ul> |
| <li>Column 1: Width is always at 200px.</li> |
| <li>Column 2: Width is always the width of the button.</li> |
| <li>Column 3: The left space is filled with the remaining buttons in a ratio of 1:3 for this button.</li> |
| <li>Column 4: The left space is filled with the remaining buttons in a ratio of 2:3 for this button.</li> |
| <li>Column 5: Width is always set to 10rem.</li> |
| </ul> |
| <tc:flexLayout columns="200px auto 1fr 2fr 10rem"> |
| <tc:button label="200px"/> |
| <tc:button label="auto"/> |
| <tc:button label="1fr"/> |
| <tc:button label="2fr"/> |
| <tc:button label="10rem"/> |
| </tc:flexLayout> |
| </tc:section> |
| |
| <tc:section label="Rows"> |
| <p>The <code>rows</code> attribute is set to '100px;auto;1fr;2fr;1fr'. Also, the height of the flex layout is '400px'. |
| This means:</p> |
| <ul> |
| <li>Row 1: Height is always at 100px.</li> |
| <li>Row 2: Height is always the height of the button.</li> |
| <li>The left space is filled with the remaining buttons. |
| The fourth button is twice the size than button three and five. |
| </li> |
| </ul> |
| <tc:flexLayout rows="100px auto 1fr 2fr 1fr"> |
| <tc:style height="400px"/> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| </tc:flexLayout> |
| </tc:section> |
| |
| <tc:section label="Cascade"> |
| <p>You can also put a flex layout within a flex layout. In this case the second row is another flex layout.</p> |
| <tc:flexLayout rows="100px auto 80px 1fr"> |
| <tc:style height="400px"/> |
| <tc:button label="Button"/> |
| <tc:flexLayout columns="200px auto 1fr 2fr 1fr"> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| </tc:flexLayout> |
| <tc:button label="Button"/> |
| <tc:button label="Button"/> |
| </tc:flexLayout> |
| </tc:section> |
| </ui:composition> |