@Test public void testOnMouseDown() { int clientX = 1; int clientY = 2; int x = 3; int y = 4; when(definitionPaletteItemWidgetInstance.get()).thenReturn(itemWidget); when(definitionPaletteGroupWidgetInstance.get()).thenReturn(groupWidget); DefaultPaletteCategory category = mockPaletteCategory(); widget.initialize(category, shapeFactory, itemMouseDownCallback); widget.onMouseDown(clientX, clientY, x, y); verify(itemMouseDownCallback, times(1)).accept(itemMouseEventCaptor.capture()); assertEquals((float) clientX, itemMouseEventCaptor.getValue().getMouseX(), 0); assertEquals((float) clientY, itemMouseEventCaptor.getValue().getMouseY(), 0); assertEquals((float) x, itemMouseEventCaptor.getValue().getItemX(), 0); assertEquals((float) y, itemMouseEventCaptor.getValue().getItemY(), 0); }
@Override public void onMouseDown(int clientX, int clientY, int x, int y) { if (itemMouseDownCallback != null) { itemMouseDownCallback.accept(new PaletteItemMouseEvent(category.getId(), clientX, clientY, x, y)); } }
DefinitionPaletteCategoryWidget implements DefinitionPaletteCategoryWidgetView.Presenter { @Override public void onMouseDown(int clientX, int clientY, int x, int y) { if (itemMouseDownCallback != null) { itemMouseDownCallback.accept(new PaletteItemMouseEvent(category.getId(), clientX, clientY, x, y)); } } }
DefinitionPaletteCategoryWidget implements DefinitionPaletteCategoryWidgetView.Presenter { @Override public void onMouseDown(int clientX, int clientY, int x, int y) { if (itemMouseDownCallback != null) { itemMouseDownCallback.accept(new PaletteItemMouseEvent(category.getId(), clientX, clientY, x, y)); } } @Inject  DefinitionPaletteCategoryWidget(DefinitionPaletteCategoryWidgetView view,
                                           ManagedInstance<DefinitionPaletteItemWidget> definitionPaletteItemWidgetInstance,
                                           ManagedInstance<DefinitionPaletteGroupWidget> definitionPaletteGroupWidgetInstance); }
DefinitionPaletteCategoryWidget implements DefinitionPaletteCategoryWidgetView.Presenter { @Override public void onMouseDown(int clientX, int clientY, int x, int y) { if (itemMouseDownCallback != null) { itemMouseDownCallback.accept(new PaletteItemMouseEvent(category.getId(), clientX, clientY, x, y)); } } @Inject  DefinitionPaletteCategoryWidget(DefinitionPaletteCategoryWidgetView view,
                                           ManagedInstance<DefinitionPaletteItemWidget> definitionPaletteItemWidgetInstance,
                                           ManagedInstance<DefinitionPaletteGroupWidget> definitionPaletteGroupWidgetInstance); @PostConstruct void setUp(); @Override HTMLElement getElement(); @Override void initialize(final DefaultPaletteCategory category,
                           final ShapeFactory<?, ?> shapeFactory,
                           final Consumer<PaletteItemMouseEvent> itemMouseDownCallback); void setOnOpenCallback(Consumer<DefaultPaletteCategory> onOpenCallback); void setOnCloseCallback(Consumer<DefaultPaletteCategory> onCloseCallback); void setVisible(final boolean visible); boolean isVisible(); void setAutoHidePanel(boolean autoHidePanel); DefinitionPaletteCategoryWidgetView getView(); @Override DefaultPaletteCategory getCategory(); @Override void onMouseDown(int clientX,
                            int clientY,
                            int x,
                            int y); @Override void onOpen(); @Override void onClose(); @PreDestroy void destroy(); }
DefinitionPaletteCategoryWidget implements DefinitionPaletteCategoryWidgetView.Presenter { @Override public void onMouseDown(int clientX, int clientY, int x, int y) { if (itemMouseDownCallback != null) { itemMouseDownCallback.accept(new PaletteItemMouseEvent(category.getId(), clientX, clientY, x, y)); } } @Inject  DefinitionPaletteCategoryWidget(DefinitionPaletteCategoryWidgetView view,
                                           ManagedInstance<DefinitionPaletteItemWidget> definitionPaletteItemWidgetInstance,
                                           ManagedInstance<DefinitionPaletteGroupWidget> definitionPaletteGroupWidgetInstance); @PostConstruct void setUp(); @Override HTMLElement getElement(); @Override void initialize(final DefaultPaletteCategory category,
                           final ShapeFactory<?, ?> shapeFactory,
                           final Consumer<PaletteItemMouseEvent> itemMouseDownCallback); void setOnOpenCallback(Consumer<DefaultPaletteCategory> onOpenCallback); void setOnCloseCallback(Consumer<DefaultPaletteCategory> onCloseCallback); void setVisible(final boolean visible); boolean isVisible(); void setAutoHidePanel(boolean autoHidePanel); DefinitionPaletteCategoryWidgetView getView(); @Override DefaultPaletteCategory getCategory(); @Override void onMouseDown(int clientX,
                            int clientY,
                            int x,
                            int y); @Override void onOpen(); @Override void onClose(); @PreDestroy void destroy();  }