/**
   * Returns the <tt>Component</tt> that displays the icons & names based on the
   * <tt>IconAndNameHolder</tt> object.
   */
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

    IconAndNameHolder in = (IconAndNameHolder) value;
    Icon icon = null;
    String name = null;
    if (in != null) {
      icon = in.getIcon();
      name = in.getName();

      if (name != null) {
        String strValue = name.toString();
        strValue = strValue.replace("<html>", "<html><div width=\"1000000px\">");
        strValue = strValue.replace("</html>", "</div></html>");
        name = strValue;
      }
    }
    setIcon(icon);
    Component comp =
        super.getTableCellRendererComponent(table, name, isSelected, hasFocus, row, column);

    ThemeMediator.fixLabelFont((JLabel) comp);

    return comp;
  }
    @Override
    public Component getListCellRendererComponent(
        JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
      LibraryPlaylistsListCell cell = (LibraryPlaylistsListCell) value;
      setText(cell.getText());
      setToolTipText(cell.getDescription());
      setPreferredSize(
          new Dimension(getSize().width, TableSettings.DEFAULT_TABLE_ROW_HEIGHT.getValue()));
      Icon icon = cell.getIcon();
      if (icon != null) {
        setIcon(icon);
      }

      this.setFont(list.getFont());
      ThemeMediator.fixLabelFont(this);

      return this;
    }
  // windows font policy http://msdn.microsoft.com/en-us/library/windows/desktop/aa511282.aspx
  // table of languages http://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx
  private static Font fixWindowsOSFont() {
    Font font = null;
    try {
      Toolkit toolkit = Toolkit.getDefaultToolkit();

      Method method =
          Toolkit.class.getDeclaredMethod("setDesktopProperty", String.class, Object.class);
      method.setAccessible(true);

      String fontName = ThemeMediator.getRecommendedFontName();

      if (fontName != null) {
        font = new Font(fontName, Font.PLAIN, 12);
        method.invoke(toolkit, "win.icon.font", font);
        // SubstanceLookAndFeel.setFontPolicy(SubstanceFontUtilities.getDefaultFontPolicy());
      }
    } catch (Throwable e) {
      LOG.error("Error fixing font", e);
    }

    return font;
  }
 public static ComponentUI createUI(JComponent comp) {
   ThemeMediator.testComponentCreationThreadingViolation();
   return new SkinApplicationHeaderUI();
 }
  private void setupList() {
    _listMouseObserver = new LibraryPlaylistsMouseObserver();
    _listSelectionListener = new LibraryPlaylistsSelectionListener();

    SortedListModel sortedModel =
        new SortedListModel(
            _model,
            SortOrder.ASCENDING,
            new Comparator<LibraryPlaylistsListCell>() {

              @Override
              public int compare(LibraryPlaylistsListCell o1, LibraryPlaylistsListCell o2) {
                if (o1 == _newPlaylistCell) {
                  return -1;
                }
                if (o2 == _newPlaylistCell) {
                  return 1;
                }

                return o1.getText().compareTo(o2.getText());
              }
            });

    _list = new LibraryIconList(sortedModel);
    _list.setFixedCellHeight(TableSettings.DEFAULT_TABLE_ROW_HEIGHT.getValue());
    _list.setCellRenderer(new LibraryPlaylistsCellRenderer());
    _list.addMouseListener(new DefaultMouseListener(_listMouseObserver));
    _list.addListSelectionListener(_listSelectionListener);
    _list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    _list.setLayoutOrientation(JList.VERTICAL);
    _list.setPrototypeCellValue(
        new LibraryPlaylistsListCell(
            "test", "", GUIMediator.getThemeImage("playlist"), null, null));
    _list.setVisibleRowCount(-1);
    _list.setDragEnabled(true);
    _list.setTransferHandler(new LibraryPlaylistsTransferHandler(_list));
    ToolTipManager.sharedInstance().registerComponent(_list);

    _list.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            list_keyPressed(e);
          }
        });

    _list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() > 1) {
              actionStartRename();
            }
          }
        });

    _textName = new JTextField();
    ThemeMediator.fixKeyStrokes(_textName);
    UIDefaults defaults = new UIDefaults();
    defaults.put("TextField.contentMargins", new InsetsUIResource(0, 4, 0, 4));
    _textName.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
    _textName.putClientProperty("Nimbus.Overrides", defaults);
    _textName.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            textName_keyPressed(e);
          }
        });
    _textName.setVisible(false);

    _list.add(_textName);
  }