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/forms.html#the-progress-element">&lt;progress&gt;</a>
023 * element.
024 *
025 * <p>
026 * The progress element represents the completion progress of a task. It is used to display
027 * the progress of an operation, such as file uploads, downloads, or any other task that
028 * has a defined completion state. The progress element can show both determinate progress
029 * (when the total amount of work is known) and indeterminate progress (when the total amount
030 * of work is unknown). It is typically rendered as a progress bar that fills up as the task
031 * progresses.
032 *
033 * <h5 class='section'>Examples:</h5>
034 * <p class='bcode w800'>
035 *    <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*;
036 *
037 *    <jc>// Simple progress bar</jc>
038 *    Progress <jv>simple</jv> = <jsm>progress</jsm>()
039 *       .value(50)
040 *       .max(100);
041 *
042 *    <jc>// Progress with styling</jc>
043 *    Progress <jv>styled</jv> = <jsm>progress</jsm>()
044 *       .class_(<js>"file-upload-progress"</js>)
045 *       .value(75)
046 *       .max(100);
047 *
048 *    <jc>// Progress with complex content</jc>
049 *    Progress <jv>complex</jv> = <jsm>progress</jsm>(<js>"60% complete"</js>)
050 *       .value(60)
051 *       .max(100);
052 *
053 *    <jc>// Progress with ID</jc>
054 *    Progress <jv>withId</jv> = <jsm>progress</jsm>()
055 *       .id(<js>"download-progress"</js>)
056 *       .value(30)
057 *       .max(100);
058 *
059 *    <jc>// Progress with styling</jc>
060 *    Progress <jv>styled2</jv> = <jsm>progress</jsm>()
061 *       .style(<js>"width: 300px; height: 20px;"</js>)
062 *       .value(40)
063 *       .max(100);
064 *
065 *    <jc>// Progress with multiple attributes</jc>
066 *    Progress <jv>multiple</jv> = <jsm>progress</jsm>(<js>"85% complete"</js>)
067 *       .value(85)
068 *       .max(100)
069 *       .title(<js>"Upload Progress: 85%"</js>);
070 *
071 *    <jc>// Progress with form</jc>
072 *    Progress <jv>withForm</jv> = <jsm>progress</jsm>()
073 *       .form(<js>"upload-form"</js>)
074 *       .value(25)
075 *       .max(100);
076 *
077 *    // Indeterminate progress
078 *    Progress indeterminate = new Progress()
079 *       .children("Loading...");
080 * </p>
081 *
082 * <h5 class='section'>See Also:</h5><ul>
083 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a>
084 * </ul>
085 */
086@Marshalled(typeName = "progress")
087public class Progress extends HtmlElementMixed<Progress> {
088
089   /**
090    * Creates an empty {@link Progress} element.
091    */
092   public Progress() {}
093
094   /**
095    * Creates a {@link Progress} element with the specified child nodes.
096    *
097    * @param children The child nodes. Must not be <jk>null</jk>.
098    */
099   public Progress(Object...children) {
100      children(children);
101   }
102
103   /**
104    * <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#attr-progress-max">max</a> attribute.
105    *
106    * <p>
107    * Upper bound of range.
108    *
109    * @param value
110    *    The new value for this attribute.
111    *    Typically a {@link Number} or {@link String}.
112    *    Can be <jk>null</jk> to unset the attribute.
113    * @return This object.
114    */
115   public Progress max(Object value) {
116      attr("max", value);
117      return this;
118   }
119
120   /**
121    * <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#attr-progress-value">value</a> attribute.
122    *
123    * <p>
124    * Current value of the element.
125    *
126    * @param value
127    *    The new value for this attribute.
128    *    Typically a {@link Number} or {@link String}.
129    *    Can be <jk>null</jk> to unset the attribute.
130    * @return This object.
131    */
132   public Progress value(Object value) {
133      attr("value", value);
134      return this;
135   }
136}