Class NumberSpectrumTrend3DViewer

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
fr.esrf.tangoatk.widget.attribute.NumberSpectrumTrend3DViewer
All Implemented Interfaces:
fr.esrf.tangoatk.core.IAttributeStateListener, fr.esrf.tangoatk.core.IErrorListener, fr.esrf.tangoatk.core.ISpectrumListener, IJLChartListener, J3DTrendListener, ActionListener, AdjustmentListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener

public class NumberSpectrumTrend3DViewer extends JComponent implements fr.esrf.tangoatk.core.ISpectrumListener, ActionListener, MouseListener, J3DTrendListener, IJLChartListener, AdjustmentListener
A class to monitor a spectrum as a function of time using colormap for intensity.
See Also:
  • Field Details

    • zoomInfos

      public static final fr.esrf.tangoatk.widget.attribute.ZoomInfo[] zoomInfos
      Possible zoom values.
    • model

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

      protected JPopupMenu popupMenu
    • saveFileMenuItem

      protected JMenuItem saveFileMenuItem
    • settingsMenuItem

      protected JMenuItem settingsMenuItem
    • hProfileMenuItem

      protected JMenuItem hProfileMenuItem
    • vProfileMenuItem

      protected JMenuItem vProfileMenuItem
    • hZoomMenu

      protected JMenu hZoomMenu
    • vZoomMenu

      protected JMenu vZoomMenu
    • settingsFrame

      protected JFrame settingsFrame
    • propDialog

      protected SimplePropertyFrame propDialog
    • vProfiler

      protected LineProfilerViewer vProfiler
    • hProfiler

      protected JFrame hProfiler
    • hProfilerGraph

      protected JLChart hProfilerGraph
    • hProfilerData

      protected JLDataView hProfilerData
  • Constructor Details

    • NumberSpectrumTrend3DViewer

      public NumberSpectrumTrend3DViewer()
      Construct a number specturm 3D viewer
  • Method Details

    • adjustmentValueChanged

      public void adjustmentValueChanged(AdjustmentEvent evt)
      Specified by:
      adjustmentValueChanged in interface AdjustmentListener
    • setHistoryLength

      public void setHistoryLength(int length)
      Sets the horizontal axis length in pixel.
      Parameters:
      length - Horizontal axis length
    • getTrend

      public J3DTrend getTrend()
      Returns 3D trend components
      Returns:
      3D trend viewer
    • getHistoryLength

      public int getHistoryLength()
      Returns the horizontal axis length in pixel.
      Returns:
      Horizontal axis length
    • clearData

      public void clearData()
      Clear the viewer
    • setData

      public void setData(long[] dates, double[][] data)
      Fill the viewer with arbitrary data
      Parameters:
      dates - Time stamps
      data - Data
    • setData

      public void setData(double[] dates, double[][] data)
    • setZMinimum

      public void setZMinimum(double min)
      Sets the minimum of the z axis (color)
      Parameters:
      min - Minimum value
    • getZMinimum

      public double getZMinimum()
      Returns the minimum of the of the z axis (color)
      Returns:
      minimum value
    • setZMaximum

      public void setZMaximum(double max)
      Sets the maximum of the z axis (color)
      Parameters:
      max - Maximum value
    • getZMaximum

      public double getZMaximum()
      Returns:
      maximum value of the z axis (color)
    • isZAutoScale

      public boolean isZAutoScale()
      Returns:
      true if the viewer is in autoscale mode for the colormap, false otherwise
    • setZAutoScale

      public void setZAutoScale(boolean autoScale)
      Sets the viewer in autoscale mode for the colormap when true, use min and max otherwise
      Parameters:
      autoScale - AutoScale flag
    • isLogScale

      public boolean isLogScale()
      Returns:
      true if the viewer is in log scale for the colormap, false otherwise
    • setLogScale

      public void setLogScale(boolean logScale)
      Set the viewer in linear or log scale for the colormap
      Parameters:
      logScale - LogScale flag
    • isShowDerivative

      public boolean isShowDerivative()
      Returns:
      true if the viewer display derivative data, false otherwise
    • setShowDerivative

      public void setShowDerivative(boolean show)
      Set the viewer in linear or log scale for the colormap
      Parameters:
      show - Display derivative data
    • setGradient

      public void setGradient(Gradient g)
      Sets the colormap.
      Parameters:
      g - Gradient colormap
    • getGradient

      public Gradient getGradient()
      Returns:
      the gradient used by the viewer.
    • setGradientVisible

      public void setGradientVisible(boolean b)
      Displays or hides the gradient (right panel).
      Parameters:
      b - True if status line is displayed
    • isGradientVisible

      public boolean isGradientVisible()
      Returns:
      true when the gradient is visible.
    • setNaNColor

      public void setNaNColor(Color nanColor)
      Sets the color for the NaN values
      Parameters:
      nanColor - NaN color
    • getXAxis

      public JLAxis getXAxis()
      Returns:
      a handle to the horizontal axis
    • getYAxis

      public JLAxis getYAxis()
      Returns:
      a handle to the vertical axis
    • setHorizontalZoom

      public void setHorizontalZoom(int zoom)
      Sets the horizontal zoom factor See ZoomInfo for accepted zoom.
      Parameters:
      zoom - zoom factor
    • getHorizontalZoom

      public int getHorizontalZoom()
      Returns:
      the horizontal zoom factor.
    • setVerticalZoom

      public void setVerticalZoom(int zoom)
      Sets the vertical zoom factor See ZoomInfo for accepted zoom.
      Parameters:
      zoom - zoom factor
    • getVerticalZoom

      public int getVerticalZoom()
      Returns:
      the vertical zoom factor
    • setFormat

      public void setFormat(String f)
    • getFormat

      public String getFormat()
    • setModel

      public void setModel(fr.esrf.tangoatk.core.INumberSpectrum v)
      Sets the model of this viewer
      Parameters:
      v - NumberSpectrum model
    • clearModel

      public void clearModel()
      removes the model.
    • getTimeAt

      public double getTimeAt(int x)
      Returns the timestamp of the values at the coordinates x. Returns 0 if no data is present at this place. x is in image coordinates.
      Parameters:
      x - X coordinates (in image coordinates)
      Returns:
      Tiemstamp at x
    • addNumberSpectrumTrend3DViewerListener

      public void addNumberSpectrumTrend3DViewerListener(NumberSpectrumTrend3DViewerListener l)
      Add the given NumberSpectrumTrend3DViewerListener
      Parameters:
      l - NumberSpectrumTrend3DViewerListener
    • addCursorListener

      public void addCursorListener(I3DTrendCursorListener l)
      Add the given cursor listener
      Parameters:
      l - I3DTrendCursorListener
    • removeCursorListener

      public void removeCursorListener(I3DTrendCursorListener l)
      Remove the given cursor listener
      Parameters:
      l - I3DTrendCursorListener
    • addChangeListener

      public void addChangeListener(I3DTrendChangeListener l)
      Add the given change listener
      Parameters:
      l - I3DTrendChangeListener
    • removeChangeListener

      public void removeChangeListener(I3DTrendChangeListener l)
      Remove the given change listener
      Parameters:
      l - I3DTrendChangeListener
    • setCursorPos

      public void setCursorPos(int x, int y)
      Sets the cursor position (data coordinates)
      Parameters:
      x - X cursor coordinates
      y - Y cursor coordinates
    • getXCursor

      public int getXCursor()
      Returns:
      horizontal position of the cursor (data coordinates), -1 is returned if there is no cursor.
    • getYCursor

      public int getYCursor()
      Returns:
      vertical position of the cursor (data coordinates) -1 is returned if there is no cursor.
    • getValueAt

      public double getValueAt(int x, int y)
      Return the value at (x,y) position. NaN is returned if no data.
      Parameters:
      x - X coordinates (in image coordinates)
      y - Y coordinates (in image coordinates)
      Returns:
      The value at x,y
    • setCursorEnabled

      public void setCursorEnabled(boolean enable)
      Enable cross cursor on mouse click
      Parameters:
      enable - Enable cursor
    • clearStatusLabel

      public void clearStatusLabel()
      Clear the values in the status label, only name is printed until the next click.
    • updateCursor

      public void updateCursor(int xCursor, int yCursor, boolean fireCursorChange)
      Update cursor information. This function is trigerred when the user click on the image.
      Specified by:
      updateCursor in interface J3DTrendListener
      Parameters:
      xCursor - x coordinates (referenced by the image)
      yCursor - y coordinates (referenced by the image)
      fireCursorChange - Fire cursorChange event
    • setShowingMenu

      public void setShowingMenu(boolean b)
      True to enable menu displayed when clicking on right mouse button.
      Parameters:
      b - True to enable the menu
    • isShowingMenu

      public boolean isShowingMenu()
      Returns true is the image viewer menu is displayed when clicking on the right mouse button.
      Returns:
      True is menu is enabled
    • readPollingHistory

      public void readPollingHistory(boolean readPolling)
      Reads the polling history when setting the model
      Parameters:
      readPolling - true to enable history reading, false otherwise
    • setValueName

      public void setValueName(String vName)
      Sets the name wich is displayed in the status line for the value.
      Parameters:
      vName - value name
    • setYName

      public void setYName(String yName)
      Sets the name which is displayed in the status line for the y value.
      Parameters:
      yName - y axis name
    • setYIndexName

      public void setYIndexName(String[] idxName)
      Sets the names of Y index
      Parameters:
      idxName - Array of string containing vertical index name
    • setYUnit

      public void setYUnit(String unit)
      Sets the unit of the y axis
      Parameters:
      unit - Y axis unit
    • setYTransfom

      public void setYTransfom(double gain, double offset)
      Sets the Y axis coordinates transformation
      Parameters:
      gain - Y gain
      offset - Y offset
    • setUnit

      public void setUnit(String unit)
      Sets the name which is displayed in the status line for the unit.
      Parameters:
      unit - Unit
    • setName

      public void setName(String name)
      Sets the main name which is displayed in the status line.
      Overrides:
      setName in class Component
      Parameters:
      name - Name
    • commit

      public void commit()
      Rebuild image when some settings has been changed.
    • scrollToRight

      public void scrollToRight()
      Scrolls the image to the right
    • scrollToLeft

      public void scrollToLeft()
      Scrolls the image to the left
    • setHorinzontalScrollPos

      public void setHorinzontalScrollPos(int pos)
      Sets the horizontal scroll position
      Parameters:
      pos - Scrollbar position
    • setVertitalScrollPos

      public void setVertitalScrollPos(int pos)
      Sets the vertical scroll position
      Parameters:
      pos - Scrollbar position
    • setTrendBackground

      public void setTrendBackground(Color bg)
      Sets the trend backgroudn color
      Parameters:
      bg - Background color
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • clickOnChart

      public String[] clickOnChart(JLChartEvent evt)
      Description copied from interface: IJLChartListener
      Called when the user click on the chart
      Specified by:
      clickOnChart in interface IJLChartListener
      Parameters:
      evt - 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
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • spectrumChange

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

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

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

      public void showSettings()
    • saveDataFile

      public void saveDataFile()
    • makeTabbedString

      protected String makeTabbedString(boolean transpose)
    • main

      public static void main(String[] args)