@Test public void testRender() { IsElement rendered = tested.render(GLYPH, SIZE, SIZE); verify(cssResource, times(1)).ensureInjected(); ArgumentCaptor<Integer[]> clipCaptor = ArgumentCaptor.forClass(Integer[].class); verify(panelBuilder, times(1)).apply(eq("testClass"), clipCaptor.capture()); Integer[] clip = clipCaptor.getValue(); assertEquals(SIZE, clip[0], 0); assertEquals(0, clip[1], 0); assertEquals(rendered, view); }
@Override public IsElement render(final ImageStripGlyph glyph, final double width, final double height) { final ImageStrip strip = stripRegistry.get(glyph.getStripType()); final int index = glyph.getIndex(); final boolean isHorizontal = ImageStrip.Orientation.HORIZONTAL.equals(strip.getOrientation()); final int clipX = isHorizontal ? (strip.getWide() + strip.getPadding()) * index : 0; final int clipY = !isHorizontal ? (strip.getHigh() + strip.getPadding()) * index : 0; final WidgetElementRendererView view = views.get(); strip.getCss().getCssResource().ensureInjected(); view.setWidget(panelBuilder.apply(strip.getCss().getClassName(), new Integer[]{clipX, clipY * -1})); return view; }
ImageStripDOMGlyphRenderer implements DOMGlyphRenderer<ImageStripGlyph> { @Override public IsElement render(final ImageStripGlyph glyph, final double width, final double height) { final ImageStrip strip = stripRegistry.get(glyph.getStripType()); final int index = glyph.getIndex(); final boolean isHorizontal = ImageStrip.Orientation.HORIZONTAL.equals(strip.getOrientation()); final int clipX = isHorizontal ? (strip.getWide() + strip.getPadding()) * index : 0; final int clipY = !isHorizontal ? (strip.getHigh() + strip.getPadding()) * index : 0; final WidgetElementRendererView view = views.get(); strip.getCss().getCssResource().ensureInjected(); view.setWidget(panelBuilder.apply(strip.getCss().getClassName(), new Integer[]{clipX, clipY * -1})); return view; } }
ImageStripDOMGlyphRenderer implements DOMGlyphRenderer<ImageStripGlyph> { @Override public IsElement render(final ImageStripGlyph glyph, final double width, final double height) { final ImageStrip strip = stripRegistry.get(glyph.getStripType()); final int index = glyph.getIndex(); final boolean isHorizontal = ImageStrip.Orientation.HORIZONTAL.equals(strip.getOrientation()); final int clipX = isHorizontal ? (strip.getWide() + strip.getPadding()) * index : 0; final int clipY = !isHorizontal ? (strip.getHigh() + strip.getPadding()) * index : 0; final WidgetElementRendererView view = views.get(); strip.getCss().getCssResource().ensureInjected(); view.setWidget(panelBuilder.apply(strip.getCss().getClassName(), new Integer[]{clipX, clipY * -1})); return view; } @Inject  ImageStripDOMGlyphRenderer(final ImageStripRegistry stripRegistry,
                                      final ManagedInstance<WidgetElementRendererView> views);   ImageStripDOMGlyphRenderer(final ImageStripRegistry stripRegistry,
                               final ManagedInstance<WidgetElementRendererView> views,
                               final BiFunction<String, Integer[], FlowPanel> panelBuilder); }
ImageStripDOMGlyphRenderer implements DOMGlyphRenderer<ImageStripGlyph> { @Override public IsElement render(final ImageStripGlyph glyph, final double width, final double height) { final ImageStrip strip = stripRegistry.get(glyph.getStripType()); final int index = glyph.getIndex(); final boolean isHorizontal = ImageStrip.Orientation.HORIZONTAL.equals(strip.getOrientation()); final int clipX = isHorizontal ? (strip.getWide() + strip.getPadding()) * index : 0; final int clipY = !isHorizontal ? (strip.getHigh() + strip.getPadding()) * index : 0; final WidgetElementRendererView view = views.get(); strip.getCss().getCssResource().ensureInjected(); view.setWidget(panelBuilder.apply(strip.getCss().getClassName(), new Integer[]{clipX, clipY * -1})); return view; } @Inject  ImageStripDOMGlyphRenderer(final ImageStripRegistry stripRegistry,
                                      final ManagedInstance<WidgetElementRendererView> views);   ImageStripDOMGlyphRenderer(final ImageStripRegistry stripRegistry,
                               final ManagedInstance<WidgetElementRendererView> views,
                               final BiFunction<String, Integer[], FlowPanel> panelBuilder); @Override Class<ImageStripGlyph> getGlyphType(); @Override IsElement render(final ImageStripGlyph glyph,
                            final double width,
                            final double height); @PreDestroy void destroy(); }
ImageStripDOMGlyphRenderer implements DOMGlyphRenderer<ImageStripGlyph> { @Override public IsElement render(final ImageStripGlyph glyph, final double width, final double height) { final ImageStrip strip = stripRegistry.get(glyph.getStripType()); final int index = glyph.getIndex(); final boolean isHorizontal = ImageStrip.Orientation.HORIZONTAL.equals(strip.getOrientation()); final int clipX = isHorizontal ? (strip.getWide() + strip.getPadding()) * index : 0; final int clipY = !isHorizontal ? (strip.getHigh() + strip.getPadding()) * index : 0; final WidgetElementRendererView view = views.get(); strip.getCss().getCssResource().ensureInjected(); view.setWidget(panelBuilder.apply(strip.getCss().getClassName(), new Integer[]{clipX, clipY * -1})); return view; } @Inject  ImageStripDOMGlyphRenderer(final ImageStripRegistry stripRegistry,
                                      final ManagedInstance<WidgetElementRendererView> views);   ImageStripDOMGlyphRenderer(final ImageStripRegistry stripRegistry,
                               final ManagedInstance<WidgetElementRendererView> views,
                               final BiFunction<String, Integer[], FlowPanel> panelBuilder); @Override Class<ImageStripGlyph> getGlyphType(); @Override IsElement render(final ImageStripGlyph glyph,
                            final double width,
                            final double height); @PreDestroy void destroy();  }