/*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
   */
  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof ColumnLineData) {
      ColumnLineData lineData = (ColumnLineData) element;

      final EPropertyName property = lineData.getProperty();
      if (columnIndex == 0) {
        if (UIManager.isFirstForColumnModel(property)) { // first column name
          return EPropertyName.NAME.getName(); // $NON-NLS-1$
        } else if (property == EPropertyName.NAME) { // for data.
          return ""; //$NON-NLS-1$
        }
        return property.getName();
      }
      List<MultiMetadataColumn> columnsData = lineData.getKeyData().getMetadataColumnsInModel();
      if (columnsData.size() >= columnIndex) {
        MultiMetadataColumn columnData = columnsData.get(columnIndex - 1);
        if (columnData != null) {
          if (UIManager.isFirstForColumnModel(property)) {
            return columnData.getLabel();
          }
          switch (property) {
            case NAME:
              List<MultiSchemasMetadataColumn> dataColumns = columnData.getDataColumns();
              if (dataColumns.size() > 0) {
                // only use the first line
                MultiSchemasMetadataColumn c = dataColumns.get(0);
                return c.getData();
              }
              return columnData.getData();
            case TAGLEVEL:
              if (columnIndex == 1) { // only the first data column display the level.
                return validateValue(columnData.getContainerTagLevel());
              }
              break;
            case KEY:
              if (columnIndex == uiManager.getSelectedColumnIndex() + 1) { // record type column.
                return null;
              }
              return validateValue(columnData.isKey());
            case TYPE:
              return getTypeLabel(columnData.getTalendType());
              // case NULL:
              // return validateValue(columnData.isNullable());
            case LENGTH:
              return validateValue(columnData.getLength());
              // case PRECISION:
              // return validateValue(columnData.getPrecision());
              // case CARD:
              // return columnData.getCard();
            case PATTERN:
              return columnData.getPattern();
            default:
          }
        }
      }
    }
    return null;
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
   */
  public Image getColumnImage(Object element, int columnIndex) {
    if (element instanceof ColumnLineData) {
      ColumnLineData lineData = (ColumnLineData) element;

      final EPropertyName property = lineData.getProperty();

      List<MultiMetadataColumn> columnsData = lineData.getKeyData().getMetadataColumnsInModel();
      if (columnsData.size() >= columnIndex && columnIndex > 1) {
        MultiMetadataColumn columnData = columnsData.get(columnIndex - 1);
        if (columnData != null && property == EPropertyName.KEY) {
          if (columnData.isKey()) {
            // return ImageProvider.getImage(EImage.CHECKED_ICON);
          } else {
            // return ImageProvider.getImage(EImage.UNCHECKED_ICON);
          }
        }
      }
    }
    return null;
  }