Search in sources :

Example 1 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class TimeSelectorView method populateTimeZoneSelectorWithIds.

void populateTimeZoneSelectorWithIds() {
    RemoveHelper.removeChildren(timeZoneSelector);
    timeZoneSelector.appendChild(createNoneOption());
    for (int i = 0; i < getTimeZones().size(); i++) {
        final DMNSimpleTimeZone timeZone = getTimeZones().get(i);
        final HTMLOptionElement option = createOptionWithId(timeZone);
        timeZoneSelector.appendChild(option);
    }
    setPickerValue(getSelectPicker(), getTimeZoneSelectedValue());
    timeZoneSelectorRefresh();
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement) DMNSimpleTimeZone(org.kie.workbench.common.dmn.api.editors.types.DMNSimpleTimeZone)

Example 2 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class TimeSelectorView method createOptionWithId.

HTMLOptionElement createOptionWithId(final DMNSimpleTimeZone timeZone) {
    final String timeZoneId = timeZone.getId();
    final HTMLOptionElement option = getNewOption();
    option.value = timeZoneId;
    option.text = timeZoneId;
    return option;
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement)

Example 3 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class TimeSelectorView method populateTimeZoneSelectorWithOffSets.

void populateTimeZoneSelectorWithOffSets() {
    final List<String> offSets = timeZoneProvider.getTimeZonesOffsets();
    RemoveHelper.removeChildren(timeZoneSelector);
    timeZoneSelector.appendChild(createNoneOption());
    for (int i = 0; i < offSets.size(); i++) {
        final HTMLOptionElement option = createOptionWithOffset(offSets.get(i));
        timeZoneSelector.appendChild(option);
    }
    setPickerValue(getSelectPicker(), getTimeZoneSelectedValue());
    timeZoneSelectorRefresh();
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement)

Example 4 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class TimeSelectorView method createNoneOption.

HTMLOptionElement createNoneOption() {
    final HTMLOptionElement none = getNewOption();
    none.text = translationService.getValue(NONE_TRANSLATION_KEY);
    none.value = NONE_VALUE;
    return none;
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement)

Example 5 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class TimeSelectorViewTest method testCreateOptionWithId.

@Test
public void testCreateOptionWithId() {
    final String optionId = "some id";
    final HTMLOptionElement option = new HTMLOptionElement();
    final DMNSimpleTimeZone tz = new DMNSimpleTimeZone();
    tz.setId(optionId);
    doReturn(option).when(view).getNewOption();
    view.createOptionWithId(tz);
    assertEquals(optionId, option.value);
    assertEquals(optionId, option.text);
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement) DMNSimpleTimeZone(org.kie.workbench.common.dmn.api.editors.types.DMNSimpleTimeZone) Test(org.junit.Test)

Aggregations

HTMLOptionElement (elemental2.dom.HTMLOptionElement)20 Test (org.junit.Test)11 HTMLOptGroupElement (elemental2.dom.HTMLOptGroupElement)3 DMNSimpleTimeZone (org.kie.workbench.common.dmn.api.editors.types.DMNSimpleTimeZone)3 DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)3 Function (java.util.function.Function)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 Lists (org.kie.soup.commons.util.Lists)1 BuiltInType (org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType)1 DataTypeManager (org.kie.workbench.common.dmn.client.editors.types.common.DataTypeManager)1