Class NumberSpectrumViewer

All Implemented Interfaces:
fr.esrf.tangoatk.core.IAttributeStateListener, fr.esrf.tangoatk.core.IErrorListener, fr.esrf.tangoatk.core.INumberScalarListener, fr.esrf.tangoatk.core.ISpectrumListener, IJLChartActionListener, IJLChartListener, JDrawable, ActionListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener

public class NumberSpectrumViewer extends AdvancedJLChart implements fr.esrf.tangoatk.core.ISpectrumListener, fr.esrf.tangoatk.core.INumberScalarListener, IJLChartActionListener, IJLChartListener, JDrawable
A class to display a scalar spectrum attribute . The NumberSpectrumViewer displays the spectrum according to index value (x axis shows value index).
Author:
E.S.R.F
See Also:
  • Field Details

    • model

      protected fr.esrf.tangoatk.core.INumberSpectrum model
    • dvy

      protected JLDataView dvy
    • pf

      protected SimplePropertyFrame pf
    • A0

      protected double A0
    • A1

      protected double A1
    • xAxisUnit

      protected String xAxisUnit
    • format

      protected String format
    • unitVisible

      protected boolean unitVisible
    • qualityVisible

      protected boolean qualityVisible
    • DISPLAY_UNIT_STRING

      protected static final String DISPLAY_UNIT_STRING
      See Also:
    • DISPLAY_QUALITY_STRING

      protected static final String DISPLAY_QUALITY_STRING
      See Also:
    • SET_SPECTRUM_MENU_LABEL

      protected static final String SET_SPECTRUM_MENU_LABEL
      See Also:
  • Constructor Details

    • NumberSpectrumViewer

      public NumberSpectrumViewer()
      Creates new fNumberSpectrumViewer
  • Method Details

    • getDataView

      public JLDataView getDataView()
      Returns:
      the dataview which contains plotted data
    • getManageXaxis

      public boolean getManageXaxis()
      Returns:
      if the viewer should manage the X axis according to a min and max value.
    • setManageXaxis

      public void setManageXaxis(boolean b)
      Sets if the viewer should manage the X axis according to a min and max value. This method should be called BEFORE setModel()
      Parameters:
      b - True to enable automatic axis management
    • getXAxisUnit

      public String getXAxisUnit()
      Returns:
      the x Axis unit.
    • setXAxisUnit

      public void setXAxisUnit(String u)
      Sets the x Axis unit.
      Parameters:
      u - Axis unit
    • setXAxisAffineTransform

      public void setXAxisAffineTransform(double a0, double a1)
      Sets an affine tranform to the X axis. This allows to transform spectra index displayed on X axis.
      Parameters:
      a0 - a0 coefficient
      a1 - a1 coefficient
    • initForEditing

      public void initForEditing()
      Description copied from interface: JDrawable
      Call after a component of a JDSwingObject is created, this give a default look and feel for editing.
      Specified by:
      initForEditing in interface JDrawable
    • getComponent

      public JComponent getComponent()
      Specified by:
      getComponent in interface JDrawable
      Returns:
      the JComponent that implements this interface.
    • getDescription

      public String getDescription(String name)
      Description copied from interface: JDrawable
      Get a description of this extensions.
      Specified by:
      getDescription in interface JDrawable
      Parameters:
      name - Extension name
      Returns:
      Empty string for no description.
    • getExtensionList

      public String[] getExtensionList()
      Specified by:
      getExtensionList in interface JDrawable
      Returns:
      list of extension name for this objects (Empty array for none).
    • setExtendedParam

      public boolean setExtendedParam(String name, String value, boolean popupErr)
      Description copied from interface: JDrawable
      Sets the specified param.
      Specified by:
      setExtendedParam in interface JDrawable
      Parameters:
      name - Parameter name (Case unsensitive).
      value - Parameter value.
      popupErr - true when the JDrawable should display a popup if the parameter value is incorrect, false otherwise. Note that the JDrawable must not display an error message if the parameter does not exists even if popupAllowed is true.
      Returns:
      true if parameters has been succesfully applied, false otherwise.
    • getExtendedParam

      public String getExtendedParam(String name)
      Description copied from interface: JDrawable
      Returns the specified parameter value.
      Specified by:
      getExtendedParam in interface JDrawable
      Parameters:
      name - Param name (Case unsensitive).
      Returns:
      Empty string if not exists, the value otherwise.
    • actionPerformed

      public void actionPerformed(JLChartActionEvent evt)
      Description copied from interface: IJLChartActionListener
      Called when the user select a user action (available from contextual chart menu)
      Specified by:
      actionPerformed in interface IJLChartActionListener
      Parameters:
      evt - Event object (containing acion name and state)
      See Also:
    • getActionState

      public boolean getActionState(JLChartActionEvent evt)
      Description copied from interface: IJLChartActionListener
      Called when the the action name starting with 'chk' (displayed as check box menu item) and each time the chart menu is shown. if several listener handle the same action, the result will be a logical and of all results.
      Specified by:
      getActionState in interface IJLChartActionListener
      Parameters:
      evt - Event object (containing acion name)
      Returns:
      Action state (true to execute)
      See Also:
    • errorChange

      public void errorChange(fr.esrf.tangoatk.core.ErrorEvent errorEvent)
      Specified by:
      errorChange in interface fr.esrf.tangoatk.core.IErrorListener
    • stateChange

      public void stateChange(fr.esrf.tangoatk.core.AttributeStateEvent evt)
      Specified by:
      stateChange in interface fr.esrf.tangoatk.core.IAttributeStateListener
    • spectrumChange

      public void spectrumChange(fr.esrf.tangoatk.core.NumberSpectrumEvent numberSpectrumEvent)
      Specified by:
      spectrumChange in interface fr.esrf.tangoatk.core.ISpectrumListener
    • clickOnChart

      public String[] clickOnChart(JLChartEvent e)
      Description copied from interface: IJLChartListener
      Called when the user click on the chart
      Specified by:
      clickOnChart in interface IJLChartListener
      Parameters:
      e - Event object (containing click inforamtion)
      Returns:
      A set of string to display in the value tooltip. Does not display the tooltip if an empty array is returned. Keep default behavior when null is returned
    • setModel

      public void setModel(fr.esrf.tangoatk.core.INumberSpectrum v)
      setModel Set the model.
      Parameters:
      v - Value to assign to model.
    • clearModel

      public void clearModel()
      clearModel removes the model.
    • setSettings

      public String setSettings(String cfg)
      Apply configuration.
      Parameters:
      cfg - String containing configuration
      Returns:
      error string when failure or an empty string when succesfull
    • getSettings

      public String getSettings()
      Return configuration.
      Returns:
      current chart configuration as string
    • isUnitVisible

      public boolean isUnitVisible()
      Returns whether unit shoud be visible or not
      Returns:
      boolean corresponding to the choice
    • setUnitVisible

      public void setUnitVisible(boolean displayUnit)
      Sets whether unit shoud be visible or not
      Parameters:
      displayUnit - corresponding to the choice
    • isQualityVisible

      public boolean isQualityVisible()
    • setQualityVisible

      public void setQualityVisible(boolean qualityVisible)
    • setSpectrumAttribute

      public void setSpectrumAttribute()
    • removeDataView

      public void removeDataView(JLDataView view)
      Overrides:
      removeDataView in class JLChart
    • prepareDataViewMenu

      protected boolean prepareDataViewMenu(JLDataView dataView)
      Overrides:
      prepareDataViewMenu in class AdvancedJLChart
    • setXaxisModels

      public void setXaxisModels(fr.esrf.tangoatk.core.INumberScalar min, fr.esrf.tangoatk.core.INumberScalar max)
      Sets the min and max for X axis to two scalar attributes
      Parameters:
      min - Min value model
      max - Max value model
    • numberScalarChange

      public void numberScalarChange(fr.esrf.tangoatk.core.NumberScalarEvent evt)
      Specified by:
      numberScalarChange in interface fr.esrf.tangoatk.core.INumberScalarListener
    • main

      public static void main(String[] args)