blob: 24ed25e507239a667fbda9b2753a8c7ac5e05990 [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">
<ui:param name="title" value="Styling inside a sheet"/>
<p>
Inside of <code>&lt;tc:row></code> and <code>&lt;tc:column></code> tags a <code>&lt;tc:style></code> can be used
to set a CSS class or style to a specific row. In this example the rows are green
(via customClass <code>planet</code>) when the object orbit is 'Sun'.
The cell in the year column is blue, when the objects discovering year is older than 1900 (custom class is
<code>old-planet</code>).
</p>
<tc:sheet value="#{sheetController.solarList}" var="object" rows="20" markup="small"
columns="#{sheetController.automaticLayout ? null : '1fr 1fr 1fr 1fr 1fr'}">
<tc:row>
<tc:style customClass="#{object.orbit eq 'Sun' ? 'planet' : ''}"/>
</tc:row>
<tc:column label="Name">
<tc:out value="#{object.name}" labelLayout="skip"/>
</tc:column>
<tc:column label="Orbit">
<tc:out value="#{object.orbit}" labelLayout="skip"/>
</tc:column>
<tc:column label="Period (Days)">
<tc:out value="#{object.period}" labelLayout="skip"/>
</tc:column>
<tc:column label="Discoverer">
<tc:out value="#{object.discoverer}" labelLayout="skip"/>
</tc:column>
<tc:column label="Year">
<tc:style customClass="#{object.discoverYear le 1900 ? 'old-planet' : ''}"/>
<tc:out value="#{object.discoverYear}" labelLayout="skip"/>
</tc:column>
</tc:sheet>
</ui:composition>