use of org.olat.modules.forms.model.xml.StepLabel in project OpenOLAT by OpenOLAT.
the class RubricEditorController method commitStepLabels.
private void commitStepLabels() {
if (!typeEl.isOneSelected())
return;
SliderType selectedType = SliderType.valueOf(typeEl.getSelectedKey());
if (selectedType == SliderType.discrete || selectedType == SliderType.discrete_slider) {
if (rubric.getStepLabels() == null) {
rubric.setStepLabels(new ArrayList<>());
}
int steps = Integer.parseInt(stepsEl.getSelectedKey());
for (int i = 0; i < stepLabels.size() && i < steps; i++) {
StepLabelColumn stepLabel = stepLabels.get(i);
if (i < rubric.getStepLabels().size()) {
rubric.getStepLabels().get(i).setLabel(stepLabel.getStepLabelEl().getValue());
} else {
StepLabel label = new StepLabel();
label.setId(UUID.randomUUID().toString());
label.setLabel(stepLabel.getStepLabelEl().getValue());
rubric.getStepLabels().add(label);
}
}
if (rubric.getStepLabels().size() > steps) {
List<StepLabel> labels = new ArrayList<>(rubric.getStepLabels().subList(0, steps));
rubric.setStepLabels(labels);
}
} else {
rubric.getStepLabels().clear();
}
}
use of org.olat.modules.forms.model.xml.StepLabel in project openolat by klemens.
the class RubricEditorController method commitStepLabels.
private void commitStepLabels() {
if (!typeEl.isOneSelected())
return;
SliderType selectedType = SliderType.valueOf(typeEl.getSelectedKey());
if (selectedType == SliderType.discrete || selectedType == SliderType.discrete_slider) {
if (rubric.getStepLabels() == null) {
rubric.setStepLabels(new ArrayList<>());
}
int steps = Integer.parseInt(stepsEl.getSelectedKey());
for (int i = 0; i < stepLabels.size() && i < steps; i++) {
StepLabelColumn stepLabel = stepLabels.get(i);
if (i < rubric.getStepLabels().size()) {
rubric.getStepLabels().get(i).setLabel(stepLabel.getStepLabelEl().getValue());
} else {
StepLabel label = new StepLabel();
label.setId(UUID.randomUUID().toString());
label.setLabel(stepLabel.getStepLabelEl().getValue());
rubric.getStepLabels().add(label);
}
}
if (rubric.getStepLabels().size() > steps) {
List<StepLabel> labels = new ArrayList<>(rubric.getStepLabels().subList(0, steps));
rubric.setStepLabels(labels);
}
} else {
rubric.getStepLabels().clear();
}
}
use of org.olat.modules.forms.model.xml.StepLabel in project OpenOLAT by OpenOLAT.
the class EvaluationFormElementWrapper method isStepLabels.
public boolean isStepLabels() {
if (element instanceof Rubric) {
Rubric rubric = (Rubric) element;
if (rubric.getStepLabels() == null || rubric.getStepLabels().isEmpty()) {
return false;
}
List<StepLabel> stepLabels = rubric.getStepLabels();
for (StepLabel stepLabel : stepLabels) {
if (stepLabel != null && StringHelper.containsNonWhitespace(stepLabel.getLabel())) {
return true;
}
}
}
return false;
}
use of org.olat.modules.forms.model.xml.StepLabel in project openolat by klemens.
the class EvaluationFormElementWrapper method isStepLabels.
public boolean isStepLabels() {
if (element instanceof Rubric) {
Rubric rubric = (Rubric) element;
if (rubric.getStepLabels() == null || rubric.getStepLabels().isEmpty()) {
return false;
}
List<StepLabel> stepLabels = rubric.getStepLabels();
for (StepLabel stepLabel : stepLabels) {
if (stepLabel != null && StringHelper.containsNonWhitespace(stepLabel.getLabel())) {
return true;
}
}
}
return false;
}
Aggregations