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-tr-element"><tr></a> 023 * element. 024 * 025 * <p> 026 * The tr element represents a row of cells in a table. It is used to group table cells (td and th elements) 027 * into horizontal rows. The tr element can contain multiple td (data cell) or th (header cell) elements, 028 * and is typically used within thead, tbody, or tfoot elements to organize table structure. 029 * 030 * <h5 class='section'>Examples:</h5> 031 * <p class='bcode w800'> 032 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 033 * 034 * <jc>// Simple table row with data cells</jc> 035 * Tr <jv>simple</jv> = <jsm>tr</jsm>( 036 * <jsm>td</jsm>(<js>"John"</js>), 037 * <jsm>td</jsm>(<js>"25"</js>), 038 * <jsm>td</jsm>(<js>"New York"</js>) 039 * ); 040 * 041 * <jc>// Table row with header cells</jc> 042 * Tr <jv>header</jv> = <jsm>tr</jsm>( 043 * <jsm>th</jsm>(<js>"Name"</js>), 044 * <jsm>th</jsm>(<js>"Age"</js>), 045 * <jsm>th</jsm>(<js>"City"</js>) 046 * ); 047 * 048 * <jc>// Table row with styling</jc> 049 * Tr <jv>styled</jv> = <jsm>tr</jsm>( 050 * <jsm>td</jsm>(<js>"Product A"</js>), 051 * <jsm>td</jsm>(<js>"100"</js>), 052 * <jsm>td</jsm>(<js>"$10.00"</js>) 053 * ).class_(<js>"highlight-row"</js>); 054 * 055 * <jc>// Table row with click handler</jc> 056 * Tr <jv>clickable</jv> = <jsm>tr</jsm>( 057 * <jsm>td</jsm>(<js>"Clickable Row"</js>) 058 * ).onclick(<js>"selectRow(this)"</js>); 059 * 060 * <jc>// Table row with mixed cell types</jc> 061 * Tr <jv>mixed</jv> = <jsm>tr</jsm>( 062 * <jsm>th</jsm>(<js>"Total"</js>), 063 * <jsm>td</jsm>(<js>"$1,000"</js>), 064 * <jsm>td</jsm>(<js>"$2,000"</js>) 065 * ); 066 * 067 * <jc>// Table row with complex content</jc> 068 * Tr <jv>complex</jv> = <jsm>tr</jsm>( 069 * <jsm>td</jsm>( 070 * <jsm>strong</jsm>(<js>"Important"</js>), 071 * <js>" data"</js> 072 * ), 073 * <jsm>td</jsm>(<js>"Value"</js>) 074 * ); 075 * </p> 076 * 077 * <p> 078 * The following convenience methods are provided for constructing instances of this bean: 079 * <ul class='javatree'> 080 * <li class='jc'>{@link HtmlBuilder} 081 * <ul class='javatree'> 082 * <li class='jm'>{@link HtmlBuilder#tr() tr()} 083 * <li class='jm'>{@link HtmlBuilder#tr(Object...) tr(Object...)} 084 * </ul> 085 * </ul> 086 * </p> 087 * 088 * <h5 class='section'>See Also:</h5><ul> 089 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 090 * </ul> 091 */ 092@Marshalled(typeName = "tr") 093public class Tr extends HtmlElementContainer<Tr> { 094 095 /** 096 * Creates an empty {@link Tr} element. 097 */ 098 public Tr() {} 099 100 /** 101 * Creates a {@link Tr} element with the specified child nodes. 102 * 103 * @param children The child nodes. Must not be <jk>null</jk>. 104 */ 105 public Tr(Object...children) { 106 children(children); 107 } 108 109}