use of edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor in project webprotege by protegeproject.
the class ChoiceFieldComboBoxEditor method setValue.
@Override
public void setValue(FormDataValue value) {
FormDataValue first = value.asList().get(0);
int index = 1;
for (ChoiceDescriptor descriptor : choiceDescriptors) {
if (descriptor.getValue().equals(first)) {
comboBox.setSelectedIndex(index);
break;
}
index++;
}
}
use of edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor in project webprotege by protegeproject.
the class ChoiceFieldComboBoxEditor method setChoices.
@Override
public void setChoices(List<ChoiceDescriptor> choices) {
comboBox.clear();
choiceDescriptors.clear();
comboBox.addItem("");
for (ChoiceDescriptor descriptor : choices) {
choiceDescriptors.add(descriptor);
comboBox.addItem(descriptor.getLabel());
}
selectDefaultChoice();
}
use of edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor in project webprotege by protegeproject.
the class ChoiceFieldRadioButtonEditor method setChoices.
@Override
public void setChoices(List<ChoiceDescriptor> choices) {
container.clear();
choiceButtons.clear();
nameCounter++;
for (ChoiceDescriptor descriptor : choices) {
RadioButton radioButton = new RadioButton("Choice" + nameCounter, new SafeHtmlBuilder().appendHtmlConstant(descriptor.getLabel()).toSafeHtml());
radioButton.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
radioButton.addValueChangeHandler(radioButtonValueChangedHandler);
radioButton.addFocusHandler(event -> {
radioButton.addStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
radioButton.removeStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
});
radioButton.addBlurHandler(event -> {
radioButton.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
radioButton.removeStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
});
container.add(radioButton);
choiceButtons.put(radioButton, descriptor);
}
selectDefaultChoice();
}
use of edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor in project webprotege by protegeproject.
the class ChoiceFieldCheckBoxEditor method setChoices.
@Override
public void setChoices(List<ChoiceDescriptor> choices) {
container.clear();
checkBoxes.clear();
for (ChoiceDescriptor choiceDescriptor : choices) {
CheckBox checkBox = new CheckBox(new SafeHtmlBuilder().appendHtmlConstant(choiceDescriptor.getLabel()).toSafeHtml());
checkBoxes.put(checkBox, choiceDescriptor);
container.add(checkBox);
checkBox.getElement().getStyle().setDisplay(Style.Display.BLOCK);
checkBox.addValueChangeHandler(checkBoxValueChangedHandler);
checkBox.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
checkBox.addFocusHandler(event -> {
checkBox.addStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
checkBox.removeStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
});
checkBox.addBlurHandler(event -> {
checkBox.addStyleName(WebProtegeClientBundle.BUNDLE.style().noFocusBorder());
checkBox.removeStyleName(WebProtegeClientBundle.BUNDLE.style().focusBorder());
});
}
}
use of edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor in project webprotege by protegeproject.
the class ChoiceFieldSegmentedEditor method setChoices.
@Override
public void setChoices(List<ChoiceDescriptor> choices) {
dirty = false;
segmentContainer.clear();
choiceWidgets.clear();
this.choices.clear();
this.selectedIndex = -1;
for (ChoiceDescriptor choice : choices) {
InlineLabel label = new InlineLabel(choice.getLabel());
segmentContainer.add(label);
this.choices.add(choice.getValue());
this.choiceWidgets.add(label);
label.addClickHandler(event -> {
setSelection(choice.getValue(), true);
});
}
segmentContainer.getElement().getStyle().setProperty("maxWidth", SEGMENT_SIZE * choices.size(), Style.Unit.PX);
setDefaultChoiceSelected();
}
Aggregations