Changeset 4435


Ignore:
Timestamp:
Mar 8, 2013, 9:43:39 AM (10 years ago)
Author:
olle
Message:

Refs #799. Class/files action/peakList/PeakAnnotationUtil.java, action/peakList/PlotFileSpectrum.java, and action/peakList/PlotSpectrum.java, all in client/servlet/, updated to make the spectrum low and high end masses and pixel offsets available to other classes, and reverse the cutoff mass values internally if the low cutoff mass > the high cutoff mass.

Location:
trunk/client/servlet/src/org/proteios/action/peakList
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/peakList/PeakAnnotationUtil.java

    r3442 r4435  
    5656  private static final org.apache.log4j.Logger log = org.apache.log4j.LogManager
    5757    .getLogger("org.proteios.io");
     58
     59
     60  private int spectrumOffsetLeft = -2;
     61  private int spectrumOffsetRight = -2;
     62    private Double spectrumLimitMassMin = null;
     63    private Double spectrumLimitMassMax = null;
     64
     65
     66  public int getSpectrumOffsetLeft()
     67  {
     68    return this.spectrumOffsetLeft;
     69  }
     70
     71
     72  private void setSpectrumOffsetLeft(int xSpectrumOffsetLeft)
     73  {
     74    this.spectrumOffsetLeft = xSpectrumOffsetLeft;
     75  }
     76
     77
     78  public int getSpectrumOffsetRight()
     79  {
     80    return this.spectrumOffsetRight;
     81  }
     82
     83
     84  private void setSpectrumOffsetRight(int spectrumOffsetRight)
     85  {
     86    this.spectrumOffsetRight = spectrumOffsetRight;
     87  }
     88
     89
     90    public Double getSpectrumLimitMassMin()
     91    {
     92      return this.spectrumLimitMassMin;
     93    }
     94
     95
     96    private void setSpectrumLimitMassMin(Double spectrumLimitMassMin)
     97    {
     98      this.spectrumLimitMassMin = spectrumLimitMassMin;
     99    }
     100
     101
     102    public Double getSpectrumLimitMassMax()
     103    {
     104      return this.spectrumLimitMassMax;
     105    }
     106
     107
     108    private void setSpectrumLimitMassMax(Double spectrumLimitMassMax)
     109    {
     110      this.spectrumLimitMassMax = spectrumLimitMassMax;
     111    }
    58112
    59113
     
    514568    log.debug("imageWidth = " + imageWidth + " imageHeight = " + imageHeight);
    515569    log.debug("spectrumAreaWidth = " + spectrumAreaWidth + " spectrumAreaHeight = " + spectrumAreaHeight);
     570    // Set spectrum offset left and right pixel values
     571    setSpectrumOffsetLeft(xSpectrumOffsetLeft);
     572    setSpectrumOffsetRight(xSpectrumOffsetRight);
     573        // Set spectrum limit mass min and max values
     574        setSpectrumLimitMassMin(massMin);
     575        setSpectrumLimitMassMax(massMax);
    516576    //
    517577    // Create mass value annotation tool-tips for all peaks
  • trunk/client/servlet/src/org/proteios/action/peakList/PlotFileSpectrum.java

    r4003 r4435  
    3535import org.jfree.chart.ChartFactory;
    3636import org.jfree.chart.JFreeChart;
     37import org.jfree.chart.plot.Plot;
    3738import org.jfree.chart.plot.PlotOrientation;
    3839import org.jfree.data.xy.CategoryTableXYDataset;
     
    6162extends ProteiosAction<PlotFileSpectrum>
    6263{
    63     public static final Integer WIDTH = 400;
    64     public static final Integer HEIGHT = 300;
    65     public static final VString VSPECTRUMID = MassRangeForm.VSPECTRUMID;   
    66     public static final VString VMASSCUTOFFLOWSTR = MassRangeForm.VMASSCUTOFFLOWSTR;
    67     public static final VString VMASSCUTOFFHIGHSTR = MassRangeForm.VMASSCUTOFFHIGHSTR;
    68    
    69     @Override
     64  public static final Integer WIDTH = 400;
     65  public static final Integer HEIGHT = 300;
     66  public static final VString VSPECTRUMID = MassRangeForm.VSPECTRUMID;   
     67  public static final VString VMASSCUTOFFLOWSTR = MassRangeForm.VMASSCUTOFFLOWSTR;
     68  public static final VString VMASSCUTOFFHIGHSTR = MassRangeForm.VMASSCUTOFFHIGHSTR;
     69  private int spectrumOffsetLeft = -1;
     70  private int spectrumOffsetRight = -1;
     71  private Double spectrumLimitMassMin = null;
     72  private Double spectrumLimitMassMax = null;
     73
     74
     75  public int getSpectrumOffsetLeft()
     76  {
     77    return this.spectrumOffsetLeft;
     78  }
     79
     80
     81  private void setSpectrumOffsetLeft(int xSpectrumOffsetLeft)
     82  {
     83    this.spectrumOffsetLeft = xSpectrumOffsetLeft;
     84  }
     85
     86
     87  public int getSpectrumOffsetRight()
     88  {
     89    return this.spectrumOffsetRight;
     90  }
     91
     92
     93  private void setSpectrumOffsetRight(int spectrumOffsetRight)
     94  {
     95    this.spectrumOffsetRight = spectrumOffsetRight;
     96  }
     97
     98
     99  public Double getSpectrumLimitMassMin()
     100  {
     101    return this.spectrumLimitMassMin;
     102  }
     103
     104
     105  private void setSpectrumLimitMassMin(Double spectrumLimitMassMin)
     106  {
     107    this.spectrumLimitMassMin = spectrumLimitMassMin;
     108  }
     109
     110
     111  public Double getSpectrumLimitMassMax()
     112  {
     113    return this.spectrumLimitMassMax;
     114  }
     115
     116
     117  private void setSpectrumLimitMassMax(Double spectrumLimitMassMax)
     118  {
     119    this.spectrumLimitMassMax = spectrumLimitMassMax;
     120  }
     121
     122
     123   @Override
    70124    protected void runMe()
    71125    throws ActionException, InvalidParameterValue
     
    136190                log.debug("Exception when parsing string \"" + massCutoffHighStr + "\" to Float: " + e);
    137191            }
     192        }
     193        // Switch mass cutoff low and high values if low > high
     194        if (massCutoffLow != null && massCutoffHigh != null && massCutoffLow > massCutoffHigh)
     195        {
     196          // Switch values
     197          Float massCutoffLowTmp = massCutoffLow;
     198          massCutoffLow = massCutoffHigh;
     199          massCutoffHigh = massCutoffLowTmp;
    138200        }
    139201        log.debug("fileId = " + peakListFileId);
     
    325387            }
    326388        }
     389        // Switch mass cutoff low and high values if low > high
     390        if (massCutoffLow != null && massCutoffHigh != null && massCutoffLow > massCutoffHigh)
     391        {
     392          // Switch values
     393          Float massCutoffLowTmp = massCutoffLow;
     394          massCutoffLow = massCutoffHigh;
     395          massCutoffHigh = massCutoffLowTmp;
     396        }
    327397        log.debug("spectrumFileId = " + spectrumFileId);
    328398        log.debug("spectrumId = \"" + spectrumId + "\"");
     
    335405        PeakAnnotationUtil peakAnnotationUtil = new PeakAnnotationUtil();
    336406        ImageMap imageMap = peakAnnotationUtil.fetchMassPeakAnnotationToolTips(spectrum, WIDTH, HEIGHT);
     407    // Set spectrum offset left and right pixel values
     408    setSpectrumOffsetLeft(peakAnnotationUtil.getSpectrumOffsetLeft());
     409    setSpectrumOffsetRight(peakAnnotationUtil.getSpectrumOffsetRight());
     410        // Set spectrum limit mass min and max values
     411        setSpectrumLimitMassMin(peakAnnotationUtil.getSpectrumLimitMassMin());
     412        setSpectrumLimitMassMax(peakAnnotationUtil.getSpectrumLimitMassMax());
    337413        return imageMap;
    338414    }
     
    361437        PeakAnnotationUtil peakAnnotationUtil = new PeakAnnotationUtil();
    362438        ImageMap imageMap = peakAnnotationUtil.fetchMassPeakAnnotationToolTips(spectrum, WIDTH, HEIGHT);
     439    // Set spectrum offset left and right pixel values
     440    setSpectrumOffsetLeft(peakAnnotationUtil.getSpectrumOffsetLeft());
     441    setSpectrumOffsetRight(peakAnnotationUtil.getSpectrumOffsetRight());
     442        // Set spectrum limit mass min and max values
     443        setSpectrumLimitMassMin(peakAnnotationUtil.getSpectrumLimitMassMin());
     444        setSpectrumLimitMassMax(peakAnnotationUtil.getSpectrumLimitMassMax());
    363445        return imageMap;
    364446    }
     
    385467        PeakAnnotationUtil peakAnnotationUtil = new PeakAnnotationUtil();
    386468        ImageMap imageMap = peakAnnotationUtil.fetchMassPeakAnnotationToolTips(spectrum, imageWidth, imageHeight);
     469    // Set spectrum offset left and right pixel values
     470    setSpectrumOffsetLeft(peakAnnotationUtil.getSpectrumOffsetLeft());
     471    setSpectrumOffsetRight(peakAnnotationUtil.getSpectrumOffsetRight());
     472        // Set spectrum limit mass min and max values
     473        setSpectrumLimitMassMin(peakAnnotationUtil.getSpectrumLimitMassMin());
     474        setSpectrumLimitMassMax(peakAnnotationUtil.getSpectrumLimitMassMax());
    387475        return imageMap;
    388476    }
  • trunk/client/servlet/src/org/proteios/action/peakList/PlotSpectrum.java

    r3446 r4435  
    3131import org.jfree.chart.ChartFactory;
    3232import org.jfree.chart.JFreeChart;
     33import org.jfree.chart.plot.Plot;
    3334import org.jfree.chart.plot.PlotOrientation;
    3435import org.jfree.data.xy.CategoryTableXYDataset;
     
    6465  public static final VString VMASSCUTOFFLOWSTR = new VString("massCutoffLowStr", 0, 255, false);
    6566  public static final VString VMASSCUTOFFHIGHSTR = new VString("massCutoffHighStr", 0, 255, false);
     67  private int spectrumOffsetLeft = -1;
     68  private int spectrumOffsetRight = -1;
     69  private Double spectrumLimitMassMin = null;
     70  private Double spectrumLimitMassMax = null;
     71
     72
     73  public int getSpectrumOffsetLeft()
     74  {
     75    return this.spectrumOffsetLeft;
     76  }
     77
     78
     79  private void setSpectrumOffsetLeft(int xSpectrumOffsetLeft)
     80  {
     81    this.spectrumOffsetLeft = xSpectrumOffsetLeft;
     82  }
     83
     84
     85  public int getSpectrumOffsetRight()
     86  {
     87    return this.spectrumOffsetRight;
     88  }
     89
     90
     91  private void setSpectrumOffsetRight(int spectrumOffsetRight)
     92  {
     93    this.spectrumOffsetRight = spectrumOffsetRight;
     94  }
     95
     96
     97  public Double getSpectrumLimitMassMin()
     98  {
     99    return this.spectrumLimitMassMin;
     100  }
     101
     102
     103  private void setSpectrumLimitMassMin(Double spectrumLimitMassMin)
     104  {
     105    this.spectrumLimitMassMin = spectrumLimitMassMin;
     106  }
     107
     108
     109  public Double getSpectrumLimitMassMax()
     110  {
     111    return this.spectrumLimitMassMax;
     112  }
     113
     114
     115  private void setSpectrumLimitMassMax(Double spectrumLimitMassMax)
     116  {
     117    this.spectrumLimitMassMax = spectrumLimitMassMax;
     118  }
    66119
    67120
     
    121174        log.debug("Exception when parsing string \"" + massCutoffHighStr + "\" to Float: " + e);
    122175      }
     176    }
     177    // Switch mass cutoff low and high values if low > high
     178    if (massCutoffLow != null && massCutoffHigh != null && massCutoffLow > massCutoffHigh)
     179    {
     180      // Switch values
     181      Float massCutoffLowTmp = massCutoffLow;
     182      massCutoffLow = massCutoffHigh;
     183      massCutoffHigh = massCutoffLowTmp;
    123184    }
    124185    log.debug("peakListId = " + peakListId);
     
    288349      }
    289350    }
     351    // Switch mass cutoff low and high values if low > high
     352    if (massCutoffLow != null && massCutoffHigh != null && massCutoffLow > massCutoffHigh)
     353    {
     354      // Switch values
     355      Float massCutoffLowTmp = massCutoffLow;
     356      massCutoffLow = massCutoffHigh;
     357      massCutoffHigh = massCutoffLowTmp;
     358    }
    290359    log.debug("peakListId = " + peakListId);
    291360    log.debug("massCutoffLowStr = \"" + massCutoffLowStr + "\"");
     
    297366    PeakAnnotationUtil peakAnnotationUtil = new PeakAnnotationUtil();
    298367    ImageMap imageMap = peakAnnotationUtil.fetchMassPeakAnnotationToolTips(spectrum, WIDTH, HEIGHT);
     368    // Set spectrum offset left and right pixel values
     369    setSpectrumOffsetLeft(peakAnnotationUtil.getSpectrumOffsetLeft());
     370    setSpectrumOffsetRight(peakAnnotationUtil.getSpectrumOffsetRight());
     371    // Set spectrum limit mass min and max values
     372    setSpectrumLimitMassMin(peakAnnotationUtil.getSpectrumLimitMassMin());
     373    setSpectrumLimitMassMax(peakAnnotationUtil.getSpectrumLimitMassMax());
    299374    return imageMap;
    300375  }
     
    322397    PeakAnnotationUtil peakAnnotationUtil = new PeakAnnotationUtil();
    323398    ImageMap imageMap = peakAnnotationUtil.fetchMassPeakAnnotationToolTips(spectrum, WIDTH, HEIGHT);
     399    // Set spectrum offset left and right pixel values
     400    setSpectrumOffsetLeft(peakAnnotationUtil.getSpectrumOffsetLeft());
     401    setSpectrumOffsetRight(peakAnnotationUtil.getSpectrumOffsetRight());
     402    // Set spectrum limit mass min and max values
     403    setSpectrumLimitMassMin(peakAnnotationUtil.getSpectrumLimitMassMin());
     404    setSpectrumLimitMassMax(peakAnnotationUtil.getSpectrumLimitMassMax());
    324405    return imageMap;
    325406  }
     
    346427    PeakAnnotationUtil peakAnnotationUtil = new PeakAnnotationUtil();
    347428    ImageMap imageMap = peakAnnotationUtil.fetchMassPeakAnnotationToolTips(spectrum, imageWidth, imageHeight);
     429    // Set spectrum offset left and right pixel values
     430    setSpectrumOffsetLeft(peakAnnotationUtil.getSpectrumOffsetLeft());
     431    setSpectrumOffsetRight(peakAnnotationUtil.getSpectrumOffsetRight());
     432    // Set spectrum limit mass min and max values
     433    setSpectrumLimitMassMin(peakAnnotationUtil.getSpectrumLimitMassMin());
     434    setSpectrumLimitMassMax(peakAnnotationUtil.getSpectrumLimitMassMax());
    348435    return imageMap;
    349436  }
Note: See TracChangeset for help on using the changeset viewer.