Class StateViewer

All Implemented Interfaces:
fr.esrf.tangoatk.core.IAttributeStateListener, fr.esrf.tangoatk.core.IDevStateScalarListener, fr.esrf.tangoatk.core.IErrorListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class StateViewer extends JPanel implements fr.esrf.tangoatk.core.IDevStateScalarListener
State State is a viewer to surveil and attribute of type DevState. Normally one connects the device with the viewer like this:
IEntity ie =attributeList.add("mydeviceName/StateAtt"); // some method to obtain the state attribute. DevStateScalar stateAtt = (DevStateScalar) stateAtt; fr.esrf.tangoatk.widget.attribute.StateViewer statev = new StateViewer(); statev.setModel(stateAtt);
See Also:
  • Constructor Details

    • StateViewer

      public StateViewer()
  • Method Details

    • clearModel

      public void clearModel()
    • setModel

      public void setModel(fr.esrf.tangoatk.core.IDevStateScalar stateAtt)
      setModel sets the model of this viewer. If the textLabel property is not set, the name of the devState attribute is shown on the textLabel.
      Parameters:
      stateAtt - a DevStateScalar to surveil
    • setToolTipText

      public void setToolTipText(String text)
      Sets the tooltip text for this component
      Overrides:
      setToolTipText in class JComponent
      Parameters:
      text - Tooltip text
    • getModel

      public fr.esrf.tangoatk.core.IDevStateScalar getModel()
      getModel gets the model of this stateviewer.
      Returns:
      a DevStateScalar value
    • setLabel

      public void setLabel(String label)
      setLabel set the text of the label. The default value is to show the name of the devState attribute.
      Parameters:
      label - a String value
    • getLabel

      public String getLabel()
    • setLabelVisible

      public void setLabelVisible(boolean visible)
      setLabelVisisble makes the label visible or not.
      Parameters:
      visible - a boolean value
    • isLabelVisible

      public boolean isLabelVisible()
      isLabelVisible returns the visibility of the label
      Returns:
      a boolean value
    • getUseDeviceAlias

      public boolean getUseDeviceAlias()
      getUseDeviceAlias returns true if the device alias is displayed instead of device name
      Returns:
      a boolean value
    • setUseDeviceAlias

      public void setUseDeviceAlias(boolean b)
      setUseDeviceAlias use or not use device alias
      Parameters:
      b - True to enable the usage of device alias.
    • setStateVisible

      public void setStateVisible(boolean visible)
      setStateVisible makes the state value lable visible or not.
      Parameters:
      visible - a boolean value
    • isStateVisible

      public boolean isStateVisible()
      isStateVisible returns the visibility of the state value label
      Returns:
      a boolean value
    • getStateInTooltip

      public boolean getStateInTooltip()
      getStateInTooltip returns true if the device state is displayed inside the viewer's tooltip
      Returns:
      a boolean value
    • setStateInTooltip

      public void setStateInTooltip(boolean b)
      setStateInTooltip display or not the device state inside the tooltip
      Parameters:
      b - If True the device state will be displayed inside the tooltip.
    • stateChange

      public void stateChange(fr.esrf.tangoatk.core.AttributeStateEvent e)
      stateChange inherited from IAttributeStateListener called when the attribute quality factor changes.
      Specified by:
      stateChange in interface fr.esrf.tangoatk.core.IAttributeStateListener
      Parameters:
      e - A AttributeStateEvent value
    • devStateScalarChange

      public void devStateScalarChange(fr.esrf.tangoatk.core.DevStateScalarEvent evt)
      Specified by:
      devStateScalarChange in interface fr.esrf.tangoatk.core.IDevStateScalarListener
    • errorChange

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

      public String getCurrentState()
      getCurrentState
      Returns:
      a String value presenting the current value of the DevStateScalar attribute
    • setStateText

      public void setStateText(String text)
      setStateText sets the text on the colored state box
      Parameters:
      text - a String value
    • getStateText

      public String getStateText()
      getStateText gets the text that is on the colored state box
      Returns:
      a String value
    • setStateFont

      public void setStateFont(Font font)
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent
    • getStateFont

      public Font getStateFont()
    • setStateForeground

      public void setStateForeground(Color color)
    • getStateForeground

      public Color getStateForeground()
    • setForeground

      public void setForeground(Color color)
      Overrides:
      setForeground in class JComponent
    • setStateHorizontalAlignment

      public void setStateHorizontalAlignment(int i)
      setStateHorizontalAlignement
      Parameters:
      i - an int value
      See Also:
    • getStateHorizontalAlignment

      public int getStateHorizontalAlignment()
    • setStatePreferredSize

      public void setStatePreferredSize(Dimension dimension)
    • getStatePreferredSize

      public Dimension getStatePreferredSize()
    • setStateBorder

      public void setStateBorder(Border border)
    • getStateBorder

      public Border getStateBorder()
    • main

      public static void main(String[] args)