@Test public void testAddAttribute() { List<MetaDataRow> rows = new ArrayList<>(); MetaDataRow metaDataRow = new MetaDataRow(); rows.add(metaDataRow); when(metaDataEditorWidgetView.getMetaDataRows()).thenReturn(rows); when(metaDataEditorWidgetView.getMetaDataWidget(anyInt())).thenReturn(metaDataListItemWidgetView); when(metaDataEditorWidgetView.getMetaDataRowsCount()).thenReturn(1); metaDataEditor.addAttribute(); verify(metaDataEditorWidgetView, times(0)).setTableDisplayStyle(); verify(metaDataEditorWidgetView, times(1)).getMetaDataRowsCount(); verify(metaDataEditorWidgetView, times(1)).getMetaDataWidget(0); }
@Override public void addAttribute() { List<MetaDataRow> as = view.getMetaDataRows(); if (as.isEmpty()) { view.setTableDisplayStyle(); } MetaDataRow newAttribute = new MetaDataRow(); as.add(newAttribute); MetaDataListItemWidgetView widget = view.getMetaDataWidget(view.getMetaDataRowsCount() - 1); widget.setParentWidget(this); }
MetaDataEditorFieldRenderer extends FieldRenderer<MetaDataEditorFieldDefinition, DefaultFormGroup> implements MetaDataEditorWidgetView.Presenter { @Override public void addAttribute() { List<MetaDataRow> as = view.getMetaDataRows(); if (as.isEmpty()) { view.setTableDisplayStyle(); } MetaDataRow newAttribute = new MetaDataRow(); as.add(newAttribute); MetaDataListItemWidgetView widget = view.getMetaDataWidget(view.getMetaDataRowsCount() - 1); widget.setParentWidget(this); } }
MetaDataEditorFieldRenderer extends FieldRenderer<MetaDataEditorFieldDefinition, DefaultFormGroup> implements MetaDataEditorWidgetView.Presenter { @Override public void addAttribute() { List<MetaDataRow> as = view.getMetaDataRows(); if (as.isEmpty()) { view.setTableDisplayStyle(); } MetaDataRow newAttribute = new MetaDataRow(); as.add(newAttribute); MetaDataListItemWidgetView widget = view.getMetaDataWidget(view.getMetaDataRowsCount() - 1); widget.setParentWidget(this); } @Inject  MetaDataEditorFieldRenderer(final MetaDataEditorWidgetView metaDataEditor,
                                       final SessionManager sessionManager,
                                       final ErrorPopupPresenter errorPopupPresenter,
                                       final Event<NotificationEvent> notification); }
MetaDataEditorFieldRenderer extends FieldRenderer<MetaDataEditorFieldDefinition, DefaultFormGroup> implements MetaDataEditorWidgetView.Presenter { @Override public void addAttribute() { List<MetaDataRow> as = view.getMetaDataRows(); if (as.isEmpty()) { view.setTableDisplayStyle(); } MetaDataRow newAttribute = new MetaDataRow(); as.add(newAttribute); MetaDataListItemWidgetView widget = view.getMetaDataWidget(view.getMetaDataRowsCount() - 1); widget.setParentWidget(this); } @Inject  MetaDataEditorFieldRenderer(final MetaDataEditorWidgetView metaDataEditor,
                                       final SessionManager sessionManager,
                                       final ErrorPopupPresenter errorPopupPresenter,
                                       final Event<NotificationEvent> notification); @Override String getName(); @Override void doSave(); @Override void addAttribute(); @Override void notifyModelChanged(); @Override List<MetaDataRow> deserializeMetaDataAttributes(final String s); @Override String serializeMetaDataAttributes(final List<MetaDataRow> metaDataRows); @Override boolean isDuplicateAttribute(final String attribute); @Override void removeMetaData(final MetaDataRow metaDataRow); @Override Path getDiagramPath(); @Override void showErrorMessage(String message); }
MetaDataEditorFieldRenderer extends FieldRenderer<MetaDataEditorFieldDefinition, DefaultFormGroup> implements MetaDataEditorWidgetView.Presenter { @Override public void addAttribute() { List<MetaDataRow> as = view.getMetaDataRows(); if (as.isEmpty()) { view.setTableDisplayStyle(); } MetaDataRow newAttribute = new MetaDataRow(); as.add(newAttribute); MetaDataListItemWidgetView widget = view.getMetaDataWidget(view.getMetaDataRowsCount() - 1); widget.setParentWidget(this); } @Inject  MetaDataEditorFieldRenderer(final MetaDataEditorWidgetView metaDataEditor,
                                       final SessionManager sessionManager,
                                       final ErrorPopupPresenter errorPopupPresenter,
                                       final Event<NotificationEvent> notification); @Override String getName(); @Override void doSave(); @Override void addAttribute(); @Override void notifyModelChanged(); @Override List<MetaDataRow> deserializeMetaDataAttributes(final String s); @Override String serializeMetaDataAttributes(final List<MetaDataRow> metaDataRows); @Override boolean isDuplicateAttribute(final String attribute); @Override void removeMetaData(final MetaDataRow metaDataRow); @Override Path getDiagramPath(); @Override void showErrorMessage(String message);  }