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-caption-element"><caption></a> 023 * element. 024 * 025 * <p> 026 * The caption element represents the title of a table. It is used to provide a brief description or 027 * title for the table content, making it easier for users to understand what the table contains. 028 * The caption element should be placed as the first child of a table element and is typically 029 * rendered above the table by default. 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 caption</jc> 036 * Caption <jv>simple</jv> = <jsm>caption</jsm>(<js>"Monthly Sales Report"</js>); 037 * 038 * <jc>// Table caption with styling</jc> 039 * Caption <jv>styled</jv> = <jsm>caption</jsm>(<js>"Employee Directory"</js>) 040 * .class_(<js>"table-title"</js>); 041 * 042 * <jc>// Table caption with complex content</jc> 043 * Caption <jv>complex</jv> = <jsm>caption</jsm>( 044 * <js>"Sales Data for "</js>, 045 * <jsm>strong</jsm>(<js>"Q1 2024"</js>), 046 * <js>" - "</js>, 047 * <jsm>em</jsm>(<js>"Preliminary Results"</js>) 048 * ); 049 * 050 * <jc>// Table caption with links</jc> 051 * Caption <jv>withLinks</jv> = <jsm>caption</jsm>( 052 * <js>"Product Inventory - "</js>, 053 * <jsm>a</jsm>(<js>"/help/inventory"</js>, <js>"Help"</js>), 054 * <js>" | "</js>, 055 * <jsm>a</jsm>(<js>"/export/inventory"</js>, <js>"Export"</js>) 056 * ); 057 * 058 * <jc>// Table caption with icons</jc> 059 * Caption <jv>withIcons</jv> = <jsm>caption</jsm>( 060 * <js>"📊 "</js>, 061 * <js>"Financial Summary"</js>, 062 * <js>" "</js>, 063 * <jsm>span</jsm>().class_(<js>"icon"</js>).children(<js>"💰"</js>) 064 * ); 065 * 066 * <jc>// Table caption with multiple lines</jc> 067 * Caption <jv>multiLine</jv> = <jsm>caption</jsm>( 068 * <js>"Customer Contact Information"</js>, 069 * <jsm>br</jsm>(), 070 * <js>"Last Updated: "</js>, 071 * <jsm>time</jsm>(<js>"2024-01-15"</js>, <js>"January 15, 2024"</js>) 072 * ); 073 * </p> 074 * 075 * <p> 076 * The following convenience methods are provided for constructing instances of this bean: 077 * <ul class='javatree'> 078 * <li class='jc'>{@link HtmlBuilder} 079 * <ul class='javatree'> 080 * <li class='jm'>{@link HtmlBuilder#caption() caption()} 081 * <li class='jm'>{@link HtmlBuilder#caption(Object...) caption(Object...)} 082 * </ul> 083 * </ul> 084 * </p> 085 * 086 * <h5 class='section'>See Also:</h5><ul> 087 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 088 * </ul> 089 */ 090@Marshalled(typeName = "caption") 091public class Caption extends HtmlElementMixed<Caption> { 092 093 /** 094 * Creates an empty {@link Caption} element. 095 */ 096 public Caption() {} 097 098 /** 099 * Creates a {@link Caption} element with the specified child nodes. 100 * 101 * @param children The child nodes. 102 */ 103 public Caption(Object...children) { 104 children(children); 105 } 106 107}