Class ReferenceArea

java.lang.Object
com.compomics.util.gui.spectrum.ReferenceArea

public class ReferenceArea
extends Object
A reference area to be added to a GraphicsPanel.
Author:
Harald Barsnes.
  • Constructor Summary

    Constructors 
    Constructor Description
    ReferenceArea()
    Empty default constructor
    ReferenceArea​(String identifier, String label, double start, double end, Color areaColor, float alpha, boolean drawOnTop, boolean drawLabel, boolean aboveXAxis)
    Creates a new ReferenceArea.
    ReferenceArea​(String identifier, String label, double start, double end, Color areaColor, float alpha, boolean drawOnTop, boolean drawLabel, Color labelColor, boolean boldFont, Color borderColor, float borderWidth, double percentLength, boolean aboveXAxis)
    Creates a new ReferenceArea.
  • Method Summary

    Modifier and Type Method Description
    boolean drawLabel()
    Returns true if the label is to be drawn, false otherwise.
    boolean drawOnTop()
    Returns true if the area is to be drawn in front of the data, false otherwise.
    float getAlpha()
    Get the alpha level (transparency).
    Color getAreaColor()
    Get the area color.
    Color getBorderColor()
    Returns the border color.
    float getBorderWidth()
    Returns the border width.
    double getEnd()
    Get the end value.
    String getIdentifier()
    Returns the reference identifier.
    String getLabel()
    Returns the label.
    Color getLabelColor()
    Returns the label color.
    double getPercentLength()
    Returns the length of the reference area in percent.
    double getStart()
    Get the start value.
    boolean isAboveXAxis()
    Returns true if the reference area is added above the x-axis, false adds the reference are below the x-axis
    void setAboveXAxis​(boolean aboveXAxis)
    Set if the reference area is to be added above the x-axis, false adds the reference are below the x-axis
    void setAlpha​(float alpha)
    Set the alpha level (transparency).
    void setAreaColor​(Color areaColor)
    Set the area color.
    void setBoldFont​(boolean boldFont)
    Set if the label is to be in bold.
    void setBorderColor​(Color borderColor)
    Set the border color.
    void setBorderWidth​(float borderWidth)
    Set the border width.
    void setDrawLabel​(boolean drawLabel)
    Set to true if the label is to be drawn, false otherwise.
    void setDrawOnTop​(boolean drawOnTop)
    Set to true if the area is to be drawn in front of the data, false otherwise.
    void setEnd​(double end)
    Set the end value.
    void setIdentifier​(String identifier)
    Sets the references identifier.
    void setLabel​(String label)
    Sets the label.
    void setLabelColor​(Color labelColor)
    Set the label color.
    void setPercentLength​(double percentLength)
    Set the length of the reference area in percent.
    void setStart​(double start)
    Set the start value.
    boolean useBoldFont()
    Returns true of the label should be in bold.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ReferenceArea

      public ReferenceArea()
      Empty default constructor
    • ReferenceArea

      public ReferenceArea​(String identifier, String label, double start, double end, Color areaColor, float alpha, boolean drawOnTop, boolean drawLabel, boolean aboveXAxis) throws IllegalArgumentException
      Creates a new ReferenceArea.
      Parameters:
      identifier - the reference identifier, has to be unique
      label - the reference label, i.e., what is shown on the screen
      start - the start of the reference area
      end - the end of the reference area
      areaColor - the color of the reference area
      alpha - the alpha level (transparency) of the reference area
      drawOnTop - if the area is to be drawn on top of or behind the data
      drawLabel - if the label is to be drawn or not
      aboveXAxis - if true the reference area is added above the x-axis, false adds the reference are below the x-axis
      Throws:
      IllegalArgumentException - alpha must be in the range 0.0f to 1.0f
    • ReferenceArea

      public ReferenceArea​(String identifier, String label, double start, double end, Color areaColor, float alpha, boolean drawOnTop, boolean drawLabel, Color labelColor, boolean boldFont, Color borderColor, float borderWidth, double percentLength, boolean aboveXAxis) throws IllegalArgumentException
      Creates a new ReferenceArea.
      Parameters:
      identifier - the reference identifier, has to be unique
      label - the reference label, i.e., what is shown on the screen
      start - the start of the reference area
      end - the end of the reference area
      areaColor - the color of the reference area
      alpha - the alpha level (transparency) of the reference area
      drawOnTop - if the area is to be drawn on top of or behind the data
      drawLabel - if the label is to be drawn or not
      labelColor - the color to use for the label
      boldFont - if the label is to be in bold font
      borderColor - the border color
      borderWidth - the border width
      percentLength - the length in percent, [0.0 - 1.0].
      aboveXAxis - if true the reference area is added above the x-axis, false adds the reference are below the x-axis
      Throws:
      IllegalArgumentException - alpha must be in the range 0.0f to 1.0f
  • Method Details

    • getLabel

      public String getLabel()
      Returns the label.
      Returns:
      the label
    • setLabel

      public void setLabel​(String label)
      Sets the label.
      Parameters:
      label - the label to set
    • getStart

      public double getStart()
      Get the start value.
      Returns:
      the start
    • setStart

      public void setStart​(double start)
      Set the start value.
      Parameters:
      start - the start to set
    • getEnd

      public double getEnd()
      Get the end value.
      Returns:
      the end
    • setEnd

      public void setEnd​(double end)
      Set the end value.
      Parameters:
      end - the end to set
    • getAreaColor

      public Color getAreaColor()
      Get the area color.
      Returns:
      the areaColor
    • setAreaColor

      public void setAreaColor​(Color areaColor)
      Set the area color.
      Parameters:
      areaColor - the areaColor to set
    • getAlpha

      public float getAlpha()
      Get the alpha level (transparency).
      Returns:
      the alpha level
    • setAlpha

      public void setAlpha​(float alpha)
      Set the alpha level (transparency).
      Parameters:
      alpha - the alpha level to set
    • drawOnTop

      public boolean drawOnTop()
      Returns true if the area is to be drawn in front of the data, false otherwise.
      Returns:
      true if the area is to be drawn in front of the data, false otherwise
    • setDrawOnTop

      public void setDrawOnTop​(boolean drawOnTop)
      Set to true if the area is to be drawn in front of the data, false otherwise.
      Parameters:
      drawOnTop - if the area is to be drawn in front of the data
    • drawLabel

      public boolean drawLabel()
      Returns true if the label is to be drawn, false otherwise.
      Returns:
      true if the label is to be drawn, false otherwise
    • setDrawLabel

      public void setDrawLabel​(boolean drawLabel)
      Set to true if the label is to be drawn, false otherwise.
      Parameters:
      drawLabel - if the label is to be drawn
    • getLabelColor

      public Color getLabelColor()
      Returns the label color.
      Returns:
      the labelColor
    • setLabelColor

      public void setLabelColor​(Color labelColor)
      Set the label color.
      Parameters:
      labelColor - the labelColor to set
    • useBoldFont

      public boolean useBoldFont()
      Returns true of the label should be in bold.
      Returns:
      the boldFont
    • setBoldFont

      public void setBoldFont​(boolean boldFont)
      Set if the label is to be in bold.
      Parameters:
      boldFont - the boldFont to set
    • getBorderColor

      public Color getBorderColor()
      Returns the border color.
      Returns:
      the borderColor
    • setBorderColor

      public void setBorderColor​(Color borderColor)
      Set the border color.
      Parameters:
      borderColor - the borderColor to set
    • getBorderWidth

      public float getBorderWidth()
      Returns the border width.
      Returns:
      the borderWidth
    • setBorderWidth

      public void setBorderWidth​(float borderWidth)
      Set the border width.
      Parameters:
      borderWidth - the borderWidth to set
    • getPercentLength

      public double getPercentLength()
      Returns the length of the reference area in percent. For x-axis areas this is the height of the area from the x-axis upwards, while for y-axis area this is the width of the area from the y-axis and to the right. Range: [0.0 - 1.0].
      Returns:
      the percentLength
    • setPercentLength

      public void setPercentLength​(double percentLength)
      Set the length of the reference area in percent. For x-axis areas this is the height of the area from the x-axis upwards, while for y-axis area this is the width of the area from the y-axis and to the right. Range: [0.0 - 1.0].
      Parameters:
      percentLength - the percentLength to set
    • getIdentifier

      public String getIdentifier()
      Returns the reference identifier.
      Returns:
      the identifier
    • setIdentifier

      public void setIdentifier​(String identifier)
      Sets the references identifier. Has to be unique.
      Parameters:
      identifier - the identifier to set
    • isAboveXAxis

      public boolean isAboveXAxis()
      Returns true if the reference area is added above the x-axis, false adds the reference are below the x-axis
      Returns:
      true if the reference area is added above the x-axis, false adds the reference are below the x-axis
    • setAboveXAxis

      public void setAboveXAxis​(boolean aboveXAxis)
      Set if the reference area is to be added above the x-axis, false adds the reference are below the x-axis
      Parameters:
      aboveXAxis - if the reference area is to be added above the x-axis