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 org.apache.juneau.annotation.*; 016 017/** 018 * DTO for an HTML {@doc ExtHTML5.scripting-1#the-canvas-element <canvas>} 019 * element. 020 * 021 * <ul class='seealso'> 022 * <li class='link'>{@doc DtoHtml5} 023 * </ul> 024 */ 025@Bean(typeName="canvas") 026public class Canvas extends HtmlElementContainer { 027 028 /** 029 * Creates an empty {@link Canvas} element. 030 */ 031 public Canvas() {} 032 033 /** 034 * Creates a {@link Canvas} element with the specified {@link Canvas#width(Object)} and 035 * {@link Canvas#height(Object)} attributes. 036 * 037 * @param width The {@link Canvas#width(Object)} attribute. 038 * @param height The {@link Canvas#height(Object)} attribute. 039 */ 040 public Canvas(Number width, Number height) { 041 width(width).height(height); 042 } 043 044 /** 045 * {@doc ExtHTML5.scripting-1#attr-canvas-height height} attribute. 046 * 047 * <p> 048 * Vertical dimension. 049 * 050 * @param height 051 * The new value for this attribute. 052 * Typically a {@link Number} or {@link String}. 053 * @return This object (for method chaining). 054 */ 055 public final Canvas height(Object height) { 056 attr("height", height); 057 return this; 058 } 059 060 /** 061 * {@doc ExtHTML5.scripting-1#attr-canvas-width width} attribute. 062 * 063 * <p> 064 * Horizontal dimension. 065 * 066 * @param width 067 * The new value for this attribute. 068 * Typically a {@link Number} or {@link String}. 069 * @return This object (for method chaining). 070 */ 071 public final Canvas width(Object width) { 072 attr("width", width); 073 return this; 074 } 075 076 077 //----------------------------------------------------------------------------------------------------------------- 078 // Overridden methods 079 //----------------------------------------------------------------------------------------------------------------- 080 081 @Override /* HtmlElement */ 082 public final Canvas _class(String _class) { 083 super._class(_class); 084 return this; 085 } 086 087 @Override /* HtmlElement */ 088 public final Canvas id(String id) { 089 super.id(id); 090 return this; 091 } 092 093 @Override /* HtmlElement */ 094 public final Canvas style(String style) { 095 super.style(style); 096 return this; 097 } 098 099 @Override /* HtmlElementContainer */ 100 public final Canvas children(Object...children) { 101 super.children(children); 102 return this; 103 } 104 105 @Override /* HtmlElementContainer */ 106 public final Canvas child(Object child) { 107 super.child(child); 108 return this; 109 } 110}