Class ProgressBar

java.lang.Object
com.jalios.jcms.uicomponent.ProgressBar

public class ProgressBar extends Object
Represents a configurable progress bar UI component.

This object centralizes all logic used by the JSP rendering: CSS classes, label presence, percentage formatting, and color level handling. The JSP must only render what this class exposes (no business logic).

Since:
jplatform-11.0.0
  • Constructor Details

    • ProgressBar

      public ProgressBar(int percentage, String topLeftLabel, String topRightLabel, String bottomLeftLabel, String bottomRightLabel, ColorLevel level)
      Creates a new ProgressBar instance.
      Parameters:
      percentage - the progress percentage (0–100)
      topLeftLabel - optional label displayed in the top-left position
      topRightLabel - optional label displayed in the top-right position
      bottomLeftLabel - optional label displayed in the bottom-left position
      bottomRightLabel - optional label displayed in the bottom-right position
      level - semantic color level (SUCCESS, WARNING, ERROR, ...)
  • Method Details

    • getLevelCss

      public String getLevelCss()
      Returns the CSS class associated with the semantic color level.
      Returns:
      the Bootstrap-like class for this level (e.g., "bg-success"), or an empty string if no specific level is set.
    • hasAnyLabel

      public boolean hasAnyLabel()
      Indicates whether at least one label is defined.
      Returns:
      true if any label exists, false otherwise.
    • hasDoubleLabels

      public boolean hasDoubleLabels()
      Indicates whether both top-left and top-right labels are present.
      Returns:
      true if both top labels exist, false otherwise.
    • hasTopLabel

      public boolean hasTopLabel()
      Indicates whether a top-left label or a top-right label is present.
      Returns:
      true if at least one top label exists (top-left or top-right), false otherwise.
    • hasBottomLabel

      public boolean hasBottomLabel()
      Indicates whether either the bottom-left label or the bottom-right label is present.
      Returns:
      true if the bottom-left label OR the bottom-right label exists, false otherwise.
    • getWrapperCss

      public String getWrapperCss()
      Returns all CSS classes required by the progress bar wrapper.

      This allows the JSP to simply print:

      <div class="progress-wrapper ${progress.wrapperCss}">
      Returns:
      a space-separated list of CSS classes.
    • getPercentageLabel

      public String getPercentageLabel()
      Returns the formatted percentage label.
      Returns:
      a string such as "70%".
    • getPercentage

      public int getPercentage()
    • setPercentage

      public void setPercentage(int percentage)
    • getProgressLabel

      public String getProgressLabel()
    • setProgressLabel

      public void setProgressLabel(String progressLabel)
    • getTopLeftLabel

      public String getTopLeftLabel()
    • setTopLeftLabel

      public void setTopLeftLabel(String topLeftLabel)
    • getTopRightLabel

      public String getTopRightLabel()
    • setTopRightLabel

      public void setTopRightLabel(String topRightLabel)
    • getBottomLeftLabel

      public String getBottomLeftLabel()
    • setBottomLeftLabel

      public void setBottomLeftLabel(String bottomLeftLabel)
    • getBottomRightLabel

      public String getBottomRightLabel()
    • setBottomRightLabel

      public void setBottomRightLabel(String bottomRightLabel)
    • getLevel

      public ColorLevel getLevel()
    • setLevel

      public void setLevel(ColorLevel level)