/** * Renders a copy of the given icon, with a different Wicket ID. * @param icon the icon to render * @param newId the new Wicket ID * @return a copy of the given icon */ public static HippoIcon copy(final HippoIcon icon, final String newId) { if (icon instanceof SpriteIcon) { return new SpriteIcon(newId, (SpriteIcon)icon); } else if (icon instanceof InlineSvgIcon) { return new InlineSvgIcon(newId, (InlineSvgIcon)icon); } else if (icon instanceof ResourceIcon) { return new ResourceIcon(newId, (ResourceIcon)icon); } throw new IllegalStateException("Expected HippoIcon's class to be either SpriteIcon, InlineSvgIcon or ResourceIcon, but got " + icon.getClass()); }
/** * Renders a hippo icon of size {@link IconSize#M} as an inline SVG. This makes it possible * to, for example, style the individual shapes in the SVG via CSS. * @param id the Wicket id of the icon * @param model the model containing the icon to render * @return the icon component */ public static HippoIcon inline(final String id, final IModel<CmsIcon> model) { return new InlineSvgIcon(id, model, IconSize.M); }
@Override String getSvgMarkup(final IconSize size, final String optionalCssClasses) { return getIcon().getInlineSvg(size, optionalCssClasses); } }
/** * Renders a hippo icon of size {@link IconSize#M} as an inline SVG. This makes it possible to, * for example, style the individual shapes in the SVG via CSS. * @param id the Wicket id of the icon * @param icon the icon to render * @return the icon component */ public static HippoIcon inline(final String id, final CmsIcon icon) { return new InlineSvgIcon(id, icon, IconSize.M); }