Package net.sf.mzmine.util.components

Examples of net.sf.mzmine.util.components.ColumnGroup


  }

  public void createColumns() {

    // clear column groups
    ColumnGroup groups[] = header.getColumnGroups();
    if (groups != null) {
      for (ColumnGroup group : groups) {
        header.removeColumnGroup(group);
      }
    }

    // clear the column model
    while (getColumnCount() > 0) {
      TableColumn col = getColumn(0);
      removeColumn(col);
    }

    // create the "average" group
    ColumnGroup averageGroup = new ColumnGroup("Average");
    header.addColumnGroup(averageGroup);

    JTextField editorField = new JTextField();
    editorField.setFont(editFont);
    DefaultCellEditor defaultEditor = new DefaultCellEditor(editorField);

    ColumnSettingParameter<CommonColumnType> csPar = parameters
        .getParameter(PeakListTableParameters.commonColumns);
    CommonColumnType visibleCommonColumns[] = csPar.getValue();

    ColumnSettingParameter<DataFileColumnType> dfPar = parameters
        .getParameter(PeakListTableParameters.dataFileColumns);
    DataFileColumnType visibleDataFileColumns[] = dfPar.getValue();

    for (int i = 0; i < visibleCommonColumns.length; i++) {

      CommonColumnType commonColumn = visibleCommonColumns[i];
      int modelIndex = Arrays.asList(CommonColumnType.values()).indexOf(
          commonColumn);

      TableColumn newColumn = new TableColumn(modelIndex);
      newColumn.setHeaderValue(commonColumn.getColumnName());
      newColumn.setIdentifier(commonColumn);

      switch (commonColumn) {
        case AVERAGEMZ :
          newColumn.setCellRenderer(mzRenderer);
          break;
        case AVERAGERT :
          newColumn.setCellRenderer(rtRenderer);
          break;
        case IDENTITY :
          newColumn.setCellRenderer(identityRenderer);
          break;
        case COMMENT :
          newColumn.setCellRenderer(defaultRenderer);
          newColumn.setCellEditor(defaultEditor);
          break;
        case PEAKSHAPE :
          newColumn.setCellRenderer(peakShapeRenderer);
          break;
        default :
          newColumn.setCellRenderer(defaultRenderer);
      }

      this.addColumn(newColumn);
      newColumn.setPreferredWidth(csPar.getColumnWidth(modelIndex));
      if ((commonColumn == CommonColumnType.AVERAGEMZ)
          || (commonColumn == CommonColumnType.AVERAGERT)) {
        averageGroup.add(newColumn);
      }

    }

    for (int i = 0; i < peakList.getNumberOfRawDataFiles(); i++) {

      RawDataFile dataFile = peakList.getRawDataFile(i);
      ColumnGroup fileGroup = new ColumnGroup(dataFile.getName());
      header.addColumnGroup(fileGroup);

      for (int j = 0; j < visibleDataFileColumns.length; j++) {

        DataFileColumnType dataFileColumn = visibleDataFileColumns[j];
        int dataFileColumnIndex = Arrays.asList(
            DataFileColumnType.values()).indexOf(dataFileColumn);
        int modelIndex = CommonColumnType.values().length
            + (i * DataFileColumnType.values().length)
            + dataFileColumnIndex;

        TableColumn newColumn = new TableColumn(modelIndex);
        newColumn.setHeaderValue(dataFileColumn.getColumnName());
        newColumn.setIdentifier(dataFileColumn);

        switch (dataFileColumn) {
          case MZ :
            newColumn.setCellRenderer(mzRenderer);
            break;
          case PEAKSHAPE :
            newColumn.setCellRenderer(peakShapeRenderer);
            break;
          case STATUS :
            newColumn.setCellRenderer(peakStatusRenderer);
            break;
          case RT :
            newColumn.setCellRenderer(rtRenderer);
            break;
          case DURATION :
            newColumn.setCellRenderer(rtRenderer);
            break;
          case HEIGHT :
            newColumn.setCellRenderer(intensityRenderer);
            break;
          case AREA :
            newColumn.setCellRenderer(intensityRenderer);
            break;
          default :
            newColumn.setCellRenderer(defaultRenderer);
            break;
        }

        this.addColumn(newColumn);
        newColumn.setPreferredWidth(dfPar
            .getColumnWidth(dataFileColumnIndex));
        fileGroup.add(newColumn);
      }

    }

  }
