use of org.javarosa.core.model.data.helper.Selection in project collect by opendatakit.
the class SelectImageMapWidget method unselectArea.
private void unselectArea(String areaId) {
Selection selectionToRemove = null;
for (Selection selection : selections) {
if (areaId.equalsIgnoreCase(selection.getValue())) {
selectionToRemove = selection;
}
}
selections.remove(selectionToRemove);
widgetValueChanged();
}
use of org.javarosa.core.model.data.helper.Selection in project collect by opendatakit.
the class SelectImageMapWidget method refreshSelectedItemsLabel.
protected void refreshSelectedItemsLabel() {
StringBuilder stringBuilder = new StringBuilder();
if (!selections.isEmpty()) {
stringBuilder.append("<b>").append(getContext().getString(R.string.selected)).append("</b> ");
for (Selection selection : selections) {
String choiceName = getFormEntryPrompt().getSelectChoiceText(selection.choice);
CharSequence choiceDisplayName = HtmlUtils.textToHtml(choiceName);
stringBuilder.append(choiceDisplayName);
if (selections.indexOf(selection) < selections.size() - 1) {
stringBuilder.append(", ");
}
}
}
((Activity) getContext()).runOnUiThread(() -> binding.selectedElements.setText(Html.fromHtml(stringBuilder.toString())));
}
use of org.javarosa.core.model.data.helper.Selection in project collect by opendatakit.
the class SelectImageMapWidget method selectArea.
protected void selectArea(String areaId) {
SelectChoice selectChoice = null;
for (SelectChoice sc : items) {
if (areaId.equalsIgnoreCase(sc.getValue())) {
selectChoice = sc;
}
}
if (selectChoice != null) {
selections.add(new Selection(selectChoice));
}
widgetValueChanged();
}
use of org.javarosa.core.model.data.helper.Selection in project collect by opendatakit.
the class LikertWidget method setSavedButton.
// Inserts the selected button from a saved state
public void setSavedButton() {
if (getFormEntryPrompt().getAnswerValue() != null) {
String name = ((Selection) getFormEntryPrompt().getAnswerValue().getValue()).getValue();
for (RadioButton bu : buttonsToName.keySet()) {
if (buttonsToName.get(bu).equals(name)) {
checkedButton = bu;
checkedButton.setChecked(true);
}
}
}
}
Aggregations