@Test public void getItemContainer() { elementViewListLocal.clear(); ITEM_ID_EXPANDABLE_PROPERTIES_MAP_LOCAL.clear(); LIElement itemContainer = elementPresenter.getItemContainer(TEST_ITEM_ID, TEST_PROPERTIES_MAP, EXPANDABLE_PROPERTIES_VALUES); verify(elementView1Mock, times(1 + EXPANDABLE_PROPERTIES_VALUES.size())).init(elementPresenter); verify(elementView1Mock, times(1)).setItemId(TEST_ITEM_ID); verify(elementView1Mock, times(1 + EXPANDABLE_PROPERTIES_VALUES.size())).getItemContainer(); verify(elementView1Mock, times(3)).getSaveChange(); TEST_PROPERTIES_MAP.forEach((propertyName, propertyValue) -> { verify(propertyPresenterMock, times(1)) .getPropertyFields(eq(TEST_ITEM_ID), eq(propertyName), eq(propertyValue)); verify(innerItemContainerMock, times(1)).insertBefore(propertyFieldsMock, saveChangeMock); reset(innerItemContainerMock); }); assertTrue(ITEM_ID_EXPANDABLE_PROPERTIES_MAP_LOCAL.containsKey(TEST_ITEM_ID)); EXPANDABLE_PROPERTIES_VALUES.forEach((nestedPropertyName, nestedPropertiesValues) -> { assertTrue(ITEM_ID_EXPANDABLE_PROPERTIES_MAP_LOCAL.get(TEST_ITEM_ID).contains(nestedPropertyName)); verify((ItemElementPresenter) elementPresenter, times(1)).addExpandableItemElementView(eq(elementView1Mock), eq(nestedPropertiesValues), eq(nestedPropertyName)); }); assertNotNull(itemContainer); assertTrue(elementViewListLocal.contains(elementView1Mock)); }
@Override public LIElement getItemContainer(String itemId, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesValues) { final ItemElementView itemElementView = viewsProvider.getListEditorElementView(); itemElementView.init(this); itemElementView.setItemId(itemId); final UListElement innerItemContainer = itemElementView.getInnerItemContainer(); final LIElement saveChange = itemElementView.getSaveChange(); simplePropertiesMap.forEach((propertyName, propertyValue) -> innerItemContainer.insertBefore(propertyPresenter.getPropertyFields(itemId, propertyName, propertyValue), saveChange)); itemIdExpandablePropertiesMap.put(itemId, new ArrayList<>()); expandablePropertiesValues.forEach((nestedPropertyName, nestedPropertiesValues) -> { itemIdExpandablePropertiesMap.get(itemId).add(nestedPropertyName); addExpandableItemElementView(itemElementView, nestedPropertiesValues, nestedPropertyName); }); elementViewList.add(itemElementView); return itemElementView.getItemContainer(); }
ItemElementPresenter extends ElementPresenter<ItemElementView> implements ItemElementView.Presenter { @Override public LIElement getItemContainer(String itemId, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesValues) { final ItemElementView itemElementView = viewsProvider.getListEditorElementView(); itemElementView.init(this); itemElementView.setItemId(itemId); final UListElement innerItemContainer = itemElementView.getInnerItemContainer(); final LIElement saveChange = itemElementView.getSaveChange(); simplePropertiesMap.forEach((propertyName, propertyValue) -> innerItemContainer.insertBefore(propertyPresenter.getPropertyFields(itemId, propertyName, propertyValue), saveChange)); itemIdExpandablePropertiesMap.put(itemId, new ArrayList<>()); expandablePropertiesValues.forEach((nestedPropertyName, nestedPropertiesValues) -> { itemIdExpandablePropertiesMap.get(itemId).add(nestedPropertyName); addExpandableItemElementView(itemElementView, nestedPropertiesValues, nestedPropertyName); }); elementViewList.add(itemElementView); return itemElementView.getItemContainer(); } }
ItemElementPresenter extends ElementPresenter<ItemElementView> implements ItemElementView.Presenter { @Override public LIElement getItemContainer(String itemId, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesValues) { final ItemElementView itemElementView = viewsProvider.getListEditorElementView(); itemElementView.init(this); itemElementView.setItemId(itemId); final UListElement innerItemContainer = itemElementView.getInnerItemContainer(); final LIElement saveChange = itemElementView.getSaveChange(); simplePropertiesMap.forEach((propertyName, propertyValue) -> innerItemContainer.insertBefore(propertyPresenter.getPropertyFields(itemId, propertyName, propertyValue), saveChange)); itemIdExpandablePropertiesMap.put(itemId, new ArrayList<>()); expandablePropertiesValues.forEach((nestedPropertyName, nestedPropertiesValues) -> { itemIdExpandablePropertiesMap.get(itemId).add(nestedPropertyName); addExpandableItemElementView(itemElementView, nestedPropertiesValues, nestedPropertyName); }); elementViewList.add(itemElementView); return itemElementView.getItemContainer(); }  }
ItemElementPresenter extends ElementPresenter<ItemElementView> implements ItemElementView.Presenter { @Override public LIElement getItemContainer(String itemId, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesValues) { final ItemElementView itemElementView = viewsProvider.getListEditorElementView(); itemElementView.init(this); itemElementView.setItemId(itemId); final UListElement innerItemContainer = itemElementView.getInnerItemContainer(); final LIElement saveChange = itemElementView.getSaveChange(); simplePropertiesMap.forEach((propertyName, propertyValue) -> innerItemContainer.insertBefore(propertyPresenter.getPropertyFields(itemId, propertyName, propertyValue), saveChange)); itemIdExpandablePropertiesMap.put(itemId, new ArrayList<>()); expandablePropertiesValues.forEach((nestedPropertyName, nestedPropertiesValues) -> { itemIdExpandablePropertiesMap.get(itemId).add(nestedPropertyName); addExpandableItemElementView(itemElementView, nestedPropertiesValues, nestedPropertyName); }); elementViewList.add(itemElementView); return itemElementView.getItemContainer(); }  @Override LIElement getItemContainer(String itemId, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesValues); @Override void onToggleRowExpansion(ItemElementView itemElementView, boolean isShown); @Override void onEditItem(ItemElementView itemElementView); @Override void onStopEditingItem(ItemElementView itemElementView); @Override void updateItem(ItemElementView itemElementView); @Override void onDeleteItem(ItemElementView itemElementView); @Override Map<String, Map<String, String>> getSimpleItemsProperties(); @Override Map<String, Map<String, Map<String, String>>> getExpandableItemsProperties(); }
ItemElementPresenter extends ElementPresenter<ItemElementView> implements ItemElementView.Presenter { @Override public LIElement getItemContainer(String itemId, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesValues) { final ItemElementView itemElementView = viewsProvider.getListEditorElementView(); itemElementView.init(this); itemElementView.setItemId(itemId); final UListElement innerItemContainer = itemElementView.getInnerItemContainer(); final LIElement saveChange = itemElementView.getSaveChange(); simplePropertiesMap.forEach((propertyName, propertyValue) -> innerItemContainer.insertBefore(propertyPresenter.getPropertyFields(itemId, propertyName, propertyValue), saveChange)); itemIdExpandablePropertiesMap.put(itemId, new ArrayList<>()); expandablePropertiesValues.forEach((nestedPropertyName, nestedPropertiesValues) -> { itemIdExpandablePropertiesMap.get(itemId).add(nestedPropertyName); addExpandableItemElementView(itemElementView, nestedPropertiesValues, nestedPropertyName); }); elementViewList.add(itemElementView); return itemElementView.getItemContainer(); }  @Override LIElement getItemContainer(String itemId, Map<String, String> simplePropertiesMap, Map<String, Map<String, String>> expandablePropertiesValues); @Override void onToggleRowExpansion(ItemElementView itemElementView, boolean isShown); @Override void onEditItem(ItemElementView itemElementView); @Override void onStopEditingItem(ItemElementView itemElementView); @Override void updateItem(ItemElementView itemElementView); @Override void onDeleteItem(ItemElementView itemElementView); @Override Map<String, Map<String, String>> getSimpleItemsProperties(); @Override Map<String, Map<String, Map<String, String>>> getExpandableItemsProperties();  }