@Test public void testSetDataEmpty() { rows.clear(); widget.setData(rows); verify(view).setNoneDisplayStyle(); verify(view).setAssignmentRows(captor.capture()); assertEquals(0, captor.getValue().size()); verify(view, never()).getAssignmentWidget(anyInt()); }
public void setData(final List<AssignmentRow> assignmentRows) { hiddenPropertyRows.clear(); if (disallowedNames != null && !disallowedNames.isEmpty()) { for (int i = assignmentRows.size() - 1; i >= 0; i--) { AssignmentRow row = assignmentRows.get(i); if (row.getName() != null && !row.getName().isEmpty()) { if (disallowedNames.contains(row.getName().toLowerCase())) { assignmentRows.remove(i); hiddenPropertyRows.add(0, row); } } } } if (assignmentRows.isEmpty()) { view.setNoneDisplayStyle(); } else { view.setTableDisplayStyle(); } view.setAssignmentRows(assignmentRows); for (int i = 0; i < assignmentRows.size(); i++) { view.getAssignmentWidget(i).setParentWidget(this); view.getAssignmentWidget(i).setDisallowedNames(disallowedNames, disallowedNameErrorMessage); view.getAssignmentWidget(i).setAllowDuplicateNames(allowDuplicateNames, duplicateNameErrorMessage); } }
ActivityDataIOEditorWidget implements ActivityDataIOEditorWidgetView.Presenter { public void setData(final List<AssignmentRow> assignmentRows) { hiddenPropertyRows.clear(); if (disallowedNames != null && !disallowedNames.isEmpty()) { for (int i = assignmentRows.size() - 1; i >= 0; i--) { AssignmentRow row = assignmentRows.get(i); if (row.getName() != null && !row.getName().isEmpty()) { if (disallowedNames.contains(row.getName().toLowerCase())) { assignmentRows.remove(i); hiddenPropertyRows.add(0, row); } } } } if (assignmentRows.isEmpty()) { view.setNoneDisplayStyle(); } else { view.setTableDisplayStyle(); } view.setAssignmentRows(assignmentRows); for (int i = 0; i < assignmentRows.size(); i++) { view.getAssignmentWidget(i).setParentWidget(this); view.getAssignmentWidget(i).setDisallowedNames(disallowedNames, disallowedNameErrorMessage); view.getAssignmentWidget(i).setAllowDuplicateNames(allowDuplicateNames, duplicateNameErrorMessage); } } }
ActivityDataIOEditorWidget implements ActivityDataIOEditorWidgetView.Presenter { public void setData(final List<AssignmentRow> assignmentRows) { hiddenPropertyRows.clear(); if (disallowedNames != null && !disallowedNames.isEmpty()) { for (int i = assignmentRows.size() - 1; i >= 0; i--) { AssignmentRow row = assignmentRows.get(i); if (row.getName() != null && !row.getName().isEmpty()) { if (disallowedNames.contains(row.getName().toLowerCase())) { assignmentRows.remove(i); hiddenPropertyRows.add(0, row); } } } } if (assignmentRows.isEmpty()) { view.setNoneDisplayStyle(); } else { view.setTableDisplayStyle(); } view.setAssignmentRows(assignmentRows); for (int i = 0; i < assignmentRows.size(); i++) { view.getAssignmentWidget(i).setParentWidget(this); view.getAssignmentWidget(i).setDisallowedNames(disallowedNames, disallowedNameErrorMessage); view.getAssignmentWidget(i).setAllowDuplicateNames(allowDuplicateNames, duplicateNameErrorMessage); } }  }
ActivityDataIOEditorWidget implements ActivityDataIOEditorWidgetView.Presenter { public void setData(final List<AssignmentRow> assignmentRows) { hiddenPropertyRows.clear(); if (disallowedNames != null && !disallowedNames.isEmpty()) { for (int i = assignmentRows.size() - 1; i >= 0; i--) { AssignmentRow row = assignmentRows.get(i); if (row.getName() != null && !row.getName().isEmpty()) { if (disallowedNames.contains(row.getName().toLowerCase())) { assignmentRows.remove(i); hiddenPropertyRows.add(0, row); } } } } if (assignmentRows.isEmpty()) { view.setNoneDisplayStyle(); } else { view.setTableDisplayStyle(); } view.setAssignmentRows(assignmentRows); for (int i = 0; i < assignmentRows.size(); i++) { view.getAssignmentWidget(i).setParentWidget(this); view.getAssignmentWidget(i).setDisallowedNames(disallowedNames, disallowedNameErrorMessage); view.getAssignmentWidget(i).setAllowDuplicateNames(allowDuplicateNames, duplicateNameErrorMessage); } }  @PostConstruct void init(); @Override void handleAddClick(); void setIsSingleVar(final boolean isSingleVar); void setVariableType(final VariableType variableType); void setAllowDuplicateNames(final boolean allowDuplicateNames,
                                       final String duplicateNameErrorMessage); void removeAssignment(final AssignmentRow assignmentRow); void setData(final List<AssignmentRow> assignmentRows); List<AssignmentRow> getData(); VariableType getVariableType(); void setDataTypes(final ListBoxValues dataTypeListBoxValues); void setProcessVariables(final ListBoxValues processVarListBoxValues); void setDisallowedNames(final Set<String> disallowedNames,
                                   final String disallowedNameErrorMessage); boolean isDuplicateName(final String name); boolean isMultipleInstanceVariable(final String name); void setIsVisible(final boolean visible); Widget getWidget(); void setReadOnly(final boolean readOnly); }
ActivityDataIOEditorWidget implements ActivityDataIOEditorWidgetView.Presenter { public void setData(final List<AssignmentRow> assignmentRows) { hiddenPropertyRows.clear(); if (disallowedNames != null && !disallowedNames.isEmpty()) { for (int i = assignmentRows.size() - 1; i >= 0; i--) { AssignmentRow row = assignmentRows.get(i); if (row.getName() != null && !row.getName().isEmpty()) { if (disallowedNames.contains(row.getName().toLowerCase())) { assignmentRows.remove(i); hiddenPropertyRows.add(0, row); } } } } if (assignmentRows.isEmpty()) { view.setNoneDisplayStyle(); } else { view.setTableDisplayStyle(); } view.setAssignmentRows(assignmentRows); for (int i = 0; i < assignmentRows.size(); i++) { view.getAssignmentWidget(i).setParentWidget(this); view.getAssignmentWidget(i).setDisallowedNames(disallowedNames, disallowedNameErrorMessage); view.getAssignmentWidget(i).setAllowDuplicateNames(allowDuplicateNames, duplicateNameErrorMessage); } }  @PostConstruct void init(); @Override void handleAddClick(); void setIsSingleVar(final boolean isSingleVar); void setVariableType(final VariableType variableType); void setAllowDuplicateNames(final boolean allowDuplicateNames,
                                       final String duplicateNameErrorMessage); void removeAssignment(final AssignmentRow assignmentRow); void setData(final List<AssignmentRow> assignmentRows); List<AssignmentRow> getData(); VariableType getVariableType(); void setDataTypes(final ListBoxValues dataTypeListBoxValues); void setProcessVariables(final ListBoxValues processVarListBoxValues); void setDisallowedNames(final Set<String> disallowedNames,
                                   final String disallowedNameErrorMessage); boolean isDuplicateName(final String name); boolean isMultipleInstanceVariable(final String name); void setIsVisible(final boolean visible); Widget getWidget(); void setReadOnly(final boolean readOnly);  }