@Test public void testGetPanelBounds() throws Exception { final Bounds bounds = Bounds.build(1.0d, 2.0d, 3.0d, 4.0d); final LienzoBoundsPanel boundsPanel = mock(LienzoBoundsPanel.class); when(boundsPanel.getBounds()).thenReturn(bounds); final Widget widget = mock(Widget.class); final Element element = mock(Element.class); final Style style = mock(Style.class); when(widget.getElement()).thenReturn(element); when(element.getStyle()).thenReturn(style); final Layer toplayer = mock(Layer.class); when(wiresLayer.getTopLayer()).thenReturn(toplayer); final LienzoPanel lienzoPanel = mock(LienzoPanel.class); when(lienzoPanel.getView()).thenReturn(boundsPanel); when(lienzoPanel.asWidget()).thenReturn(widget); view.initialize(lienzoPanel, new CanvasSettings(false)); final Optional<Bounds> result = view.getPanelBounds(); assertTrue(result.isPresent()); assertEquals(bounds.getHeight(), result.get().getHeight(), 0.00001); assertEquals(bounds, result.get()); }
Optional<Bounds> getPanelBounds() { return boundsPanel .map(bp -> Optional.of(bp.getBounds())) .orElse(Optional.empty()); }
CaseManagementCanvasView extends WiresCanvasView { Optional<Bounds> getPanelBounds() { return boundsPanel .map(bp -> Optional.of(bp.getBounds())) .orElse(Optional.empty()); } }
CaseManagementCanvasView extends WiresCanvasView { Optional<Bounds> getPanelBounds() { return boundsPanel .map(bp -> Optional.of(bp.getBounds())) .orElse(Optional.empty()); } @Inject  CaseManagementCanvasView(final WiresLayer layer); }
CaseManagementCanvasView extends WiresCanvasView { Optional<Bounds> getPanelBounds() { return boundsPanel .map(bp -> Optional.of(bp.getBounds())) .orElse(Optional.empty()); } @Inject  CaseManagementCanvasView(final WiresLayer layer); @Override WiresCanvasView add(final ShapeView<?> shapeView); WiresCanvasView addChildShape(final ShapeView<?> parent, final ShapeView<?> child, final int index); }
CaseManagementCanvasView extends WiresCanvasView { Optional<Bounds> getPanelBounds() { return boundsPanel .map(bp -> Optional.of(bp.getBounds())) .orElse(Optional.empty()); } @Inject  CaseManagementCanvasView(final WiresLayer layer); @Override WiresCanvasView add(final ShapeView<?> shapeView); WiresCanvasView addChildShape(final ShapeView<?> parent, final ShapeView<?> child, final int index);  }