/** * Sets the icon image URL of this workspace. Supported URL protocols include * : * <ul> * <li>all JVM supported protocols</li> * <li>the <b>jar:/</b> pseudo URL protocol</li> * <li>the <b>classpath:/</b> pseudo URL protocol</li> * </ul> * * @param iconImageURL * the iconImageURL to set. */ public void setIconImageURL(String iconImageURL) { if (icon == null) { icon = new Icon(); } icon.setIconImageURL(iconImageURL); }
private Icon computeIcon(Class<?> modelClass) { Icon icon = null; for (IComponentDescriptor<?> componentDescriptor : componentDescriptors) { if (modelClass.equals(componentDescriptor.getComponentContract()) && componentDescriptor.getIcon() != null) { icon = componentDescriptor.getIcon(); } } if (icon == null) { Class<?>[] superInterfaces = modelClass.getInterfaces(); for (int i = superInterfaces.length - 1; i >= 0 && icon == null; i--) { icon = computeIcon(superInterfaces[i]); } if (icon == null && modelClass.getSuperclass() != null) { icon = computeIcon(modelClass.getSuperclass()); } } if (icon != null && icon.getDimension() == null) { icon.setDimension(defaultDimension); } return icon; } }
/** * Gets the icon image URL or null if no icon is set. * * @return the icon image URL or null if no icon is set. */ protected String getIconImageURL() { Icon icon = getIcon(); if (icon != null) { return icon.getIconImageURL(); } return null; }
/** * {@inheritDoc} * * @return the icon */ @Override public Icon getIcon() { Icon icon = super.getIcon(); if (icon == null) { if (entityDescriptor != null) { icon = entityDescriptor.getIcon(); } if (icon == null) { icon = new Icon(getDefaultIconImageURL(), null); } } return icon; }
/** * {@inheritDoc} */ @Override public Icon getIconForObject(Object userObject) { Icon icon = null; if (delegateProvider != null && userObject instanceof BeanModule && ((BeanModule) userObject).getModuleObject() != null && ((BeanModule) userObject).getIcon() == null) { icon = delegateProvider.getIconForObject(((BeanModule) userObject).getModuleObject()); } if (userObject instanceof Module) { icon = ((Module) userObject).getIcon(); } if (userObject instanceof Workspace) { icon = ((Workspace) userObject).getIcon(); } if (icon != null && icon.getDimension() == null) { icon.setDimension(defaultDimension); } return icon; }
/** * Registers the list of component descriptors to build the enumeration * values/icons from their names and icons. * * @param componentDescriptorList * the componentDescriptorList to set. */ public void setComponentDescriptors( List<IComponentDescriptor<?>> componentDescriptorList) { Map<String, String> componentDescriptorImages = new LinkedHashMap<>(); for (IComponentDescriptor<?> componentDescriptor : componentDescriptorList) { String componentIconImageUrl = null; if (componentDescriptor.getIcon() != null) { componentIconImageUrl = componentDescriptor.getIcon().getIconImageURL(); } componentDescriptorImages.put(componentDescriptor.getName(), componentIconImageUrl); } setValuesAndIconImageUrls(componentDescriptorImages); } }
/** * Sets the icon image URL of this descriptor. Supported URL protocols include * : * <ul> * <li>all JVM supported protocols</li> * <li>the <b>jar:/</b> pseudo URL protocol</li> * <li>the <b>classpath:/</b> pseudo URL protocol</li> * </ul> * * @param iconImageURL * the iconImageURL to set. */ public void setIconImageURL(String iconImageURL) { if (icon == null) { icon = new Icon(); } icon.setIconImageURL(iconImageURL); }