Beispiel #1
0
  @Override
  public Image getIcon(final int iconType) {
    Image icon = img.get(iconType);
    if (icon != null) return icon;

    // try to get a special icon
    icon = BeanSupport.getBeanIcon(component.getBeanClass(), iconType);
    if (icon == null) {
      final String className = component.getBeanClass().getName();
      final String classDetails =
          (String) component.getAuxValue(RADComponent.AUX_VALUE_CLASS_DETAILS);
      if (!iconsInitialized) {
        // getIconForClass invokes getNodes(true) which cannot be called in Mutex
        EventQueue.invokeLater(
            new Runnable() {
              @Override
              public void run() {
                Image icon = PaletteUtils.getIconForClass(className, classDetails, iconType, true);
                iconsInitialized = true;
                if (icon != null) {
                  img.put(iconType, icon);
                  fireIconChange();
                }
              }
            });
      } else {
        icon = PaletteUtils.getIconForClass(className, classDetails, iconType, false);
      }

      if (icon == null) {
        // get icon from BeanInfo
        java.beans.BeanInfo bi = component.getBeanInfo();
        if (bi != null) {
          icon = bi.getIcon(iconType);
        }

        if (icon == null) {
          // use default icon
          icon = super.getIcon(iconType);
        }
      }
    }
    img.put(iconType, icon);
    return icon;
  }