ProgressBar animated = new ProgressBar("animated", Model.of(45)).active(true);
add(animated);
ProgressBar labeledProgressBar = new ProgressBar("labeled");
Stack labeledStack = new Stack(labeledProgressBar.getStackId(), Model.of(45)) {
@Override
protected IModel<String> createLabelModel() {
return new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return String.format("The progress is: %s%%", getModelObject());
}
};
}
};
labeledStack.labeled(true).type(ProgressBar.Type.SUCCESS);
labeledProgressBar.addStacks(labeledStack);
add(labeledProgressBar);
ProgressBar stacked = new ProgressBar("stacked");
add(stacked);
Stack stackedStack1 = new Stack(stacked.getStackId(), Model.of(35)).type(ProgressBar.Type.SUCCESS);
Stack stackedStack2 = new Stack(stacked.getStackId(), Model.of(20)).type(ProgressBar.Type.WARNING);
Stack stackedStack3 = new Stack(stacked.getStackId(), Model.of(10)).type(ProgressBar.Type.DANGER);
stacked.addStacks(stackedStack1, stackedStack2, stackedStack3);
ProgressBar coloredInfo = new ProgressBar("coloredInfo", Model.of(20), ProgressBar.Type.INFO);
add(coloredInfo);