adm
Class CCheckbox

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Checkbox
              |
              +--adm.CCheckbox

public class CCheckbox
extends java.awt.Checkbox
implements CInterface, DeviceListener, java.awt.event.ItemListener

CCheckbox is an awt-like Checkbox widget. It only works with the device/property with boolean value or the two state Enum type. If the data type is not right, the checkbox label will be set to "Error!!!" and there is no action occur.

By default the widget has no label. Call the setLabel(String label) method, can add the label to the CCheckbox widget.

The device name and property name must be set using setDeviceName and setPropertyName or the correct constructor CCheckbox(String dname, String pname).

If the current state is true or 1 (second Enum state), the checkbox is be checked (on). Otherwise is not be checked (off). Clicking on check box widget set its state from "on" to "off," or from "off" to "on." If the set operation failed, the checkbox will back to the original state.

Since:
adm1.0
See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
CCheckbox()
          Constructor
CCheckbox(java.lang.String dName, java.lang.String pName)
          Constructor with device name and property name
 
Method Summary
 void deviceChanged(DeviceEvent event)
          First call back to check the device-property type, there is no action occurs if none boolean data type.
 java.lang.String getDeviceName()
          Return the device name to which this component is connected.
 java.lang.String getLabel()
           
 java.lang.String getPropertyName()
          Return the device property name to which this component is connected.
 void itemStateChanged(java.awt.event.ItemEvent evt)
          Set the change back to control system and monitor the result.
 void setDeviceName(java.lang.String newName)
          Set the Device name
 void setLabel(java.lang.String newLabel)
           
 void setPropertyName(java.lang.String newName)
          Set device property name
 
Methods inherited from class java.awt.Checkbox
addItemListener, addNotify, getCheckboxGroup, getSelectedObjects, getState, removeItemListener, setCheckboxGroup, setState
 
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

CCheckbox

public CCheckbox()
Constructor

CCheckbox

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

setLabel

public void setLabel(java.lang.String newLabel)
Overrides:
setLabel in class java.awt.Checkbox

getLabel

public java.lang.String getLabel()
Overrides:
getLabel in class java.awt.Checkbox

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 you want to connect

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

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent evt)
Set the change back to control system and monitor the result. if fail it will back to original state
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

deviceChanged

public void deviceChanged(DeviceEvent event)
First call back to check the device-property type, there is no action occurs if none boolean data type. For the monitorOn call back, reset the checkbox state and reset the label if user don't set the label
Specified by:
deviceChanged in interface DeviceListener