@Test public void testShow() { final PopupEditorControls editor = mock(PopupEditorControls.class); final int x = 10; final int y = 20; final HTMLElement element = mock(HTMLElement.class); doReturn(element).when(view).getElement(); final CSSStyleDeclaration style = mock(CSSStyleDeclaration.class); when(element.getStyle()).thenReturn(style); view.show(editor, x, y); verify(style).setProperty(LEFT, x + PX); verify(style).setProperty(TOP, y + PX); verify(view).setOnClosedByKeyboardCallback(editor); verify(editor).show(); }
@Override public void show(final PopupEditorControls editor, final int x, final int y) { DOMUtil.removeAllChildren(cellEditorControlsContainer); cellEditorControlsContainer.appendChild(editor.getElement()); final CSSStyleDeclaration style = getElement().getStyle(); style.setProperty(LEFT, x + PX); style.setProperty(TOP, y + PX); setActiveEditor(Optional.of(editor)); setOnClosedByKeyboardCallback(editor); editor.show(); }
CellEditorControlsViewImpl implements CellEditorControlsView { @Override public void show(final PopupEditorControls editor, final int x, final int y) { DOMUtil.removeAllChildren(cellEditorControlsContainer); cellEditorControlsContainer.appendChild(editor.getElement()); final CSSStyleDeclaration style = getElement().getStyle(); style.setProperty(LEFT, x + PX); style.setProperty(TOP, y + PX); setActiveEditor(Optional.of(editor)); setOnClosedByKeyboardCallback(editor); editor.show(); } }
CellEditorControlsViewImpl implements CellEditorControlsView { @Override public void show(final PopupEditorControls editor, final int x, final int y) { DOMUtil.removeAllChildren(cellEditorControlsContainer); cellEditorControlsContainer.appendChild(editor.getElement()); final CSSStyleDeclaration style = getElement().getStyle(); style.setProperty(LEFT, x + PX); style.setProperty(TOP, y + PX); setActiveEditor(Optional.of(editor)); setOnClosedByKeyboardCallback(editor); editor.show(); } CellEditorControlsViewImpl(); @Inject  CellEditorControlsViewImpl(final Document document,
                                      final Div cellEditorControls,
                                      final Div cellEditorControlsContainer); }
CellEditorControlsViewImpl implements CellEditorControlsView { @Override public void show(final PopupEditorControls editor, final int x, final int y) { DOMUtil.removeAllChildren(cellEditorControlsContainer); cellEditorControlsContainer.appendChild(editor.getElement()); final CSSStyleDeclaration style = getElement().getStyle(); style.setProperty(LEFT, x + PX); style.setProperty(TOP, y + PX); setActiveEditor(Optional.of(editor)); setOnClosedByKeyboardCallback(editor); editor.show(); } CellEditorControlsViewImpl(); @Inject  CellEditorControlsViewImpl(final Document document,
                                      final Div cellEditorControls,
                                      final Div cellEditorControlsContainer); Optional<PopupEditorControls> getActiveEditor(); void setActiveEditor(final Optional<PopupEditorControls> activeEditor); @PostConstruct void setup(); @PreDestroy void destroy(); @Override void show(final PopupEditorControls editor,
                     final int x,
                     final int y); @Override void hide(); }
CellEditorControlsViewImpl implements CellEditorControlsView { @Override public void show(final PopupEditorControls editor, final int x, final int y) { DOMUtil.removeAllChildren(cellEditorControlsContainer); cellEditorControlsContainer.appendChild(editor.getElement()); final CSSStyleDeclaration style = getElement().getStyle(); style.setProperty(LEFT, x + PX); style.setProperty(TOP, y + PX); setActiveEditor(Optional.of(editor)); setOnClosedByKeyboardCallback(editor); editor.show(); } CellEditorControlsViewImpl(); @Inject  CellEditorControlsViewImpl(final Document document,
                                      final Div cellEditorControls,
                                      final Div cellEditorControlsContainer); Optional<PopupEditorControls> getActiveEditor(); void setActiveEditor(final Optional<PopupEditorControls> activeEditor); @PostConstruct void setup(); @PreDestroy void destroy(); @Override void show(final PopupEditorControls editor,
                     final int x,
                     final int y); @Override void hide(); static final String LEFT; static final String TOP; }