/**
   * Returns the preferred size of this component.
   *
   * @return the preferred size of this component
   */
  public Dimension getPreferredSize() {
    Dimension preferredSize = new Dimension();
    int preferredHeight;

    if (treeNode instanceof ContactNode) {
      UIContact contact = ((ContactNode) treeNode).getContactDescriptor();

      preferredHeight = contact.getPreferredHeight();

      if (preferredHeight > 0) preferredSize.height = preferredHeight;
      else if (contact instanceof ShowMoreContact) preferredSize.height = 20;
      else if (isSelected && treeContactList.isContactButtonsVisible()) preferredSize.height = 70;
      else preferredSize.height = 35;
    } else if (treeNode instanceof GroupNode) {
      UIGroup group = ((GroupNode) treeNode).getGroupDescriptor();

      preferredHeight = group.getPreferredHeight();

      if (isSelected && customActionButtonsUIGroup != null && !customActionButtonsUIGroup.isEmpty())
        preferredSize.height = 70;
      else if (preferredHeight > 0) preferredSize.height = preferredHeight;
      else preferredSize.height = 20;
    }

    return preferredSize;
  }