/** * 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); }
protected Component getIcon(final String id) { if (iconReference != null) { return HippoIcon.fromResource(id, iconReference); } return null; }
@Override protected Component newNodeIcon(final MarkupContainer parent, final String id, final TreeNode node) { ResourceReference nodeIcon = super.getNodeIcon(node); return HippoIcon.fromResource(id, nodeIcon); }
public HippoIcon addFromResource(final ResourceReference reference, final Position position) { final HippoIcon resourceIcon = HippoIcon.fromResource(icons.newChildId(), reference); addIcon(resourceIcon, position); return resourceIcon; }
public Component getIcon(String id, IconSize size) { if (decorator == null) { return null; } Component icon = decorator.getIcon(id, size); if (icon != null) { return icon; } ResourceReference reference = decorator.getIcon(size); return reference != null ? HippoIcon.fromResource(id, reference, size) : null; }
public HippoIcon replaceFromResource(final HippoIcon oldIcon, final ResourceReference newReference, final Position position) { HippoIcon newCopy = HippoIcon.fromResource(oldIcon.getId(), newReference); addIcon(newCopy, position); return newCopy; }
/** * Renders an icon stored in a resource, including 'width' and 'height' attributes. * 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 * @param size the size to use as width and height value, in pixels * @return the icon component */ public static HippoIcon fromResource(final String id, final ResourceReference reference, final IconSize size) { return fromResource(id, reference, size.getSize(), size.getSize()); }
private Component getDocumentIcon(final Node node, final String id, final IconSize size) throws RepositoryException { if (localeProvider != null) { if (node.isNodeType(HippoTranslationNodeType.NT_TRANSLATED)) { String localeName = node.getProperty(HippoTranslationNodeType.LOCALE).getString(); for (HippoLocale locale : localeProvider.getLocales()) { if (localeName.equals(locale.getName())) { ResourceReference reference = locale.getIcon(size, LocaleState.EXISTS); return HippoIcon.fromResource(id, reference); } } log.info("Locale '{}' was not found in locale provider", localeName); } } return HippoIcon.fromSprite(id, Icon.FILE_TEXT); }
public static HippoIcon getIconForNodeType(final String id, final NodeType type, final Icon defaultIcon, final IconSize size) { final String nodeTypeIconName = StringUtils.replace(type.getName(), ":", "-"); final ResourceReference reference = BrowserStyle.getIconOrNull(nodeTypeIconName, size); if (reference != null) { final HippoIcon icon = HippoIcon.fromResource(id, reference, size); icon.addCssClass("hi"); icon.addCssClass("hi-custom-node-type"); icon.addCssClass("hi-" + size.name().toLowerCase()); return icon; } return HippoIcon.fromSprite(id, defaultIcon, size); }