Search in sources :

Example 1 with ListSelectorDividerItem

use of org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorDividerItem in project kie-wb-common by kiegroup.

the class ListSelectorViewImpl method makeListSelectorItemView.

private Optional<IsElement> makeListSelectorItemView(final ListSelectorItem item) {
    Optional<IsElement> listSelectorItemView = Optional.empty();
    if (item instanceof ListSelectorTextItem) {
        final ListSelectorTextItem ti = (ListSelectorTextItem) item;
        final ListSelectorTextItemView selector = listSelectorTextItemViews.get();
        selector.setText(ti.getText());
        selector.setEnabled(ti.isEnabled());
        selector.addClickHandler(() -> {
            if (ti.isEnabled()) {
                presenter.onItemSelected(item);
            }
        });
        listSelectorItemView = Optional.of(selector);
    } else if (item instanceof ListSelectorDividerItem) {
        listSelectorItemView = Optional.of(listSelectorDividerItemViews.get());
    }
    return listSelectorItemView;
}
Also used : ListSelectorDividerItem(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorDividerItem) IsElement(org.jboss.errai.common.client.api.IsElement) ListSelectorTextItem(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem)

Example 2 with ListSelectorDividerItem

use of org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorDividerItem in project kie-wb-common by kiegroup.

the class UndefinedExpressionGridTest method testOnItemSelectedDivider.

@Test
public void testOnItemSelectedDivider() {
    setupGrid(0);
    final ListSelectorDividerItem dItem = mock(ListSelectorDividerItem.class);
    grid.onItemSelected(dItem);
    verify(cellEditorControls, never()).hide();
    verify(grid, never()).onExpressionTypeChanged(any(ExpressionType.class));
}
Also used : ListSelectorDividerItem(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorDividerItem) ExpressionType(org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionType) Test(org.junit.Test)

Aggregations

ListSelectorDividerItem (org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorDividerItem)2 IsElement (org.jboss.errai.common.client.api.IsElement)1 Test (org.junit.Test)1 ExpressionType (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionType)1 ListSelectorTextItem (org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem)1