001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.html5; 018 019import org.apache.juneau.marshall.*; 020 021/** 022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/tabular-data.html#the-thead-element"><thead></a> 023 * element. 024 * 025 * <p> 026 * The thead element represents a group of rows that consist of the column labels (headers) for 027 * the parent table element. It is used to group header rows of a table, separating them from the 028 * body (tbody) and footer (tfoot) sections. The thead element can contain multiple tr elements 029 * and is typically used to display column headers and other header information. 030 * 031 * <h5 class='section'>Examples:</h5> 032 * <p class='bcode w800'> 033 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 034 * 035 * <jc>// Simple table header</jc> 036 * Thead <jv>simple</jv> = <jsm>thead</jsm>( 037 * <jsm>tr</jsm>( 038 * <jsm>th</jsm>(<js>"Name"</js>), 039 * <jsm>th</jsm>(<js>"Age"</js>), 040 * <jsm>th</jsm>(<js>"City"</js>) 041 * ) 042 * ); 043 * 044 * <jc>// Table header with styling</jc> 045 * Thead <jv>styled</jv> = <jsm>thead</jsm>( 046 * <jsm>tr</jsm>( 047 * <jsm>th</jsm>(<js>"Product"</js>), 048 * <jsm>th</jsm>(<js>"Price"</js>), 049 * <jsm>th</jsm>(<js>"Stock"</js>) 050 * ) 051 * ).class_(<js>"table-header"</js>); 052 * 053 * <jc>// Table header with multiple rows</jc> 054 * Thead <jv>multiple</jv> = <jsm>thead</jsm>( 055 * <jsm>tr</jsm>( 056 * <jsm>th</jsm>(<js>"Contact Information"</js>).colspan(2), 057 * <jsm>th</jsm>(<js>"Address"</js>).colspan(2) 058 * ), 059 * new Tr() 060 * .children( 061 * new Th().children("Name"), 062 * new Th().children("Phone"), 063 * new Th().children("Street"), 064 * new Th().children("City") 065 * ) 066 * ); 067 * 068 * // Table header with sorting 069 * Thead sortable = new Thead() 070 * .children( 071 * new Tr() 072 * .children( 073 * new Th().sorted("asc").children("Name"), 074 * new Th().sorted("desc").children("Date"), 075 * new Th().children("Status") 076 * ) 077 * ); 078 * 079 * // Table header with accessibility 080 * Thead accessible = new Thead() 081 * .children( 082 * new Tr() 083 * .children( 084 * new Th().scope("col").children("ID"), 085 * new Th().scope("col").children("Description"), 086 * new Th().scope("col").children("Amount") 087 * ) 088 * ); 089 * </p> 090 * 091 * <h5 class='section'>See Also:</h5><ul> 092 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 093 * </ul> 094 */ 095@Marshalled(typeName = "thead") 096public class Thead extends HtmlElementContainer<Thead> { 097 098 /** 099 * Creates an empty {@link Thead} element. 100 */ 101 public Thead() {} 102 103 /** 104 * Creates a {@link Thead} element with the specified child nodes. 105 * 106 * @param children The child nodes. Must not be <jk>null</jk>. 107 */ 108 public Thead(Object...children) { 109 children(children); 110 } 111 112}