001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.dto.html5; 014 015import static org.apache.juneau.internal.StringUtils.*; 016 017import org.apache.juneau.annotation.*; 018 019/** 020 * DTO for an HTML {@doc ExtHTML5.document-metadata#the-style-element <style>} 021 * element. 022 * 023 * <ul class='seealso'> 024 * <li class='link'>{@doc DtoHtml5} 025 * </ul> 026 */ 027@Bean(typeName="style") 028public class Style extends HtmlElementRawText { 029 030 /** 031 * Creates an empty {@link Style} element. 032 */ 033 public Style() {} 034 035 /** 036 * Creates a {@link Style} element with the specified {@link Style#text(Object)} node. 037 * 038 * @param text The {@link Style#text(Object)} node. 039 */ 040 public Style(Object text) { 041 text(text); 042 } 043 044 /** 045 * Creates a {@link Style} element with the specified inner text. 046 * 047 * @param text 048 * The contents of the style element. 049 * <br>Values will be concatenated with newlines. 050 */ 051 public Style(String...text) { 052 text(joinnl(text)); 053 } 054 055 /** 056 * {@doc ExtHTML5.document-metadata#attr-style-media media} attribute. 057 * 058 * <p> 059 * Applicable media. 060 * 061 * @param media The new value for this attribute. 062 * @return This object (for method chaining). 063 */ 064 public final Style media(String media) { 065 attr("media", media); 066 return this; 067 } 068 069 /** 070 * {@doc ExtHTML5.document-metadata#attr-style-type type} attribute. 071 * 072 * <p> 073 * Type of embedded resource. 074 * 075 * @param type The new value for this attribute. 076 * @return This object (for method chaining). 077 */ 078 public final Style type(String type) { 079 attr("type", type); 080 return this; 081 } 082 083 084 //----------------------------------------------------------------------------------------------------------------- 085 // Overridden methods 086 //----------------------------------------------------------------------------------------------------------------- 087 088 @Override /* HtmlElement */ 089 public final Style _class(String _class) { 090 super._class(_class); 091 return this; 092 } 093 094 @Override /* HtmlElement */ 095 public final Style style(String style) { 096 super.style(style); 097 return this; 098 } 099 100 @Override /* HtmlElement */ 101 public final Style id(String id) { 102 super.id(id); 103 return this; 104 } 105 106 @Override /* HtmlElementText */ 107 public final Style text(Object text) { 108 super.text(text); 109 return this; 110 } 111}