use of org.gwtbootstrap3.extras.select.client.ui.Option in project kie-wb-common by kiegroup.
the class PackageListBox method addPackage.
void addPackage(final Package pkg, final Package activePackage) {
final Option option = new Option();
option.setText(pkg.getCaption());
select.add(option);
packages.put(pkg.getCaption(), pkg);
if (pkg.equals(activePackage)) {
select.setValue(pkg.getCaption());
}
}
use of org.gwtbootstrap3.extras.select.client.ui.Option in project kie-wb-common by kiegroup.
the class ContainerRulesConfigView method init.
@PostConstruct
public void init() {
version.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!version.getText().trim().isEmpty()) {
StyleHelper.addUniqueEnumStyleName(versionForm, ValidationState.class, ValidationState.NONE);
}
}
});
version.getElement().setAttribute("placeholder", getVersionTextBoxPlaceholder());
interval.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!interval.getText().trim().isEmpty()) {
StyleHelper.addUniqueEnumStyleName(scannerForm, ValidationState.class, ValidationState.NONE);
}
}
});
interval.getElement().setAttribute("placeholder", getIntervalTextBoxPlaceholder());
interval.getElement().setAttribute("data-original-title", getIntervalTextBoxDataOriginalTitle());
Option ms = new Option();
ms.setText(translationService.format(Constants.ContainerRulesConfigView_Milliseconds));
ms.setValue(ContainerRulesConfigPresenter.MS);
ms.setSelected(true);
intervalTimeUnit.add(ms);
Option s = new Option();
s.setText(translationService.format(Constants.ContainerRulesConfigView_Seconds));
s.setValue(ContainerRulesConfigPresenter.S);
intervalTimeUnit.add(s);
Option m = new Option();
m.setText(translationService.format(Constants.ContainerRulesConfigView_Minutes));
m.setValue(ContainerRulesConfigPresenter.M);
intervalTimeUnit.add(m);
Option h = new Option();
h.setText(translationService.format(Constants.ContainerRulesConfigView_Hours));
h.setValue(ContainerRulesConfigPresenter.H);
intervalTimeUnit.add(h);
Option d = new Option();
d.setText(translationService.format(Constants.ContainerRulesConfigView_Days));
d.setValue(ContainerRulesConfigPresenter.D);
intervalTimeUnit.add(d);
}
use of org.gwtbootstrap3.extras.select.client.ui.Option in project kie-wb-common by kiegroup.
the class DataTypePickerWidget method makeTypeSelector.
Optional<Option> makeTypeSelector(final ItemDefinition id) {
Option o = null;
if (id.getName() != null) {
final Name name = id.getName();
o = GWT.create(Option.class);
o.setText(name.getValue());
o.setValue(qNameConverter.toWidgetValue(new QName(QName.NULL_NS_URI, name.getValue(), QName.DEFAULT_NS_PREFIX)));
}
return Optional.ofNullable(o);
}
use of org.gwtbootstrap3.extras.select.client.ui.Option in project kie-wb-common by kiegroup.
the class UIUtil method newOption.
public static Option newOption(final String text, final String value) {
final Option option = new Option();
option.setValue(value);
option.setText(text);
return option;
}
use of org.gwtbootstrap3.extras.select.client.ui.Option in project kie-wb-common by kiegroup.
the class DataTypePickerWidgetTest method testMakeTypeSelectorForBuiltInType.
@Test
public void testMakeTypeSelectorForBuiltInType() {
final BuiltInType bit = BuiltInType.ANY;
final ArgumentCaptor<String> optionTextCaptor = ArgumentCaptor.forClass(String.class);
final ArgumentCaptor<String> optionValueCaptor = ArgumentCaptor.forClass(String.class);
final ArgumentCaptor<QName> qNameCaptor = ArgumentCaptor.forClass(QName.class);
final Optional<Option> oo = picker.makeTypeSelector(bit);
verify(option).setText(optionTextCaptor.capture());
verify(option).setValue(optionValueCaptor.capture());
verify(qNameConverter).toWidgetValue(qNameCaptor.capture());
final QName normalisedQName = qNameCaptor.getValue();
assertEquals("", normalisedQName.getNamespaceURI());
assertEquals(QName.NULL_NS_URI, normalisedQName.getPrefix());
assertEquals(bit.getName(), normalisedQName.getLocalPart());
assertTrue(oo.isPresent());
assertEquals(bit.getName(), optionTextCaptor.getValue());
assertEquals("[][Any][]", optionValueCaptor.getValue());
}
Aggregations