use of org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem 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;
}
use of org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem in project kie-wb-common by kiegroup.
the class UndefinedExpressionColumnTest method testGetItems.
@Test
public void testGetItems() {
final List<ListSelectorItem> items = column.getItems(0, 0);
assertThat(items).isNotNull();
assertThat(items.size()).isEqualTo(1);
final ListSelectorItem item = items.get(0);
assertThat(item).isInstanceOf(ListSelectorTextItem.class);
final ListSelectorTextItem textItem = (ListSelectorTextItem) item;
assertThat(textItem.getText()).isEqualTo(LiteralExpression.class.getSimpleName());
textItem.getCommand().execute();
verify(gridWidget).onExpressionTypeChanged(eq(ExpressionType.LITERAL_EXPRESSION));
}
use of org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem in project kie-wb-common by kiegroup.
the class UndefinedExpressionGridTest method testOnItemSelected.
@Test
public void testOnItemSelected() {
setupGrid(0);
final Command command = mock(Command.class);
final ListSelectorTextItem listSelectorItem = mock(ListSelectorTextItem.class);
when(listSelectorItem.getCommand()).thenReturn(command);
grid.onItemSelected(listSelectorItem);
verify(command).execute();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem in project kie-wb-common by kiegroup.
the class HasListSelectorControlTest method testBuild.
@Test
public void testBuild() {
final ListSelectorTextItem item = ListSelectorTextItem.build(TEXT, ENABLED, command);
assertThat(item.getText()).isEqualTo(TEXT);
assertThat(item.isEnabled()).isEqualTo(ENABLED);
assertThat(item.getCommand()).isEqualTo(command);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem in project kie-wb-common by kiegroup.
the class UndefinedExpressionColumnTest method testOnItemSelectedWithExpressionTypeSelected.
@Test
public void testOnItemSelectedWithExpressionTypeSelected() {
final List<ListSelectorItem> items = column.getItems(0, 0);
final ListSelectorTextItem ti = (ListSelectorTextItem) items.get(0);
column.onItemSelected(ti);
verify(gridWidget).onExpressionTypeChanged(eq(ExpressionType.LITERAL_EXPRESSION));
}
Aggregations