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/sections.html#the-header-element"><header></a> 023 * element. 024 * 025 * <p> 026 * The header element represents introductory content for its nearest ancestor sectioning content 027 * or sectioning root element. It is used to contain introductory content such as headings, 028 * navigation, logos, or other introductory elements. The header element can contain any flow 029 * content and is typically used at the top of a page, article, or section to provide context 030 * and navigation. 031 * 032 * <h5 class='section'>Examples:</h5> 033 * <p class='bcode w800'> 034 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 035 * 036 * <jc>// Simple page header</jc> 037 * Header <jv>simple</jv> = <jsm>header</jsm>( 038 * <jsm>h1</jsm>(<js>"My Website"</js>), 039 * <jsm>p</jsm>(<js>"Welcome to our site"</js>) 040 * ); 041 * 042 * <jc>// Header with navigation</jc> 043 * Header <jv>withNav</jv> = <jsm>header</jsm>( 044 * <jsm>h1</jsm>(<js>"Company Name"</js>), 045 * <jsm>nav</jsm>( 046 * <jsm>ul</jsm>( 047 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/home"</js>).children(<js>"Home"</js>)), 048 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/about"</js>).children(<js>"About"</js>)), 049 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/contact"</js>).children(<js>"Contact"</js>)) 050 * ) 051 * ) 052 * ); 053 * 054 * <jc>// Header with styling</jc> 055 * Header <jv>styled</jv> = <jsm>header</jsm>( 056 * <jsm>h1</jsm>(<js>"Styled Header"</js>), 057 * <jsm>p</jsm>(<js>"A beautifully styled header"</js>) 058 * ).class_(<js>"page-header"</js>); 059 * 060 * <jc>// Header with logo and navigation</jc> 061 * Header <jv>withLogo</jv> = <jsm>header</jsm>( 062 * <jsm>img</jsm>(<js>"/logo.png"</js>, <js>"Company Logo"</js>), 063 * <jsm>h1</jsm>(<js>"Company Name"</js>), 064 * <jsm>nav</jsm>( 065 * <jsm>ul</jsm>( 066 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/products"</js>).children(<js>"Products"</js>)), 067 * <jsm>li</jsm>(<jsm>a</jsm>(<js>"/services"</js>).children(<js>"Services"</js>)) 068 * ) 069 * ) 070 * ); 071 * 072 * <jc>// Header with ID</jc> 073 * Header <jv>withId</jv> = <jsm>header</jsm>( 074 * <jsm>h1</jsm>(<js>"Main Header"</js>), 075 * <jsm>p</jsm>(<js>"This is the main header of the page"</js>) 076 * ).id(<js>"main-header"</js>); 077 * 078 * <jc>// Header with styling</jc> 079 * Header <jv>styled2</jv> = <jsm>header</jsm>( 080 * <jsm>h1</jsm>(<js>"Dark Header"</js>), 081 * <jsm>p</jsm>(<js>"A header with dark styling"</js>) 082 * ).style(<js>"background-color: #333; color: white; padding: 20px;"</js>); 083 * 084 * <jc>// Header with multiple sections</jc> 085 * Header <jv>multiSection</jv> = <jsm>header</jsm>( 086 * <jsm>div</jsm>().class_(<js>"header-top"</js>).children( 087 * <jsm>p</jsm>(<js>"Call us: (555) 123-4567"</js>), 088 * <jsm>p</jsm>(<js>"Email: info@company.com"</js>) 089 * ), 090 * <jsm>div</jsm>().class_(<js>"header-main"</js>).children( 091 * <jsm>h1</jsm>(<js>"Company Name"</js>), 092 * <jsm>p</jsm>(<js>"Your trusted partner"</js>) 093 * ) 094 * ); 095 * </p> 096 * 097 * <p> 098 * The following convenience methods are provided for constructing instances of this bean: 099 * <ul class='javatree'> 100 * <li class='jc'>{@link HtmlBuilder} 101 * <ul class='javatree'> 102 * <li class='jm'>{@link HtmlBuilder#header() header()} 103 * <li class='jm'>{@link HtmlBuilder#header(Object...) header(Object...)} 104 * </ul> 105 * </ul> 106 * </p> 107 * 108 * <h5 class='section'>See Also:</h5><ul> 109 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 110 * </ul> 111 */ 112@Marshalled(typeName = "header") 113public class Header extends HtmlElementMixed<Header> { 114 115 /** 116 * Creates an empty {@link Header} element. 117 */ 118 public Header() {} 119 120 /** 121 * Creates a {@link Header} element with the specified child nodes. 122 * 123 * @param children The child nodes. 124 */ 125 public Header(Object...children) { 126 children(children); 127 } 128 129}