Class Progress<T extends Progress<T>>


public class Progress<T extends Progress<T>> extends PhrasingContentElement<T>
Represents an HTML <progress> element that displays the completion progress of a task.

The <progress> element provides a visual indicator of task completion, such as file uploads, form submissions, or loading operations. It displays a progress bar that can be updated dynamically to reflect the current state of an ongoing operation.

Features:

  • Visual progress bar representation
  • Configurable maximum and current values
  • Supports determinate progress (known completion percentage)
  • Supports indeterminate progress (unknown completion time)
  • Can be styled with CSS for custom appearance
  • Semantic representation of task completion

Usage:


 // Determinate progress bar (50% complete)
 Progress fileUpload = new Progress();
 fileUpload.setMax(100);
 fileUpload.setValue(50);

 // Download progress
 Progress download = new Progress();
 download.setMax(1024);  // Total KB
 download.setValue(256);  // Downloaded KB

 // Indeterminate progress (no value set)
 Progress loading = new Progress();
 loading.setMax(100);
 // No setValue call means indeterminate state

 // Progress with text label
 Progress withLabel = new Progress();
 withLabel.setMax(100);
 withLabel.setValue(75);
 withLabel.addText("75% complete");

 // Dynamic progress update (would be done via JavaScript)
 Progress dynamic = new Progress();
 dynamic.setId("uploadProgress");
 dynamic.setMax(100);
 dynamic.setValue(0);
 // JavaScript: document.getElementById('uploadProgress').value = 45;
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Progress

      public Progress()
      Constructs a new Progress element.

      Creates an HTML <progress> element. The max and value should be set to configure the progress indicator. If no value is set, the progress bar will be indeterminate.

  • Method Details

    • setMax

      public void setMax(int max)
      Sets the maximum value of the progress bar.

      The max attribute specifies the total amount of work required for the task. Together with the value attribute, this determines the completion percentage. For example, if max is 100 and value is 25, the progress bar shows 25% complete.

      Parameters:
      max - the maximum value representing 100% completion
    • setValue

      public void setValue(int value)
      Sets the current value of the progress bar.

      The value attribute specifies how much of the task has been completed. This must be between 0 and the max value. If the value attribute is omitted, the progress bar is indeterminate, indicating ongoing work without a known completion time.

      Parameters:
      value - the current progress value (between 0 and max)