@Test public void testRefreshItemsPosition() { final HTMLElement element0 = mock(HTMLElement.class); final HTMLElement element1 = mock(HTMLElement.class); final HTMLElement element2 = mock(HTMLElement.class); element0.style = mock(CSSStyleDeclaration.class); element1.style = mock(CSSStyleDeclaration.class); element2.style = mock(CSSStyleDeclaration.class); dragArea.style = mock(CSSStyleDeclaration.class); when(presenter.getItemHeight()).thenReturn(50); when(presenter.getIndentationSize()).thenReturn(75); when(element0.getAttribute(DATA_Y_POSITION)).thenReturn("0"); when(element1.getAttribute(DATA_Y_POSITION)).thenReturn("1"); when(element2.getAttribute(DATA_Y_POSITION)).thenReturn("2"); when(element0.getAttribute(DATA_X_POSITION)).thenReturn("0"); when(element1.getAttribute(DATA_X_POSITION)).thenReturn("1"); when(element2.getAttribute(DATA_X_POSITION)).thenReturn("1"); mockDragAreaWithChildren(element0, element1, element2); view.refreshItemsPosition(); verify(element0.style).setProperty("top", "0px"); verify(element1.style).setProperty("top", "50px"); verify(element2.style).setProperty("top", "100px"); verify(element0.style).setProperty("padding-left", "0px"); verify(element1.style).setProperty("padding-left", "75px"); verify(element2.style).setProperty("padding-left", "75px"); verify(element0.style).setProperty("width", "calc(100% - 0px)"); verify(element1.style).setProperty("width", "calc(100% - 0px)"); verify(element2.style).setProperty("width", "calc(100% - 0px)"); verify(dragArea.style).setProperty("height", "151px"); }
@Override public void refreshItemsPosition() { final List<HTMLElement> items = querySelector(getDragArea()).getVisibleAndSortedDraggableElements(); for (final HTMLElement draggable : items) { final int positionY = Position.getY(draggable); final int positionX = Position.getX(draggable); final int top = positionY * getItemHeight(); final int margin = positionX * getLevelSize(); setCSSTop(draggable, top); setCSSPaddingLeft(draggable, margin); setCSSWidth(draggable, 0); } refreshDragAreaSize(); }
DNDListComponentView implements DNDListComponent.View { @Override public void refreshItemsPosition() { final List<HTMLElement> items = querySelector(getDragArea()).getVisibleAndSortedDraggableElements(); for (final HTMLElement draggable : items) { final int positionY = Position.getY(draggable); final int positionX = Position.getX(draggable); final int top = positionY * getItemHeight(); final int margin = positionX * getLevelSize(); setCSSTop(draggable, top); setCSSPaddingLeft(draggable, margin); setCSSWidth(draggable, 0); } refreshDragAreaSize(); } }
DNDListComponentView implements DNDListComponent.View { @Override public void refreshItemsPosition() { final List<HTMLElement> items = querySelector(getDragArea()).getVisibleAndSortedDraggableElements(); for (final HTMLElement draggable : items) { final int positionY = Position.getY(draggable); final int positionX = Position.getX(draggable); final int top = positionY * getItemHeight(); final int margin = positionX * getLevelSize(); setCSSTop(draggable, top); setCSSPaddingLeft(draggable, margin); setCSSWidth(draggable, 0); } refreshDragAreaSize(); } @Inject  DNDListComponentView(final HTMLDivElement dragArea); }
DNDListComponentView implements DNDListComponent.View { @Override public void refreshItemsPosition() { final List<HTMLElement> items = querySelector(getDragArea()).getVisibleAndSortedDraggableElements(); for (final HTMLElement draggable : items) { final int positionY = Position.getY(draggable); final int positionX = Position.getX(draggable); final int top = positionY * getItemHeight(); final int margin = positionX * getLevelSize(); setCSSTop(draggable, top); setCSSPaddingLeft(draggable, margin); setCSSWidth(draggable, 0); } refreshDragAreaSize(); } @Inject  DNDListComponentView(final HTMLDivElement dragArea); @Override void init(final DNDListComponent presenter); @Override HTMLElement registerItem(final HTMLElement htmlElement); @Override void refreshItemsPosition(); @Override void refreshItemsHTML(); @Override void consolidateHierarchicalLevel(final boolean isElementsDraggedByUser); @Override void consolidateYPosition(); @Override void clear(); @Override Optional<HTMLElement> getPreviousElement(final Element reference); @Override void refreshDragAreaSize(); @Override HTMLDivElement getDragArea(); }
DNDListComponentView implements DNDListComponent.View { @Override public void refreshItemsPosition() { final List<HTMLElement> items = querySelector(getDragArea()).getVisibleAndSortedDraggableElements(); for (final HTMLElement draggable : items) { final int positionY = Position.getY(draggable); final int positionX = Position.getX(draggable); final int top = positionY * getItemHeight(); final int margin = positionX * getLevelSize(); setCSSTop(draggable, top); setCSSPaddingLeft(draggable, margin); setCSSWidth(draggable, 0); } refreshDragAreaSize(); } @Inject  DNDListComponentView(final HTMLDivElement dragArea); @Override void init(final DNDListComponent presenter); @Override HTMLElement registerItem(final HTMLElement htmlElement); @Override void refreshItemsPosition(); @Override void refreshItemsHTML(); @Override void consolidateHierarchicalLevel(final boolean isElementsDraggedByUser); @Override void consolidateYPosition(); @Override void clear(); @Override Optional<HTMLElement> getPreviousElement(final Element reference); @Override void refreshDragAreaSize(); @Override HTMLDivElement getDragArea();  }