@Test @SuppressWarnings("unchecked") public void testInit() { tested.init(); ArgumentCaptor<BiFunction> builderCaptor = ArgumentCaptor.forClass(BiFunction.class); verify(panel, times(1)).setPanelBuilder(builderCaptor.capture()); BiFunction<OptionalInt, OptionalInt, LienzoBoundsPanel> builder = builderCaptor.getValue(); LienzoBoundsPanel result = builder.apply(OptionalInt.of(300), OptionalInt.of(450)); assertTrue(result instanceof ScalablePanel); assertEquals(300, result.getWidthPx()); assertEquals(450, result.getHeightPx()); }
@PostConstruct public void init() { panel.setPanelBuilder((width, height) -> { if (width.isPresent() && height.isPresent()) { return new ScalablePanel(StunnerBoundsProviderFactory.newProvider(), width.getAsInt(), height.getAsInt()); } return new ScalablePanel(StunnerBoundsProviderFactory.newProvider()); }); }
ScalableLienzoPanel extends DelegateLienzoPanel<StunnerLienzoBoundsPanel> { @PostConstruct public void init() { panel.setPanelBuilder((width, height) -> { if (width.isPresent() && height.isPresent()) { return new ScalablePanel(StunnerBoundsProviderFactory.newProvider(), width.getAsInt(), height.getAsInt()); } return new ScalablePanel(StunnerBoundsProviderFactory.newProvider()); }); } }
ScalableLienzoPanel extends DelegateLienzoPanel<StunnerLienzoBoundsPanel> { @PostConstruct public void init() { panel.setPanelBuilder((width, height) -> { if (width.isPresent() && height.isPresent()) { return new ScalablePanel(StunnerBoundsProviderFactory.newProvider(), width.getAsInt(), height.getAsInt()); } return new ScalablePanel(StunnerBoundsProviderFactory.newProvider()); }); } @Inject  ScalableLienzoPanel(final StunnerLienzoBoundsPanel panel); }
ScalableLienzoPanel extends DelegateLienzoPanel<StunnerLienzoBoundsPanel> { @PostConstruct public void init() { panel.setPanelBuilder((width, height) -> { if (width.isPresent() && height.isPresent()) { return new ScalablePanel(StunnerBoundsProviderFactory.newProvider(), width.getAsInt(), height.getAsInt()); } return new ScalablePanel(StunnerBoundsProviderFactory.newProvider()); }); } @Inject  ScalableLienzoPanel(final StunnerLienzoBoundsPanel panel); @PostConstruct void init(); }
ScalableLienzoPanel extends DelegateLienzoPanel<StunnerLienzoBoundsPanel> { @PostConstruct public void init() { panel.setPanelBuilder((width, height) -> { if (width.isPresent() && height.isPresent()) { return new ScalablePanel(StunnerBoundsProviderFactory.newProvider(), width.getAsInt(), height.getAsInt()); } return new ScalablePanel(StunnerBoundsProviderFactory.newProvider()); }); } @Inject  ScalableLienzoPanel(final StunnerLienzoBoundsPanel panel); @PostConstruct void init();  }