@Test public void initListItem() { DefaultImport defaultImport = tested.getModel(); defaultImport.setClassName(null); tested.initListItem(); defaultImport = tested.getModel(); defaultImport.setClassName(""); tested.initListItem(); defaultImport = tested.getModel(); defaultImport.setClassName("randomValue"); tested.initListItem(); defaultImport = tested.getModel(); defaultImport.setClassName("Boolean"); tested.initListItem(); verify(defaultClassNames, times(2)).setValue(null); verify(defaultClassNames, times(1)).setValue("Boolean"); verify(defaultClassNames, times(1)).setValue("randomValue"); verify(classNamesComboBox, times(4)).setShowCustomValues(true); verify(classNamesComboBox, times(4)).setListBoxValues(any(ListBoxValues.class)); verify(classNamesComboBox, times(4)).init(tested, true, defaultClassNames, customClassName, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); }
protected void initListItem() { Map<String, String> dataTypes = parentWidget.getDataTypes(); ListBoxValues classNameListBoxValues = new ListBoxValues(VariableListItemWidgetView.CUSTOM_PROMPT, "Edit" + " ", null); List<String> displayNames = new ArrayList<>(dataTypes.values()); classNameListBoxValues.addValues(displayNames); classNamesComboBox.setShowCustomValues(true); classNamesComboBox.setListBoxValues(classNameListBoxValues); String className = getModel().getClassName(); if (className == null || className.isEmpty()) { className = Object.class.getSimpleName(); } String displayName = parentWidget.getDataType(className); defaultClassNames.setValue(displayName); classNamesComboBox.init(this, true, defaultClassNames, customClassName, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); }
DefaultImportListItemWidgetView extends Composite implements ImportListItemWidgetView<DefaultImport>,
                                                                          ComboBoxView.ModelPresenter { protected void initListItem() { Map<String, String> dataTypes = parentWidget.getDataTypes(); ListBoxValues classNameListBoxValues = new ListBoxValues(VariableListItemWidgetView.CUSTOM_PROMPT, "Edit" + " ", null); List<String> displayNames = new ArrayList<>(dataTypes.values()); classNameListBoxValues.addValues(displayNames); classNamesComboBox.setShowCustomValues(true); classNamesComboBox.setListBoxValues(classNameListBoxValues); String className = getModel().getClassName(); if (className == null || className.isEmpty()) { className = Object.class.getSimpleName(); } String displayName = parentWidget.getDataType(className); defaultClassNames.setValue(displayName); classNamesComboBox.init(this, true, defaultClassNames, customClassName, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); } }
DefaultImportListItemWidgetView extends Composite implements ImportListItemWidgetView<DefaultImport>,
                                                                          ComboBoxView.ModelPresenter { protected void initListItem() { Map<String, String> dataTypes = parentWidget.getDataTypes(); ListBoxValues classNameListBoxValues = new ListBoxValues(VariableListItemWidgetView.CUSTOM_PROMPT, "Edit" + " ", null); List<String> displayNames = new ArrayList<>(dataTypes.values()); classNameListBoxValues.addValues(displayNames); classNamesComboBox.setShowCustomValues(true); classNamesComboBox.setListBoxValues(classNameListBoxValues); String className = getModel().getClassName(); if (className == null || className.isEmpty()) { className = Object.class.getSimpleName(); } String displayName = parentWidget.getDataType(className); defaultClassNames.setValue(displayName); classNamesComboBox.init(this, true, defaultClassNames, customClassName, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); }  }
DefaultImportListItemWidgetView extends Composite implements ImportListItemWidgetView<DefaultImport>,
                                                                          ComboBoxView.ModelPresenter { protected void initListItem() { Map<String, String> dataTypes = parentWidget.getDataTypes(); ListBoxValues classNameListBoxValues = new ListBoxValues(VariableListItemWidgetView.CUSTOM_PROMPT, "Edit" + " ", null); List<String> displayNames = new ArrayList<>(dataTypes.values()); classNameListBoxValues.addValues(displayNames); classNamesComboBox.setShowCustomValues(true); classNamesComboBox.setListBoxValues(classNameListBoxValues); String className = getModel().getClassName(); if (className == null || className.isEmpty()) { className = Object.class.getSimpleName(); } String displayName = parentWidget.getDataType(className); defaultClassNames.setValue(displayName); classNamesComboBox.init(this, true, defaultClassNames, customClassName, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); }  @Override void setParentWidget(final ImportsEditorWidgetView.Presenter<DefaultImport> parentWidget); @Override void setTextBoxModelValue(final TextBox textBox, final String value); @Override void setListBoxModelValue(final ValueListBox<String> listBox, final String displayName); @Override String getModelValue(final ValueListBox<String> listBox); @Override void notifyModelChanged(); @PostConstruct void init(); @Override DefaultImport getModel(); @Override void setModel(final DefaultImport model); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e); }
DefaultImportListItemWidgetView extends Composite implements ImportListItemWidgetView<DefaultImport>,
                                                                          ComboBoxView.ModelPresenter { protected void initListItem() { Map<String, String> dataTypes = parentWidget.getDataTypes(); ListBoxValues classNameListBoxValues = new ListBoxValues(VariableListItemWidgetView.CUSTOM_PROMPT, "Edit" + " ", null); List<String> displayNames = new ArrayList<>(dataTypes.values()); classNameListBoxValues.addValues(displayNames); classNamesComboBox.setShowCustomValues(true); classNamesComboBox.setListBoxValues(classNameListBoxValues); String className = getModel().getClassName(); if (className == null || className.isEmpty()) { className = Object.class.getSimpleName(); } String displayName = parentWidget.getDataType(className); defaultClassNames.setValue(displayName); classNamesComboBox.init(this, true, defaultClassNames, customClassName, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); }  @Override void setParentWidget(final ImportsEditorWidgetView.Presenter<DefaultImport> parentWidget); @Override void setTextBoxModelValue(final TextBox textBox, final String value); @Override void setListBoxModelValue(final ValueListBox<String> listBox, final String displayName); @Override String getModelValue(final ValueListBox<String> listBox); @Override void notifyModelChanged(); @PostConstruct void init(); @Override DefaultImport getModel(); @Override void setModel(final DefaultImport model); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e);  }