Package com.jalios.jcms.uicomponent
Class ProgressBar
java.lang.Object
com.jalios.jcms.uicomponent.ProgressBar
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 Summary
ConstructorsConstructorDescriptionProgressBar(int percentage, String topLeftLabel, String topRightLabel, String bottomLeftLabel, String bottomRightLabel, ColorLevel level) Creates a new ProgressBar instance. -
Method Summary
Modifier and TypeMethodDescriptiongetLevel()Returns the CSS class associated with the semantic color level.intReturns the formatted percentage label.Returns all CSS classes required by the progress bar wrapper.booleanIndicates whether at least one label is defined.booleanIndicates whether either the bottom-left label or the bottom-right label is present.booleanIndicates whether both top-left and top-right labels are present.booleanIndicates whether a top-left label or a top-right label is present.voidsetBottomLeftLabel(String bottomLeftLabel) voidsetBottomRightLabel(String bottomRightLabel) voidsetLevel(ColorLevel level) voidsetPercentage(int percentage) voidsetProgressLabel(String progressLabel) voidsetTopLeftLabel(String topLeftLabel) voidsetTopRightLabel(String topRightLabel)
-
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 positiontopRightLabel- optional label displayed in the top-right positionbottomLeftLabel- optional label displayed in the bottom-left positionbottomRightLabel- optional label displayed in the bottom-right positionlevel- semantic color level (SUCCESS, WARNING, ERROR, ...)
-
-
Method Details
-
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
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
Returns the formatted percentage label.- Returns:
- a string such as "70%".
-
getPercentage
public int getPercentage() -
setPercentage
public void setPercentage(int percentage) -
getProgressLabel
-
setProgressLabel
-
getTopLeftLabel
-
setTopLeftLabel
-
getTopRightLabel
-
setTopRightLabel
-
getBottomLeftLabel
-
setBottomLeftLabel
-
getBottomRightLabel
-
setBottomRightLabel
-
getLevel
-
setLevel
-