Class BooleanTrend

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

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

    • SEL_NONE

      public static final int SEL_NONE
      Not selected
      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:
    • parent

      protected JFrame parent
    • theToolBar

      protected JToolBar theToolBar
    • toolMenu

      protected JPopupMenu toolMenu
    • optionButton

      protected JButton optionButton
    • optionMenuI

      protected JMenuItem optionMenuI
    • stopButton

      protected JButton stopButton
    • stopMenuI

      protected JMenuItem stopMenuI
    • startButton

      protected JButton startButton
    • startMenuI

      protected JMenuItem startMenuI
    • 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
    • cfgButton

      protected JButton cfgButton
    • cfgMenuI

      protected JMenuItem cfgMenuI
    • resetButton

      protected JButton resetButton
    • resetMenuI

      protected JMenuItem resetMenuI
    • 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.BooleanTrendSelectionNode rootNode
    • treeMenu

      protected JPopupMenu treeMenu
    • addY1MenuItem

      protected JMenuItem addY1MenuItem
    • addY2MenuItem

      protected JMenuItem addY2MenuItem
    • removeMenuItem

      protected JMenuItem removeMenuItem
    • optionMenuItem

      protected JMenuItem optionMenuItem
    • attOptionMenuItem

      protected JMenuItem attOptionMenuItem
    • theGraph

      protected fr.esrf.tangoatk.widget.attribute.BooleanChart theGraph
    • graphTitle

      protected String graphTitle
    • cfgPanel

      protected fr.esrf.tangoatk.widget.attribute.BooleanConfigPanel cfgPanel
    • framePos

      protected static Point framePos
    • frameDimension

      protected static Point frameDimension
    • attList

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

      protected fr.esrf.tangoatk.widget.attribute.BooleanTrendSelectionNode lastAdded
    • lastCreatedList

      protected fr.esrf.tangoatk.core.AttributePolledList lastCreatedList
    • propFrame

      protected SimplePropertyFrame propFrame
    • lastConfig

      protected String lastConfig
    • singleDevice

      protected boolean singleDevice
    • isShowingDeviceName

      protected int isShowingDeviceName
    • calendar

      protected static final GregorianCalendar calendar
    • genFormat

      protected static final SimpleDateFormat genFormat
    • buttonMap

      protected Map buttonMap
    • start

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

      public static final String stop
      Corresponds to the button "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:
    • timePrecision

      protected int timePrecision
    • labels

      protected static final String[] labels
    • labelPositions

      protected static final double[] labelPositions
    • defaultMinMax

      protected static final double[] defaultMinMax
    • booleanFilter

      protected static final fr.esrf.tangoatk.core.IEntityFilter booleanFilter
  • Constructor Details

    • BooleanTrend

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

      public BooleanTrend()
      Default constructor.
  • Method Details

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

      public void clearModel()
      Free any allocated resource and stop refreshing. The internal attribute list is released.
    • setModel

      public void setModel(fr.esrf.tangoatk.core.AttributePolledList list)
      This setModel which takes an AttributePolledList as a parameter, will just add the boolean scalar attributes in the list to the list viewer in the BooleanTrend. It will not add any of the attributes to the BooleanTrend. The list used by the BooleanTrend will be a copy of the given list. If you don't use the list anymore (the on given in parameter), remember to clean it, because this is not the list the BooleanTrand uses (it uses a copy of it)
      Parameters:
      list - an AttributePolledList value
    • addAttribute

      public void addAttribute(String name)
      addAttribute will add the IBooleanScalar to the BooleanTrend. Additional calls to addAttribute will add more IBooleanScalars to the BooleanTrend.
      Parameters:
      name - Attribute name
    • addAttribute

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

      public void removeAttribute(fr.esrf.tangoatk.core.IBooleanScalar scalar)
    • getModel

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

      public String getSettings()
      returns the configuration as string.
      Returns:
      Configuration string
      See Also:
    • 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:
    • 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.
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • 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()
      Determines whether or not device names (within chart labels) are visible.
      Returns:
      Showing device name flag
      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.IBooleanScalar 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 whether 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
      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()
    • resetTrend

      public void resetTrend()
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception