@Test public void testShow() { when(panel.getWidthPx()).thenReturn(1200); when(panel.getHeightPx()).thenReturn(600); when(panelView.getAbsoluteLeft()).thenReturn(5); when(panelView.getAbsoluteTop()).thenReturn(10); tested.init(() -> panel); tested.show("some text"); verify(view, times(1)).setText(eq("some text")); verify(view, times(1)).at(560d, 60d); verify(view, times(1)).show(); }
public void show(final String text) { final LienzoPanel p = panel.get(); final int absoluteLeft = p.getView().getAbsoluteLeft(); final int absoluteTop = p.getView().getAbsoluteTop(); final int width = p.getWidthPx(); final double x = absoluteLeft + (width / 2) - (5 * text.length()); final double y = absoluteTop + 50; view.at(x, y); view.setText(text); view.show(); }
LienzoCanvasNotification { public void show(final String text) { final LienzoPanel p = panel.get(); final int absoluteLeft = p.getView().getAbsoluteLeft(); final int absoluteTop = p.getView().getAbsoluteTop(); final int width = p.getWidthPx(); final double x = absoluteLeft + (width / 2) - (5 * text.length()); final double y = absoluteTop + 50; view.at(x, y); view.setText(text); view.show(); } }
LienzoCanvasNotification { public void show(final String text) { final LienzoPanel p = panel.get(); final int absoluteLeft = p.getView().getAbsoluteLeft(); final int absoluteTop = p.getView().getAbsoluteTop(); final int width = p.getWidthPx(); final double x = absoluteLeft + (width / 2) - (5 * text.length()); final double y = absoluteTop + 50; view.at(x, y); view.setText(text); view.show(); } @Inject  LienzoCanvasNotification(final View view); }
LienzoCanvasNotification { public void show(final String text) { final LienzoPanel p = panel.get(); final int absoluteLeft = p.getView().getAbsoluteLeft(); final int absoluteTop = p.getView().getAbsoluteTop(); final int width = p.getWidthPx(); final double x = absoluteLeft + (width / 2) - (5 * text.length()); final double y = absoluteTop + 50; view.at(x, y); view.setText(text); view.show(); } @Inject  LienzoCanvasNotification(final View view); void init(final Supplier<LienzoPanel> panel); void show(final String text); void hide(); @PreDestroy void destroy(); }
LienzoCanvasNotification { public void show(final String text) { final LienzoPanel p = panel.get(); final int absoluteLeft = p.getView().getAbsoluteLeft(); final int absoluteTop = p.getView().getAbsoluteTop(); final int width = p.getWidthPx(); final double x = absoluteLeft + (width / 2) - (5 * text.length()); final double y = absoluteTop + 50; view.at(x, y); view.setText(text); view.show(); } @Inject  LienzoCanvasNotification(final View view); void init(final Supplier<LienzoPanel> panel); void show(final String text); void hide(); @PreDestroy void destroy();  }