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/grouping-content.html#the-main-element"><main></a> 023 * element. 024 * 025 * <p> 026 * The main element represents the main content of the body of a document or application. It is 027 * used to identify the primary content of the page, excluding content that is repeated across 028 * multiple pages such as navigation, headers, footers, and sidebars. The main element should 029 * be used only once per page and contains the central topic or functionality of the page. It 030 * is important for accessibility and helps screen readers identify the main content area. 031 * 032 * <h5 class='section'>Examples:</h5> 033 * <p class='bcode w800'> 034 * <jc>// Simple main content</jc> 035 * Main <jv>simple</jv> = <jsm>main</jsm>( 036 * <jsm>h1</jsm>(<js>"Welcome to Our Site"</js>), 037 * <jsm>p</jsm>(<js>"This is the main content of our page."</js>) 038 * ); 039 * 040 * <jc>// Main with styling</jc> 041 * Main <jv>styled</jv> = <jsm>main</jsm>( 042 * <jsm>h1</jsm>(<js>"About Us"</js>), 043 * <jsm>p</jsm>(<js>"Learn more about our company and mission."</js>) 044 * ).class_(<js>"main-content"</js>); 045 * 046 * <jc>// Main with complex content</jc> 047 * Main <jv>complex</jv> = <jsm>main</jsm>( 048 * <jsm>h1</jsm>(<js>"Product Catalog"</js>), 049 * <jsm>section</jsm>( 050 * <jsm>h2</jsm>(<js>"Featured Products"</js>), 051 * <jsm>p</jsm>(<js>"Check out our latest offerings."</js>) 052 * ), 053 * <jsm>section</jsm>( 054 * <jsm>h2</jsm>(<js>"Categories"</js>), 055 * <jsm>ul</jsm>( 056 * <jsm>li</jsm>(<js>"Electronics"</js>), 057 * <jsm>li</jsm>(<js>"Clothing"</js>), 058 * <jsm>li</jsm>(<js>"Books"</js>) 059 * ) 060 * ) 061 * ); 062 * 063 * <jc>// Main with ID</jc> 064 * Main <jv>withId</jv> = <jsm>main</jsm>( 065 * <jsm>h1</jsm>(<js>"Main Content"</js>), 066 * <jsm>p</jsm>(<js>"This is the main content area."</js>) 067 * ).id(<js>"page-main"</js>); 068 * 069 * <jc>// Main with styling</jc> 070 * Main <jv>styled2</jv> = <jsm>main</jsm>( 071 * <jsm>h1</jsm>(<js>"Centered Content"</js>), 072 * <jsm>p</jsm>(<js>"This content is centered and styled."</js>) 073 * ).style(<js>"max-width: 800px; margin: 0 auto; padding: 20px;"</js>); 074 * 075 * <jc>// Main with multiple sections</jc> 076 * Main <jv>multiSection</jv> = <jsm>main</jsm>( 077 * <jsm>section</jsm>( 078 * <jsm>h1</jsm>(<js>"Page Title"</js>), 079 * <jsm>p</jsm>(<js>"Introduction to the page content."</js>) 080 * ), 081 * <jsm>section</jsm>( 082 * <jsm>h2</jsm>(<js>"Content Section"</js>), 083 * <jsm>p</jsm>(<js>"Detailed content goes here."</js>) 084 * ), 085 * <jsm>section</jsm>( 086 * <jsm>h2</jsm>(<js>"Conclusion"</js>), 087 * <jsm>p</jsm>(<js>"Summary and closing thoughts."</js>) 088 * ) 089 * ); 090 * 091 * <jc>// Main with article</jc> 092 * Main <jv>withArticle</jv> = <jsm>main</jsm>( 093 * <jsm>article</jsm>( 094 * <jsm>h1</jsm>(<js>"Article Title"</js>), 095 * <jsm>p</jsm>(<js>"Article content goes here."</js>), 096 * <jsm>footer</jsm>(<js>"Article footer"</js>) 097 * ) 098 * ); 099 * </p> 100 * 101 * <h5 class='section'>See Also:</h5><ul> 102 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 103 * </ul> 104 */ 105@Marshalled(typeName = "main") 106public class Main extends HtmlElementContainer<Main> { 107 108 /** 109 * Creates an empty {@link Main} element. 110 */ 111 public Main() {} 112 113 /** 114 * Creates a {@link Main} element with the specified child nodes. 115 * 116 * @param children The child nodes. 117 */ 118 public Main(Object...children) { 119 children(children); 120 } 121 122}