Class SimpleEnumScalarViewer

All Implemented Interfaces:
fr.esrf.tangoatk.core.IAttributeStateListener, fr.esrf.tangoatk.core.IEnumScalarListener, fr.esrf.tangoatk.core.IErrorListener, JDrawable, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, Scrollable, SwingConstants

public class SimpleEnumScalarViewer extends JAutoScrolledText implements fr.esrf.tangoatk.core.IEnumScalarListener, fr.esrf.tangoatk.core.IErrorListener, JDrawable
A light weigth viewer which display an enumerated scalar attribute (EnumScalar). Here is an example of use:
 fr.esrf.tangoatk.core.AttributeList attributeList = new fr.esrf.tangoatk.core.AttributeList();
 SimpleEnumScalarViewer  = new SimpleEnumScalarViewer();
 IEnumScalar model = (IEnumScalar) attributeList.add("jlp/test/1/Att_six");
 senv.setModel(model);
 attributeList.startRefresher();
 
See Also:
  • Constructor Details

    • SimpleEnumScalarViewer

      public SimpleEnumScalarViewer()
      Contructs a SimpleEnumScalar viewer.
  • Method Details

    • setInvalidText

      public void setInvalidText(String s)
      Set the text which will be displayed in case of error or INVALID quality.
      Parameters:
      s - Text to be displayed.
    • getInvalidText

      public String getInvalidText()
      Returns the current text which is displayed in case of error.
      Returns:
      Invalid text
      See Also:
    • getBackgroundColor

      public Color getBackgroundColor()
      Returns:
      the current background color of this viewer. Color used for the VALID attribute quality state
    • setBackgroundColor

      public void setBackgroundColor(Color bg)
      Sets the 'VALID' background color of this viewer. Color used for the VALID attribute quality state.
      Parameters:
      bg - Background color.
      See Also:
    • setAlarmEnabled

      public void setAlarmEnabled(boolean b)
      Enables or disables alarm background (represents the attribute quality factor).
      Parameters:
      b - True to enable alarm.
      See Also:
    • isAlarmEnabled

      public boolean isAlarmEnabled()
      Returns:
      whether the background color is overrided by the quality factor.
      See Also:
    • getModel

      public fr.esrf.tangoatk.core.IEnumScalar getModel()
    • setModel

      public void setModel(fr.esrf.tangoatk.core.IEnumScalar enumeration)
      Sets the model for this viewer.
      Parameters:
      enumeration - model
    • clearModel

      public void clearModel()
      Clears all model and listener attached to the component
    • enumScalarChange

      public void enumScalarChange(fr.esrf.tangoatk.core.EnumScalarEvent evt)
      Specified by:
      enumScalarChange in interface fr.esrf.tangoatk.core.IEnumScalarListener
    • 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
    • getHasToolTip

      public boolean getHasToolTip()
      getHasToolTip returns true if the viewer has a tooltip (attribute full name)
      Returns:
      a boolean value
    • setHasToolTip

      public void setHasToolTip(boolean b)
      setHasToolTip display or not a tooltip for this viewer
      Parameters:
      b - If True the attribute full name will be displayed as tooltip for the viewer
    • getQualityInTooltip

      public boolean getQualityInTooltip()
      getQualityInTooltip returns true if the attribute quality factor is displayed inside the viewer's tooltip
      Returns:
      a boolean value
    • setQualityInTooltip

      public void setQualityInTooltip(boolean b)
      setQualityInTooltip display or not the attribute quality factor inside the tooltip
      Parameters:
      b - If True the attribute quality factor will be displayed inside the tooltip.
    • 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.
    • main

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