|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.opi.io.DefaultIOGroup
This class implements the IOGroup interface and implements a simple polling interface for IOItem values. Ie. if you set the group active this class will poll IOItems belonging to this group and report any changes in item values
Field Summary | |
protected boolean |
active
|
protected String |
description
|
protected Vector |
ioListeners
|
protected Vector |
items
|
protected String |
name
|
protected int |
updateRate
|
Constructor Summary | |
DefaultIOGroup(String name,
boolean active,
int updateRate)
Create a new DefaultIOGroup object. |
|
DefaultIOGroup(String name,
boolean active,
int updateRate,
String descr)
Create a new DefaultIOGroup object |
Method Summary | |
void |
addIOListener(IOListener l)
Add a listener for IO events related to this group |
void |
addItem(IOItem ioi)
Add an item to this group |
protected void |
finalize()
|
void |
fireAllItems()
Use this method to manually fire a onValueChanged() for all IOItems in this group. |
void |
fireAllItems(IOListener iol)
Use this method to manually fire a onValueChanged() for all IOItems in this group. |
void |
fireAllItems(IOListener iol,
boolean performRead,
int dataSource)
Use this method to manually fire a IOListener.onValueChanged(dk.opi.io.IOItem) notification to
the specified IOListener. |
void |
fireIOListenerOnValueChanged(IOItem oi)
Fire the onDataChanged event |
String |
getDescription()
Get descriptive text for this group |
IOItem |
getItem(String actionCmdName)
Return an IOItem from this group |
Vector |
getItems()
Return Vector of all IOItems currently added to this group. |
String |
getName()
Get the name of this group |
int |
getUpdateRate()
|
boolean |
isActive()
|
void |
readAllItems(int dataSource)
Read the item value for all items in this group. |
void |
removeIOListener(IOListener l)
Remove a listener for IO events related to this group |
void |
removeItem(IOItem ioi)
Remove an item from this group |
void |
setActive(boolean b)
Turn off/on automatical updating from the IOItems in this group depending on the value of b. |
void |
setDescription(String text)
Set descriptive text for this group |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient Vector ioListeners
protected transient Vector items
protected String name
protected boolean active
protected int updateRate
protected String description
Constructor Detail |
public DefaultIOGroup(String name, boolean active, int updateRate)
name
- name of the group. Must be unique within this serveractive
- if items in this group are going to be monitoredupdateRate
- requested update rate for items in this group in milli secondspublic DefaultIOGroup(String name, boolean active, int updateRate, String descr)
name
- name of the group. Must be unique within this serveractive
- if items in this group are going to be monitoredupdateRate
- requested update rate for items in this group in milli secondsdescr
- description of the group. Can be queried by a call to getDescription()Method Detail |
public void addItem(IOItem ioi)
addItem
in interface IOGroup
ioi
- The item to addpublic void removeItem(IOItem ioi) throws RbxIOException
removeItem
in interface IOGroup
ioi
- The item to remove
RbxIOException
- thrown if it was not possible to remove the specified item, for
instance if the specified item is not a member of this group.public IOItem getItem(String actionCmdName)
getItem
in interface IOGroup
actionCmdName
- Name of the item to return
public void fireIOListenerOnValueChanged(IOItem oi)
public void addIOListener(IOListener l)
addIOListener
in interface IOGroup
public void removeIOListener(IOListener l)
removeIOListener
in interface IOGroup
public Vector getItems()
getItems
in interface IOGroup
public int getUpdateRate()
getUpdateRate
in interface IOGroup
protected void finalize() throws Throwable
Throwable
public void setActive(boolean b)
setActive
in interface IOGroup
b
- if true IOItems in this group will fire the onValueChanged() event
everytime a value is changedpublic boolean isActive()
isActive
in interface IOGroup
public void fireAllItems()
fireAllItems
in interface IOGroup
public void fireAllItems(IOListener iol)
fireAllItems
in interface IOGroup
iol
- onValueChanged() is only fired for the specified IOListenerpublic void fireAllItems(IOListener iol, boolean performRead, int dataSource) throws RbxIOException
IOListener.onValueChanged(dk.opi.io.IOItem)
notification to
the specified IOListener. This method is usefull right after items have been added
to the group. A call to this method will initialize your application with the
current values.
fireAllItems
in interface IOGroup
iol
- the listener to notifyperformRead
- if true a read will be performed for all items in the group
prior to firing of the event. In combination with a dataSource value of
DEVICE_READ this will ensure that the onValueChanged() is fired with the most
recent and up to date value. Note: ignored in this default implementationdataSource
- The source to read from, ie. CACHE_READ or DEVICE_READ. Also see
IOItem.readValue(int)
. Note: ignored in this default implementation
RbxIOException
- Will only be thrown if performRead
is true and the read operation
for some reason failspublic void readAllItems(int dataSource) throws RbxIOException
readAllItems
in interface IOGroup
dataSource
- The source to read from, ie. IOItem.CACHE_READ or IOItem.DEVICE_READ.
A CACHE read will obtain the current value for the item from the device
server cache (eg. OPC server). This is fast but the value is only
updated with the specified update rate, ie. a CACHE read is accurate to
within the 'UpdateRate' of the group.RbxIOException
- thrown if one or more read operations failed.public String getName()
getName
in interface IOGroup
public void setDescription(String text)
setDescription
in interface IOGroup
text
- the description.getDescription()
public String getDescription()
getDescription
in interface IOGroup
setDescription(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |