Search in sources :

Example 1 with Option

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());
    }
}
Also used : Option(org.gwtbootstrap3.extras.select.client.ui.Option)

Example 2 with Option

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);
}
Also used : ValidationState(org.gwtbootstrap3.client.ui.constants.ValidationState) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Option(org.gwtbootstrap3.extras.select.client.ui.Option) PostConstruct(javax.annotation.PostConstruct)

Example 3 with Option

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);
}
Also used : QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Option(org.gwtbootstrap3.extras.select.client.ui.Option) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) QName(org.kie.workbench.common.dmn.api.property.dmn.QName)

Example 4 with Option

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;
}
Also used : Option(org.gwtbootstrap3.extras.select.client.ui.Option)

Example 5 with 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());
}
Also used : QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Option(org.gwtbootstrap3.extras.select.client.ui.Option) BuiltInType(org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType) Test(org.junit.Test)

Aggregations

Option (org.gwtbootstrap3.extras.select.client.ui.Option)17 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)3 GWT (com.google.gwt.core.client.GWT)1 ParagraphElement (com.google.gwt.dom.client.ParagraphElement)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 EventBus (com.google.gwt.event.shared.EventBus)1 DOM (com.google.gwt.user.client.DOM)1 Window (com.google.gwt.user.client.Window)1 FlexTable (com.google.gwt.user.client.ui.FlexTable)1 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)1 HTML (com.google.gwt.user.client.ui.HTML)1 HasHorizontalAlignment (com.google.gwt.user.client.ui.HasHorizontalAlignment)1 HasVerticalAlignment (com.google.gwt.user.client.ui.HasVerticalAlignment)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 Image (com.google.gwt.user.client.ui.Image)1 Label (com.google.gwt.user.client.ui.Label)1 Widget (com.google.gwt.user.client.ui.Widget)1 HTMLButtonElement (elemental2.dom.HTMLButtonElement)1