public static ImageStripGlyph create(final Class<? extends ImageStrip> stripType, final int index) { return new ImageStripGlyph(stripType, index); }
@Override public Group render(final ImageStripGlyph glyph, final double width, final double height) { final Group group = new Group(); final Image image = imageBuilder.apply(ImageStripRegistry.getName(glyph.getStripType()), glyph.getIndex()); scaleShape(image, width, height); group.add(image); return group; }
@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; }