@Override
  public int compare(Viewer viewer, Object e1, Object e2) {
    int rc = 0;

    if (e1 instanceof MongoDBCollectionInfoDTO) {
      MongoDBCollectionInfoDTO m1 = (MongoDBCollectionInfoDTO) e1;
      MongoDBCollectionInfoDTO m2 = (MongoDBCollectionInfoDTO) e2;

      Double dbl1, dbl2;

      switch (propertyIndex) {
        case 0:
          rc = m1.getName().compareTo(m2.getName());
          break;
        case 1:
          dbl1 = Double.valueOf("" + m1.getCount());
          dbl2 = Double.valueOf("" + m2.getCount());

          rc = dbl1.compareTo(dbl2);
          break;

        case 2:
          dbl1 = Double.valueOf("" + m1.getSize());
          dbl2 = Double.valueOf("" + m2.getSize());

          rc = dbl1.compareTo(dbl2);
          break;
        case 3:
          dbl1 = Double.valueOf("" + m1.getStorage());
          dbl2 = Double.valueOf("" + m2.getStorage());

          rc = dbl1.compareTo(dbl2);
          break;
        case 4:
          dbl1 = Double.valueOf("" + m1.getIndex());
          dbl2 = Double.valueOf("" + m2.getIndex());

          rc = dbl1.compareTo(dbl2);
          break;
        case 5:
          dbl1 = Double.valueOf("" + m1.getAvgObj());
          dbl2 = Double.valueOf("" + m2.getAvgObj());

          rc = dbl1.compareTo(dbl2);
          break;
        case 6:
          dbl1 = Double.valueOf("" + m1.getPadding());
          dbl2 = Double.valueOf("" + m2.getPadding());

          rc = dbl1.compareTo(dbl2);
          break;
        default:
          break;
      }

      if (direction == DESCENDING) rc = -rc;
    }

    return rc;
  }
  @Override
  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof MongoDBCollectionInfoDTO) {
      MongoDBCollectionInfoDTO info = (MongoDBCollectionInfoDTO) element;

      switch (columnIndex) {
        case 0:
          return info.getName();
        case 1:
          return NumberFormatUtils.commaFormat(info.getCount());
        case 2:
          return NumberFormatUtils.kbMbFormat(info.getSize());
        case 3:
          return NumberFormatUtils.kbMbFormat(info.getStorage());
        case 4:
          return NumberFormatUtils.kbMbFormat(info.getIndex());
        case 5:
          return NumberFormatUtils.commaFormat(info.getAvgObj());
        case 6:
          return NumberFormatUtils.commaFormat(info.getPadding());
      }
      return "*** not set column ***"; //$NON-NLS-1$
    } else {
      TableColumnDAO dao = (TableColumnDAO) element;

      switch (columnIndex) {
        case 0:
          return dao.getField();
        case 1:
          return dao.getType();
        case 2:
          return dao.getKey();
        case 3:
          return ""; //$NON-NLS-1$
        case 4:
          return ""; //$NON-NLS-1$
        case 5:
          return ""; //$NON-NLS-1$
        case 6:
          return ""; //$NON-NLS-1$
      }
      return "*** not set column ***"; //$NON-NLS-1$
    }
  }