@Test public void testBuild() { decorator.build(primitive, 5.0, 8.0); verify(decorator).createRectangle(5.0, 8.0); verify(decorator).add(primitive); verify(decorator).add(rectangle); verify(rectangle).addNodeMouseEnterHandler(anyObject()); verify(rectangle).addNodeMouseExitHandler(anyObject()); verify(rectangle).addNodeMouseMoveHandler(anyObject()); verify(rectangle).setDraggable(false); verify(rectangle).moveToTop(); }
public IPrimitive<?> build(final IPrimitive<?> item, final double width, final double height) { decorator = createRectangle(width, height); this.add(decorator); this.add(item); decorator.setX(item.getX() - (padding / 4)); decorator.setY(item.getY() - (padding / 4)); decorator.addNodeMouseEnterHandler(nodeMouseEnterEvent -> show(nodeMouseEnterEvent.getMouseEvent().getClientX(), nodeMouseEnterEvent.getMouseEvent().getClientY())); decorator.addNodeMouseExitHandler(nodeMouseExitEvent -> hide()); decorator.addNodeMouseMoveHandler(nodeMouseMoveEvent -> timer.cancel()); item.setDraggable(false); decorator.setDraggable(false).moveToTop(); return this; }
Decorator extends Group { public IPrimitive<?> build(final IPrimitive<?> item, final double width, final double height) { decorator = createRectangle(width, height); this.add(decorator); this.add(item); decorator.setX(item.getX() - (padding / 4)); decorator.setY(item.getY() - (padding / 4)); decorator.addNodeMouseEnterHandler(nodeMouseEnterEvent -> show(nodeMouseEnterEvent.getMouseEvent().getClientX(), nodeMouseEnterEvent.getMouseEvent().getClientY())); decorator.addNodeMouseExitHandler(nodeMouseExitEvent -> hide()); decorator.addNodeMouseMoveHandler(nodeMouseMoveEvent -> timer.cancel()); item.setDraggable(false); decorator.setDraggable(false).moveToTop(); return this; } }
Decorator extends Group { public IPrimitive<?> build(final IPrimitive<?> item, final double width, final double height) { decorator = createRectangle(width, height); this.add(decorator); this.add(item); decorator.setX(item.getX() - (padding / 4)); decorator.setY(item.getY() - (padding / 4)); decorator.addNodeMouseEnterHandler(nodeMouseEnterEvent -> show(nodeMouseEnterEvent.getMouseEvent().getClientX(), nodeMouseEnterEvent.getMouseEvent().getClientY())); decorator.addNodeMouseExitHandler(nodeMouseExitEvent -> hide()); decorator.addNodeMouseMoveHandler(nodeMouseMoveEvent -> timer.cancel()); item.setDraggable(false); decorator.setDraggable(false).moveToTop(); return this; } Decorator(final ItemCallback callback); }
Decorator extends Group { public IPrimitive<?> build(final IPrimitive<?> item, final double width, final double height) { decorator = createRectangle(width, height); this.add(decorator); this.add(item); decorator.setX(item.getX() - (padding / 4)); decorator.setY(item.getY() - (padding / 4)); decorator.addNodeMouseEnterHandler(nodeMouseEnterEvent -> show(nodeMouseEnterEvent.getMouseEvent().getClientX(), nodeMouseEnterEvent.getMouseEvent().getClientY())); decorator.addNodeMouseExitHandler(nodeMouseExitEvent -> hide()); decorator.addNodeMouseMoveHandler(nodeMouseMoveEvent -> timer.cancel()); item.setDraggable(false); decorator.setDraggable(false).moveToTop(); return this; } Decorator(final ItemCallback callback); Decorator setPadding(final double padding); Decorator setItemCallback(final ItemCallback callback); IPrimitive<?> build(final IPrimitive<?> item,
                               final double width,
                               final double height); Rectangle createRectangle(final double width,
                                     final double height); Decorator show(final double x,
                          final double y); Decorator hide(); }
Decorator extends Group { public IPrimitive<?> build(final IPrimitive<?> item, final double width, final double height) { decorator = createRectangle(width, height); this.add(decorator); this.add(item); decorator.setX(item.getX() - (padding / 4)); decorator.setY(item.getY() - (padding / 4)); decorator.addNodeMouseEnterHandler(nodeMouseEnterEvent -> show(nodeMouseEnterEvent.getMouseEvent().getClientX(), nodeMouseEnterEvent.getMouseEvent().getClientY())); decorator.addNodeMouseExitHandler(nodeMouseExitEvent -> hide()); decorator.addNodeMouseMoveHandler(nodeMouseMoveEvent -> timer.cancel()); item.setDraggable(false); decorator.setDraggable(false).moveToTop(); return this; } Decorator(final ItemCallback callback); Decorator setPadding(final double padding); Decorator setItemCallback(final ItemCallback callback); IPrimitive<?> build(final IPrimitive<?> item,
                               final double width,
                               final double height); Rectangle createRectangle(final double width,
                                     final double height); Decorator show(final double x,
                          final double y); Decorator hide();  }