Class Trend

All Implemented Interfaces:
fr.esrf.tangoatk.core.IListStateListener, fr.esrf.tangoatk.core.IRefresherListener, IJLChartActionListener, IJLChartListener, IControlee, JDrawable, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class Trend extends JPanel implements IControlee, ActionListener, IJLChartActionListener, fr.esrf.tangoatk.core.IRefresherListener, fr.esrf.tangoatk.core.IListStateListener, IJLChartListener, JDrawable
A class to monitor multiple scalar attributes.
See Also:
  • Field Details

    • SEL_NONE

      public static final int SEL_NONE
      Not selected
      See Also:
    • SEL_X

      public static final int SEL_X
      Selected on X
      See Also:
    • SEL_Y1

      public static final int SEL_Y1
      Selected on Y1
      See Also:
    • SEL_Y2

      public static final int SEL_Y2
      Selected on Y2
      See Also:
    • DEVICE_LABEL_AUTO

      public static final int DEVICE_LABEL_AUTO
      Device name are displayed whithin chart label when needed
      See Also:
    • DEVICE_LABEL_NEVER

      public static final int DEVICE_LABEL_NEVER
      Device name are never displayed whithin chart label
      See Also:
    • DEVICE_LABEL_ALWAYS

      public static final int DEVICE_LABEL_ALWAYS
      Device name are always displayed whithin chart label
      See Also:
    • defaultColor

      protected static Color[] defaultColor
    • parent

      protected JFrame parent
    • theToolBar

      protected JToolBar theToolBar
    • toolMenu

      protected JPopupMenu toolMenu
    • optionButton

      protected JButton optionButton
    • optionMenuI

      protected JMenuItem optionMenuI
    • startStopButton

      protected JButton startStopButton
    • startIcon

      protected ImageIcon startIcon
    • stopIcon

      protected ImageIcon stopIcon
    • startStopMenuI

      protected JMenuItem startStopMenuI
    • loadButton

      protected JButton loadButton
    • loadMenuI

      protected JMenuItem loadMenuI
    • saveButton

      protected JButton saveButton
    • saveMenuI

      protected JMenuItem saveMenuI
    • zoomButton

      protected JButton zoomButton
    • zoomMenuI

      protected JMenuItem zoomMenuI
    • timeButton

      protected JButton timeButton
    • timeMenuI

      protected JMenuItem timeMenuI
    • sourceMenuI

      protected JMenu sourceMenuI
    • sourceDEVMenuI

      protected JCheckBoxMenuItem sourceDEVMenuI
    • sourceCACHEMenuI

      protected JCheckBoxMenuItem sourceCACHEMenuI
    • sourceCACHEDEVMenuI

      protected JCheckBoxMenuItem sourceCACHEDEVMenuI
    • cfgButton

      protected JButton cfgButton
    • cfgMenuI

      protected JMenuItem cfgMenuI
    • resetButton

      protected JButton resetButton
    • resetMenuI

      protected JMenuItem resetMenuI
    • offLineButton

      protected JCheckBoxMenuItem offLineButton
    • showErrorMenuI

      protected JMenuItem showErrorMenuI
    • showDiagMenuI

      protected JMenuItem showDiagMenuI
    • showtoolMenuI

      protected JMenuItem showtoolMenuI
    • innerPanel

      protected JPanel innerPanel
    • dateLabel

      protected JLabel dateLabel
    • treeView

      protected JScrollPane treeView
    • mainTree

      protected JTree mainTree
    • mainTreeModel

      protected DefaultTreeModel mainTreeModel
    • rootNode

      protected fr.esrf.tangoatk.widget.attribute.TrendSelectionNode rootNode
    • treeMenu

      protected JPopupMenu treeMenu
    • addXMenuItem

      protected JMenuItem addXMenuItem
    • addY1MenuItem

      protected JMenuItem addY1MenuItem
    • addY2MenuItem

      protected JMenuItem addY2MenuItem
    • showMinAlarmMenuItem

      protected JCheckBoxMenuItem showMinAlarmMenuItem
    • showMaxAlarmMenuItem

      protected JCheckBoxMenuItem showMaxAlarmMenuItem
    • removeMenuItem

      protected JMenuItem removeMenuItem
    • optionMenuItem

      protected JMenuItem optionMenuItem
    • attOptionMenuItem

      protected JMenuItem attOptionMenuItem
    • theGraph

      protected JLChart theGraph
    • attList

      protected fr.esrf.tangoatk.core.AttributePolledList attList
    • buttonMap

      protected Map buttonMap
    • startStop

      public static final String startStop
      Corresponds to the button "start/stop monitoring"
      See Also:
    • save

      public static final String save
      Corresponds to the button "Save configuration"
      See Also:
    • load

      public static final String load
      Corresponds to the button "Load configuration"
      See Also:
    • zoom

      public static final String zoom
      Corresponds to the button "Zoom"
      See Also:
    • time

      public static final String time
      Corresponds to the button "Set rfresh interval"
      See Also:
    • option

      public static final String option
      Corresponds to the button "Global settings"
      See Also:
    • config

      public static final String config
      Corresponds to the button "Add new attribute"
      See Also:
    • reset

      public static final String reset
      Corresponds to the button "Reset trend"
      See Also:
    • minRefreshInterval

      protected int minRefreshInterval
    • panelToolBarTrend

      protected JToolBar panelToolBarTrend
    • panelToolBar

      protected JToolBar panelToolBar
    • timeButtonTrend

      protected JButton timeButtonTrend
    • refreshButton

      protected JButton refreshButton
    • timeMenuTrendI

      protected JMenuItem timeMenuTrendI
    • refreshMenuI

      protected JMenuItem refreshMenuI
    • minRefreshTrendInterval

      protected int minRefreshTrendInterval
    • offLineMode

      protected boolean offLineMode
    • listSource

      protected fr.esrf.Tango.DevSource listSource
    • errWin

      protected ErrorHistory errWin
  • Constructor Details

    • Trend

      public Trend(JFrame parent)
      Trend constructor.
      Parameters:
      parent - Parent frame
    • Trend

      public Trend()
      Default constructor.
  • Method Details

    • 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
    • actionPerformed

      public void actionPerformed(ActionEvent evt)
      Specified by:
      actionPerformed in interface ActionListener
    • 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:
    • getTimePrecision

      public int getTimePrecision()
    • setTimePrecision

      public void setTimePrecision(int timePrecision)
    • refreshStep

      public void refreshStep()
      Specified by:
      refreshStep in interface fr.esrf.tangoatk.core.IRefresherListener
    • stateChange

      public void stateChange(int state)
      Specified by:
      stateChange in interface fr.esrf.tangoatk.core.IListStateListener
    • setOffLineMode

      public void setOffLineMode(boolean mode)
      Sets or unset the offline mode (data are updated but not painted)
      Parameters:
      mode - Offline mode
    • clearModel

      public void clearModel()
      Free any allocated resource and stop refreshing. The internal attribute list is released if it has been created using addAttribute() or setSettings().
    • setModel

      public void setModel(fr.esrf.tangoatk.core.AttributePolledList list)
      This setModel which takes an AttributePolledList as a parameter, will just add the attributes in the list to the list viewer in the Trend. It will not add any of the attributes to the Trend
      Parameters:
      list - a AttributePolledList value
    • addAttribute

      public void addAttribute(String name)
      addAttribute will add the INumberScalar to the Trend. Additional calls to addAttribute will add more INumberScalars to the trend.
      Parameters:
      name - Attribute name
    • addAttribute

      public void addAttribute(fr.esrf.tangoatk.core.INumberScalar scalar)
    • removeAttribute

      public void removeAttribute(fr.esrf.tangoatk.core.INumberScalar scalar)
    • setModel

      public void setModel(fr.esrf.tangoatk.core.INumberScalar scalar)
      Deprecated.
      use addAttribute instead.
      setModel
      Parameters:
      scalar - a fr.esrf.tangoatk.core.INumberScalar value
    • getModel

      public fr.esrf.tangoatk.core.AttributePolledList getModel()
    • getSettings

      public String getSettings()
      Returns:
      the configuration as string.
      See Also:
    • getSettings

      public String getSettings(boolean forJDraw)
    • setSetting

      public String setSetting(String txt)
      Apply a configuration.
      Parameters:
      txt - Configuration text.
      Returns:
      An error string or An empty string when succes
      See Also:
    • setSetting

      public String setSetting(String txt, boolean forJdraw)
    • saveSetting

      public void saveSetting(String filename)
      Save settings.
      Parameters:
      filename - file to be saved.
    • loadSetting

      public String loadSetting(String filename)
      Load graph settings.
      Parameters:
      filename - file to be read
      Returns:
      An error string or An empty string when succes
    • getTitle

      public String getTitle()
      Returns:
      the frame_title field read in the config file.
    • setLegendVisible

      public void setLegendVisible(boolean b)
      Deprecated.
      use getChart()
      Parameters:
      b - Not used
    • isLegendVisible

      public boolean isLegendVisible()
      Deprecated.
      use getChart()
      Returns:
      false
    • setSamplingRate

      public void setSamplingRate(double rate)
      Deprecated.
      no longer used (has no FX)
      Parameters:
      rate - Not used
    • getSamplingRate

      public double getSamplingRate()
      Deprecated.
      no longer used (has no FX)
      Returns:
      0
    • setXAxisLength

      public void setXAxisLength(int length)
      Deprecated.
      no longer used (has no FX)
      Parameters:
      length - Not used
    • getXAxisLength

      public int getXAxisLength()
      Deprecated.
      no longer used (has no FX)
      Returns:
      0
    • setLogarithmicScale

      public void setLogarithmicScale(boolean logarithmic)
      Deprecated.
      use getChart()
      Parameters:
      logarithmic - Not used
    • isLogarithmicScale

      public boolean isLogarithmicScale()
      Deprecated.
      use getChart()
      Returns:
      false
    • setListVisible

      public void setListVisible(boolean b)
      Deprecated.
      no longer used (has no FX)
      Parameters:
      b - Not used
    • isListVisible

      public boolean isListVisible()
      Deprecated.
      no longer used (has no FX)
      Returns:
      false
    • setShowingNames

      public void setShowingNames(boolean b)
      Deprecated.
      no longer used (has no FX)
      Parameters:
      b - Not used
    • isShowingNames

      public boolean isShowingNames()
      Deprecated.
      no longer used (has no FX)
      Returns:
      false
    • setShowingDeviceNames

      public void setShowingDeviceNames(int mode)
      Determines whether or not device names (within chart labels) are visible.
      Parameters:
      mode - Device name display mode
      See Also:
    • isShowingDeviceNames

      public int isShowingDeviceNames()
      Returns:
      whether or not device names (within chart labels) are visible.
      See Also:
    • setButtonBarVisible

      public void setButtonBarVisible(boolean b)
      Displays or hides the toolbar
      Parameters:
      b - Visible flag
    • isButtonBarVisible

      public boolean isButtonBarVisible()
      Returns true only if toolbar is visible
      Returns:
      Visible flag
    • setDateVisible

      public void setDateVisible(boolean b)
      Displays or hides the date label
      Parameters:
      b - Visible flag
    • isDateVisible

      public boolean isDateVisible()
      Returns true only if datelabel is visible
      Returns:
      Visible flag
    • setSelectionTreeVisible

      public void setSelectionTreeVisible(boolean b)
      Displays or hides the selection tree
      Parameters:
      b - Visible flag
    • isSelectionTreeVisible

      public boolean isSelectionTreeVisible()
      Returns:
      true only if the selection tree is visible
    • getChart

      public JLChart getChart()
      Returns a handle to the chart
      Returns:
      Chart handle
    • ok

      public void ok()
      Description copied from interface: IControlee
      ok will be called when the component is visible and the user presses the OK button on the ButtonBar Expected behaviour is to set all the values on the model the widget is representing followed by a getRootPane().getParent().setVisible(false);
      Specified by:
      ok in interface IControlee
      See Also:
    • disableButton

      public void disableButton(String buttonName)
      Disables the button corresponding to the string
      Parameters:
      buttonName - Button name
    • enableButton

      public void enableButton(String buttonName)
      Enables the button corresponding to the string
      Parameters:
      buttonName - Button name
    • addToAxis

      public void addToAxis(String attributeName, int axisSelection, boolean addToModel)
      Adds an attribute to an axis of this trend (or removes the attribute from axis).
      Parameters:
      attributeName - The name of the attribute
      axisSelection - The axis. Can be SEL_X (x axis), SEL_Y1 (y1 axis), SEL_Y2 (y2 axis) or SEL_NONE (removes attribute from axis)
      addToModel - A boolean to say wheather the attribute has to be added in model or not. If true and the attribute is not in model, the attribute is added in the trend model.
      See Also:
    • addToAxis

      public void addToAxis(fr.esrf.tangoatk.core.INumberScalar attribute, int axisSelection, boolean addToModel)
      Adds an attribute to an axis of this trend (or removes the attribute from axis).
      Parameters:
      attribute - The attribute
      axisSelection - The axis. Can be SEL_X (x axis), SEL_Y1 (y1 axis), SEL_Y2 (y2 axis) or SEL_NONE (removes attribute from axis)
      addToModel - A boolean to say wheather the attribute has to be added in model or not. If true and the attribute is not in model, the attribute is added in the trend model.
      See Also:
    • getAxisForAttribute

      public int getAxisForAttribute(String attributeName)
      Returns the axis associated with an attribute
      Parameters:
      attributeName - The name of the attribute
      Returns:
      The axis associated with the attribute the value can be:
      • SEL_X (x axis)
      • SEL_Y1 (y1 axis)
      • SEL_Y2 (y2 axis)
      • SEL_NONE (no axis, default value)
      See Also:
    • getDataViewForAttribute

      public JLDataView getDataViewForAttribute(String attributeName)
      Returns the dataview associated with an attribute (null if no dataview is associated with the attribute)
      Parameters:
      attributeName - The name of the attribute
      Returns:
      The dataview associated with the attribute (null if no dataview is associated with the attribute)
    • setMaxDisplayDuration

      public void setMaxDisplayDuration(double maxDisplay)
    • getMaxDisplayDuration

      public double getMaxDisplayDuration()
    • getMinRefreshInterval

      protected int getMinRefreshInterval()
    • setMinRefreshInterval

      protected void setMinRefreshInterval(int minRefreshInterval)
    • resetTrend

      public void resetTrend()
    • getMinRefreshTrendInterval

      protected int getMinRefreshTrendInterval()
    • setMinRefreshTrendInterval

      protected void setMinRefreshTrendInterval(int minRefreshTrendInterval)
    • getRefreshIntervalTrend

      public int getRefreshIntervalTrend()
    • setRefreshIntervalTrend

      public void setRefreshIntervalTrend(int refreshIntervalTrend)
    • isManageIntervalTrend

      public boolean isManageIntervalTrend()
    • setManageIntervalTrend

      public void setManageIntervalTrend()
    • refreshTrend

      public void refreshTrend()
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception
    • 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.
    • 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 popupAllowed)
      Description copied from interface: JDrawable
      Sets the specified param.
      Specified by:
      setExtendedParam in interface JDrawable
      Parameters:
      name - Parameter name (Case unsensitive).
      value - Parameter value.
      popupAllowed - 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.
    • getDescription

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

      public int getJDWAttributeNumber()
      Returns number of JDW attribute
      Returns:
      Number of JDW attribute
    • getJDWAttribute

      public JDWAttribute getJDWAttribute(int idx)
      Parameters:
      idx - Index of JDW attribute
      Returns:
      the specified JDW attribute