@Test public void testEnableEditMode() { final DataType dataType = mock(DataType.class); final String expectedName = "name"; final String expectedType = "type"; final String expectedConstraint = "constraint"; final boolean expectedIsList = true; final String expectedConstraintType = ""; doReturn(dataType).when(listItem).getDataType(); when(dataType.getName()).thenReturn(expectedName); when(dataType.getType()).thenReturn(expectedType); when(dataType.getConstraint()).thenReturn(expectedConstraint); when(dataType.isList()).thenReturn(expectedIsList); when(view.isOnFocusMode()).thenReturn(false); listItem.enableEditMode(); assertEquals(expectedName, listItem.getOldName()); assertEquals(expectedType, listItem.getOldType()); assertEquals(expectedConstraint, listItem.getOldConstraint()); assertEquals(expectedIsList, listItem.getOldIsList()); assertEquals(expectedConstraintType, listItem.getOldConstraintType()); verify(view).showSaveButton(); verify(view).showDataTypeNameInput(); verify(view).enableFocusMode(); verify(view).hideListYesLabel(); verify(view).showListContainer(); verify(dataTypeSelectComponent).enableEditMode(); verify(dataTypeConstraintComponent).enableEditMode(); verify(editModeToggleEvent).fire(eventArgumentCaptor.capture()); verify(dataTypeList).fireOnDataTypeListItemUpdateCallback(listItem); assertTrue(eventArgumentCaptor.getValue().isEditModeEnabled()); }
public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } @Inject  DataTypeListItem(final View view,
                            final DataTypeSelect dataTypeSelectComponent,
                            final DataTypeConstraint dataTypeConstraintComponent,
                            final SmallSwitchComponent dataTypeListComponent,
                            final DataTypeManager dataTypeManager,
                            final DataTypeConfirmation confirmation,
                            final DataTypeNameFormatValidator nameFormatValidator,
                            final Event<DataTypeEditModeToggleEvent> editModeToggleEvent,
                            final Event<DataTypeChangedEvent> dataTypeChangedEvent); }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } @Inject  DataTypeListItem(final View view,
                            final DataTypeSelect dataTypeSelectComponent,
                            final DataTypeConstraint dataTypeConstraintComponent,
                            final SmallSwitchComponent dataTypeListComponent,
                            final DataTypeManager dataTypeManager,
                            final DataTypeConfirmation confirmation,
                            final DataTypeNameFormatValidator nameFormatValidator,
                            final Event<DataTypeEditModeToggleEvent> editModeToggleEvent,
                            final Event<DataTypeChangedEvent> dataTypeChangedEvent); void init(final DataTypeList dataTypeList); DataType getDataType(); boolean isReadOnly(); int getLevel(); boolean isCollapsed(); void expand(); void collapse(); void enableEditMode(); void disableEditMode(); void saveAndCloseEditMode(); void remove(); Command removeItem(); Command destroy(); void destroyWithDependentTypes(); void destroyWithoutDependentTypes(); String getType(); void insertFieldAbove(); String insertFieldAbove(final DataType dataType); void insertFieldBelow(); String insertFieldBelow(final DataType dataType); void insertNestedField(); void insertNestedField(final DataType newDataType); HTMLElement getDragAndDropElement(); void highlightLevel(final DataType dataType); }
DataTypeListItem { public void enableEditMode() { if (view.isOnFocusMode()) { return; } oldName = getDataType().getName(); oldType = getDataType().getType(); oldConstraint = getDataType().getConstraint(); oldIsList = getDataType().isList(); oldConstraintType = getDataType().getConstraintType(); view.showSaveButton(); view.showDataTypeNameInput(); view.showListContainer(); view.hideListYesLabel(); view.enableFocusMode(); dataTypeSelectComponent.enableEditMode(); dataTypeConstraintComponent.enableEditMode(); editModeToggleEvent.fire(new DataTypeEditModeToggleEvent(true, this)); dataTypeList.fireOnDataTypeListItemUpdateCallback(this); } @Inject  DataTypeListItem(final View view,
                            final DataTypeSelect dataTypeSelectComponent,
                            final DataTypeConstraint dataTypeConstraintComponent,
                            final SmallSwitchComponent dataTypeListComponent,
                            final DataTypeManager dataTypeManager,
                            final DataTypeConfirmation confirmation,
                            final DataTypeNameFormatValidator nameFormatValidator,
                            final Event<DataTypeEditModeToggleEvent> editModeToggleEvent,
                            final Event<DataTypeChangedEvent> dataTypeChangedEvent); void init(final DataTypeList dataTypeList); DataType getDataType(); boolean isReadOnly(); int getLevel(); boolean isCollapsed(); void expand(); void collapse(); void enableEditMode(); void disableEditMode(); void saveAndCloseEditMode(); void remove(); Command removeItem(); Command destroy(); void destroyWithDependentTypes(); void destroyWithoutDependentTypes(); String getType(); void insertFieldAbove(); String insertFieldAbove(final DataType dataType); void insertFieldBelow(); String insertFieldBelow(final DataType dataType); void insertNestedField(); void insertNestedField(final DataType newDataType); HTMLElement getDragAndDropElement(); void highlightLevel(final DataType dataType);  }