View Full Code Here


    Arrays.fill(columnWidths, 100);
  }

  public void createColumns() {
    // clear column groups
    ColumnGroup groups[] = header.getColumnGroups();
    if (groups != null) {
      for (ColumnGroup group : groups)
        header.removeColumnGroup(group);
    }

    // clear the column model
    while (getColumnCount() > 0)
      removeColumn(getColumn(0));

    // create the "average" group
    ColumnGroup averageGroup = new ColumnGroup("Average");
    header.addColumnGroup(averageGroup);

    JTextField editorField = new JTextField();
    editorField.setFont(editFont);
    DefaultCellEditor defaultEditor = new DefaultCellEditor(editorField);

    for (int i = 0; i < CommonColumnType.values().length; i++) {
      CommonColumnType commonColumn = CommonColumnType.values()[i];

      TableColumn newColumn = new TableColumn(i);
      newColumn.setHeaderValue(commonColumn.getColumnName());
      newColumn.setIdentifier(commonColumn);

      switch (commonColumn) {
        case MZ :
          newColumn.setCellRenderer(mzRenderer);
          break;
        case AVERAGERT :
          newColumn.setCellRenderer(rtRenderer);
          break;
        case IDENTITY :
          newColumn.setCellRenderer(identityRenderer);
          break;
        case COMMENT :
          newColumn.setCellRenderer(defaultRenderer);
          newColumn.setCellEditor(defaultEditor);
          break;
        default :
          newColumn.setCellRenderer(defaultRenderer);
          break;
      }

      this.addColumn(newColumn);
      newColumn.setPreferredWidth(columnWidths[i]);
      if ((commonColumn == CommonColumnType.MZ)
          || (commonColumn == CommonColumnType.AVERAGERT))
        averageGroup.add(newColumn);

    }

    for (int i = 0; i < peakList.getNumberOfRawDataFiles(); i++) {
      RawDataFile dataFile = peakList.getRawDataFile(i);
      ColumnGroup fileGroup = new ColumnGroup(dataFile.getName());
      header.addColumnGroup(fileGroup);

      for (int j = 0; j < DataFileColumnType.values().length; j++) {

        DataFileColumnType dataFileColumn = DataFileColumnType.values()[j];
        int modelIndex = CommonColumnType.values().length
            + (i * DataFileColumnType.values().length) + j;

        TableColumn newColumn = new TableColumn(modelIndex);
        newColumn.setHeaderValue(dataFileColumn.getColumnName());
        newColumn.setIdentifier(dataFileColumn);

        switch (dataFileColumn) {
          case RT :
            newColumn.setCellRenderer(rtRenderer);
            break;
          default :
            newColumn.setCellRenderer(defaultRenderer);
            break;
        }

        this.addColumn(newColumn);
        newColumn.setPreferredWidth(columnWidths[modelIndex]);
        fileGroup.add(newColumn);
      }

    }

  }
View Full Code Here

    columnWidths[1] = 80;
  }

  public void createColumns() {
    // clear column groups
    ColumnGroup groups[] = header.getColumnGroups();
    if (groups != null) {
      for (ColumnGroup group : groups)
        header.removeColumnGroup(group);
    }

    // clear the column model
    while (getColumnCount() > 0)
      removeColumn(getColumn(0));

    // create the "average" group
    ColumnGroup averageGroup = new ColumnGroup("Average");
    header.addColumnGroup(averageGroup);

    JTextField editorField = new JTextField();
    editorField.setFont(editFont);

    for (int i = 0; i < CommonColumnType.values().length; i++) {
      CommonColumnType commonColumn = CommonColumnType.values()[i];

      TableColumn newColumn = new TableColumn(i);
      newColumn.setHeaderValue(commonColumn.getColumnName());
      newColumn.setIdentifier(commonColumn);

      switch (commonColumn) {
        case COMMENT :
          newColumn.setCellRenderer(defaultRenderer);
          break;
        case RI :
          newColumn.setCellRenderer(defaultRenderer);
          break;
        default :
          newColumn.setCellRenderer(defaultRenderer);
          break;
      }

      this.addColumn(newColumn);
      newColumn.setPreferredWidth(columnWidths[i]);
    }

    for (int i = 0; i < peakList.getNumberOfRawDataFiles(); i++) {
      RawDataFile dataFile = peakList.getRawDataFile(i);
      ColumnGroup fileGroup = new ColumnGroup(dataFile.getName());
      header.addColumnGroup(fileGroup);

      for (int j = 0; j < DataFileColumnType.values().length; j++) {

        DataFileColumnType dataFileColumn = DataFileColumnType.values()[j];
        int modelIndex = CommonColumnType.values().length
            + (i * DataFileColumnType.values().length) + j;

        TableColumn newColumn = new TableColumn(modelIndex);
        newColumn.setHeaderValue(dataFileColumn.getColumnName());
        newColumn.setIdentifier(dataFileColumn);

        switch (dataFileColumn) {
          case RT :
            newColumn.setCellRenderer(rtRenderer);
            break;
          default :
            newColumn.setCellRenderer(defaultRenderer);
            break;
        }

        this.addColumn(newColumn);
        newColumn.setPreferredWidth(columnWidths[modelIndex]);
        fileGroup.add(newColumn);
      }

    }

  }
View Full Code Here

TOP

Related Classes of net.sf.mzmine.util.components.ColumnGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.