adm
Class CButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Button
              |
              +--adm.CButton

public class CButton
extends java.awt.Button
implements CInterface, DeviceListener, java.awt.event.ActionListener

CButton is an awt-like Button widget. It does not post monitorOn but sets the device property to a specified value when pressed.

There is a stringValue and label text associated with the CButton. When the button is pressed, the device/property in the control system will be set to the user specified value (stringValue). The StringValue can be a String or numerical number, such as int, float or double depending on the nature of the device property. But it must be treated as a String and set through the setStringValue (String val) method. CButton is responsible to convert this StringValue to a correct data type prior to the set action. If the set command fails due to the convertion or a permission problem, the button will be disabled and the label color of the button will be set to red.

Since:
adm0.2
See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
CButton()
          Constructor
CButton(java.lang.String dName, java.lang.String pName)
          Constructor with device name and property name
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Send a value to the control system.
 void deviceChanged(DeviceEvent de)
          Check the error message back from device.set(..)
 java.lang.String getDeviceName()
          Return the device name to which this component is connected.
 java.lang.String getPropertyName()
          Return the device property name to which this component is connected.
 java.lang.String getStringValue()
          Return the the string/value associated with the button
 void setDeviceName(java.lang.String newName)
          Set the Device name
 void setPropertyName(java.lang.String newName)
          Set device property name
 void setStringValue(java.lang.String v)
          Set the value that gets sent to the control system when the button is pressed.
 
Methods inherited from class java.awt.Button
addActionListener, addNotify, getActionCommand, getLabel, removeActionListener, setActionCommand, setLabel
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CButton

public CButton()
Constructor

CButton

public CButton(java.lang.String dName,
               java.lang.String pName)
Constructor with device name and property name
Parameters:
dName - device name
pName - property name
Method Detail

setStringValue

public void setStringValue(java.lang.String v)
Set the value that gets sent to the control system when the button is pressed.
Parameters:
v - the string/value to send

getStringValue

public java.lang.String getStringValue()
Return the the string/value associated with the button

setDeviceName

public void setDeviceName(java.lang.String newName)
Set the Device name
Specified by:
setDeviceName in interface CInterface
Parameters:
newName - the name of device you want to connect

getDeviceName

public java.lang.String getDeviceName()
Return the device name to which this component is connected. If device name is not set, return empty string "".
Specified by:
getDeviceName in interface CInterface

setPropertyName

public void setPropertyName(java.lang.String newName)
Set device property name
Specified by:
setPropertyName in interface CInterface
Parameters:
newName - the name of device property to monitor

getPropertyName

public java.lang.String getPropertyName()
Return the device property name to which this component is connected. If property name is not set, return empty string "".
Specified by:
getPropertyName in interface CInterface

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Send a value to the control system.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

deviceChanged

public void deviceChanged(DeviceEvent de)
Check the error message back from device.set(..)
Specified by:
deviceChanged in interface DeviceListener