use of org.gwtbootstrap3.client.ui.ListBox in project kie-wb-common by kiegroup.
the class EnumDropDownUtilitiesTest method testCommaSeparatedValuesWithBracketsAndOneMultiValue.
@Test
public void testCommaSeparatedValuesWithBracketsAndOneMultiValue() {
final DropDownData downData = mock(DropDownData.class);
doReturn(new String[] { "a", "\"b, c\"", "d" }).when(downData).getFixedList();
final ListBox listBox = mock(ListBox.class);
new EnumDropDownUtilities().setDropDownData(" ( \"\"b, c\"\" )", downData, true, mock(Path.class), listBox);
verify(listBox).clear();
verify(listBox).addItem("a");
verify(listBox).addItem("\"b, c\"");
verify(listBox).addItem("d");
verify(listBox, never()).setItemSelected(0, true);
verify(listBox).setItemSelected(1, true);
verify(listBox, never()).setItemSelected(2, true);
}
use of org.gwtbootstrap3.client.ui.ListBox in project drools-wb by kiegroup.
the class BoundFactUiColumn method doEdit.
@Override
public void doEdit(final GridCell<String> cell, final GridBodyCellRenderContext context, final Consumer<GridCellValue<String>> callback) {
factory.attachDomElement(context, (ListBoxDOMElement<String, ListBox> e) -> {
final ListBox widget = e.getWidget();
for (String binding : presenter.getLHSBoundFacts()) {
widget.addItem(binding);
}
widget.setEnabled(widget.getItemCount() > 0);
if (widget.getItemCount() == 0) {
widget.addItem(GuidedDecisionTableConstants.INSTANCE.NoPatternBindingsAvailable());
} else {
factory.toWidget(cell, widget);
}
}, ConsumerFactory.makeOnDisplayListBoxCallback());
}
use of org.gwtbootstrap3.client.ui.ListBox in project drools-wb by kiegroup.
the class DialectUiColumn method doEdit.
@Override
public void doEdit(final GridCell<String> cell, final GridBodyCellRenderContext context, final Consumer<GridCellValue<String>> callback) {
factory.attachDomElement(context, (ListBoxDOMElement<String, ListBox> e) -> {
final ListBox widget = e.getWidget();
widget.addItem("java");
widget.addItem("mvel");
factory.toWidget(cell, e.getWidget());
}, ConsumerFactory.makeOnDisplayListBoxCallback());
}
use of org.gwtbootstrap3.client.ui.ListBox in project drools-wb by kiegroup.
the class EnumMultiSelectUiColumn method doEdit.
@Override
public void doEdit(final GridCell<String> cell, final GridBodyCellRenderContext context, final Consumer<GridCellValue<String>> callback) {
final String value = extractValue(cell);
// We need to get the list of potential values to lookup the "Display" value from the "Stored" value.
// Since the content of the list may be different for each cell (dependent enumerations) the list
// has to be populated "on demand".
presenter.getEnumLookups(this.factType, this.factField, new DependentEnumsUtilities.Context(context.getRowIndex(), context.getColumnIndex()), (Map<String, String> enumLookups) -> {
factory.attachDomElement(context, (ListBoxDOMElement<String, ListBox> e) -> {
final ListBox widget = e.getWidget();
for (Map.Entry<String, String> lookup : enumLookups.entrySet()) {
widget.addItem(lookup.getValue(), lookup.getKey());
}
final List<String> values = Arrays.asList(value.split(","));
for (int i = 0; i < widget.getItemCount(); i++) {
widget.setItemSelected(i, values.contains(widget.getValue(i)));
}
factory.toWidget(cell, widget);
}, ConsumerFactory.makeOnDisplayListBoxCallback());
});
}
use of org.gwtbootstrap3.client.ui.ListBox in project drools-wb by kiegroup.
the class ExpressionBuilder method createStartPointWidget.
private Widget createStartPointWidget() {
ListBox startPoint = new ListBox();
startPoint.addItem(GuidedRuleEditorResources.CONSTANTS.Choose(), "");
for (String gv : getDataModelOracle().getGlobalVariables()) {
startPoint.addItem(gv, GLOBAL_VARIABLE_VALUE_PREFIX + "." + gv);
}
for (String v : getRuleModel().getAllLHSVariables()) {
startPoint.addItem(v, VARIABLE_VALUE_PREFIX + "." + v);
}
startPoint.setVisibleItemCount(1);
startPoint.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
ListBox lb = (ListBox) event.getSource();
int index = lb.getSelectedIndex();
if (index > 0) {
onStartPointChange(lb.getValue(index));
}
}
});
return startPoint;
}
Aggregations