if (ctx != null) { Icon icon = IconSet.icons .getIconByClassSpec(StringUtils.join(new String[]{iconClassName, iconStyle}, " ")); if (icon != null) { metadata.put("iconQualifiedUrl", icon.getQualifiedUrl(ctx));
/** * Get an icon instance from a class specification. * @param iconClassSpec The icon's class spec as defined on the <l:icon class> attribute. * @return The icon instance, or {@code null} if no such icon. */ public Icon getIconByClassSpec(GString iconClassSpec) { if (iconClassSpec == null) { return null; } return getIconByClassSpec(iconClassSpec.toString()); }
/** * Navigate the signature changes in different versions of {@link IconSet}. * * @param spec the spec to look up. * @return the {@link Icon} or {@code null} */ @CheckForNull public static Icon getIconByClassSpec(String spec) { try { Method getIconByClassSpec = IconSet.class.getMethod("getIconByClassSpec", Object.class); return (Icon) getIconByClassSpec.invoke(IconSet.icons, spec); } catch (NoSuchMethodException e) { // ignore } catch (IllegalAccessException e) { // ignore } catch (InvocationTargetException e) { // ignore } return IconSet.icons.getIconByClassSpec(spec); }
/** * Navigate the signature changes in different versions of {@link IconSet}. * * @param spec the spec to look up. * @return the {@link Icon} or {@code null} */ @CheckForNull public static Icon getIconByClassSpec(String spec) { try { Method getIconByClassSpec = IconSet.class.getMethod("getIconByClassSpec", Object.class); return (Icon) getIconByClassSpec.invoke(IconSet.icons, spec); } catch (NoSuchMethodException e) { // ignore } catch (IllegalAccessException e) { // ignore } catch (InvocationTargetException e) { // ignore } return IconSet.icons.getIconByClassSpec(spec); }
protected String iconClassNameImageOf(String size) { String iconClassName = getIconClassName(); if (StringUtils.isNotBlank(iconClassName)) { String spec = null; if ("16x16".equals(size)) { spec = "icon-sm"; } else if ("24x24".equals(size)) { spec = "icon-md"; } else if ("32x32".equals(size)) { spec = "icon-lg"; } else if ("48x48".equals(size)) { spec = "icon-xlg"; } if (spec != null) { Icon icon = IconSet.icons.getIconByClassSpec(iconClassName + " " + spec); if (icon != null) { JellyContext ctx = new JellyContext(); ctx.setVariable("resURL", Stapler.getCurrentRequest().getContextPath() + Jenkins.RESOURCE_PATH); return icon.getQualifiedUrl(ctx); } } } return null; }
protected String iconClassNameImageOf(String size) { String iconClassName = getIconClassName(); if (StringUtils.isNotBlank(iconClassName)) { String spec = null; if ("16x16".equals(size)) { spec = "icon-sm"; } else if ("24x24".equals(size)) { spec = "icon-md"; } else if ("32x32".equals(size)) { spec = "icon-lg"; } else if ("48x48".equals(size)) { spec = "icon-xlg"; } if (spec != null) { Icon icon = IconSet.icons.getIconByClassSpec(iconClassName + " " + spec); if (icon != null) { JellyContext ctx = new JellyContext(); ctx.setVariable("resURL", Stapler.getCurrentRequest().getContextPath() + Jenkins.RESOURCE_PATH); return icon.getQualifiedUrl(ctx); } } } return null; }
} catch (NoSuchMethodException e) { icon = action instanceof IconSpec ? IconSet.icons.getIconByClassSpec(((IconSpec) action).getIconClassName()) : null; if (icon == null) { icon = IconSet.icons.getIconByClassSpec(IconSet.toNormalizedIconNameClass(action.getIconFileName()));
} catch (NoSuchMethodException e) { icon = action instanceof IconSpec ? IconSet.icons.getIconByClassSpec(((IconSpec) action).getIconClassName()) : null; if (icon == null) { icon = IconSet.icons.getIconByClassSpec(IconSet.toNormalizedIconNameClass(action.getIconFileName()));
@Override public String getIconFileName() { String iconClassName = getIconClassName(); if (iconClassName != null) { Icon icon = IconSet.icons.getIconByClassSpec(iconClassName + " icon-md"); if (icon != null) { JellyContext ctx = new JellyContext(); ctx.setVariable("resURL", Stapler.getCurrentRequest().getContextPath() + Jenkins.RESOURCE_PATH); return icon.getQualifiedUrl(ctx); } } return null; }
public static String iconFileName(String name, Size size) { Icon icon = icons.getIconByClassSpec(classSpec(name, size)); if (icon == null) { return null; } JellyContext ctx = new JellyContext(); ctx.setVariable("resURL", Stapler.getCurrentRequest().getContextPath() + Jenkins.RESOURCE_PATH); return icon.getQualifiedUrl(ctx); }
/** * {@inheritDoc} */ @Override public String getIconFileName() { String iconClassName = getIconClassName(); if (iconClassName != null) { Icon icon = IconSet.icons.getIconByClassSpec(iconClassName + " icon-md"); if (icon != null) { JellyContext ctx = new JellyContext(); ctx.setVariable("resURL", Stapler.getCurrentRequest().getContextPath() + Jenkins.RESOURCE_PATH); return icon.getQualifiedUrl(ctx); } } return null; }
if (ctx != null) { Icon icon = IconSet.icons .getIconByClassSpec(StringUtils.join(new String[]{iconClassName, iconStyle}, " ")); if (icon != null) { metadata.put("iconQualifiedUrl", icon.getQualifiedUrl(ctx));