public HippoIcon replaceFromSprite(final HippoIcon oldIcon, final Icon newIcon, final Position position) { HippoIcon newCopy = HippoIcon.fromSprite(oldIcon.getId(), newIcon); addIcon(newCopy, position); return newCopy; }
public HippoIcon replaceFromResource(final HippoIcon oldIcon, final ResourceReference newReference, final Position position) { HippoIcon newCopy = HippoIcon.fromResource(oldIcon.getId(), newReference); addIcon(newCopy, position); return newCopy; }
@Override protected Component getIcon(final String id) { HippoIconStack iconStack = new HippoIconStack(id, IconSize.M); iconStack.addFromSprite(Icon.FILE); iconStack.addFromCms(CmsIcon.OVERLAY_PLUS, IconSize.M, Position.TOP_LEFT); return iconStack; } }
public HippoIcon addFromCms(final CmsIcon icon, final IconSize size, final Position position) { validateSizeOfAddedIcon(size); final HippoIcon inlineIcon = HippoIcon.inline(icons.newChildId(), icon); addIcon(inlineIcon, position); return inlineIcon; }
public HippoIcon addFromResource(final ResourceReference reference, final Position position) { final HippoIcon resourceIcon = HippoIcon.fromResource(icons.newChildId(), reference); addIcon(resourceIcon, position); return resourceIcon; }
/** * Renders an icon stored in a resource. When the icon's file extension is '.svg', * the icon is rendered as an inline SVG image. * @param id the Wicket id of the icon * @param reference the resource to render * @return the icon component */ public static HippoIcon fromResource(final String id, final ResourceReference reference) { return fromResource(id, reference, -1, -1); }
/** * Renders a hippo icon via a reference to the icon sprite. * @param id the Wicket id of the icon * @param model the model containing the icon to render * @param size the size of the icon * @return the icon component */ public static HippoIcon fromSprite(final String id, final IModel<Icon> model, final IconSize size) { return new SpriteIcon(id, model, size); }
/** * 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); }
private ResourceIcon(final String id, final IModel<ResourceReference> model, final int width, final int height) { super(id, model); this.width = width; this.height = height; setRenderBodyOnly(true); }
/** * Renders an icon stored in a resource which is referenced by a Wicket model. * When the icon's file extension is '.svg', the icon is rendered as an inline SVG image. * @param id the Wicket id of the icon * @param model the model containing the resource to render * @return the icon component */ public static HippoIcon fromResourceModel(final String id, final IModel<ResourceReference> model) { return new ResourceIcon(id, model, -1, -1); }
/** * Renders and icon/image from a JcrResourceStream which is referenced by an {@link IModel}. Delegates rendering * to the {@link JcrImage} which simply outputs an {@code <img />} element. * @param id the Wicket id of the icon * @param model the model containing the icon stream * @param width the width of the icon in pixels * @param height the height of the icon in pixels * @return the icon component */ public static HippoIcon fromStream(final String id, final IModel<JcrResourceStream> model, final int width, final int height) { return new StreamIcon(id, model, width, height); }
@SuppressWarnings("unchecked") T getIcon() { return (T) getDefaultModelObject(); } }
private BaseIcon(final String id, final IModel<T> model) { super(id, model); setRenderBodyOnly(true); }
/** * Renders and icon/image from a JcrResourceStream which is referenced by an {@link IModel}. Delegates rendering * to the {@link JcrImage} which simply outputs an {@code <img />} element. * @param id the Wicket id of the icon * @param model the model containing the icon stream * @return the icon component */ public static HippoIcon fromStream(final String id, final IModel<JcrResourceStream> model) { return fromStream(id, model, -1, -1); }
@Override protected Component getIcon(final String id) { final HippoIconStack icon = new HippoIconStack(id, IconSize.M); icon.addFromSprite(Icon.GEAR); icon.addFromCms(CmsIcon.OVERLAY_PLUS, IconSize.M, HippoIconStack.Position.TOP_LEFT); return icon; }
/** * Renders a hippo icon via a reference to the icon sprite. * @param id the Wicket id of the icon * @param icon the icon to render * @param size the size of the icon * @return the icon component */ public static HippoIcon fromSprite(final String id, final Icon icon, final IconSize size) { return new SpriteIcon(id, icon, size); }
/** * 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); }