public class IlvValueSource extends IlvGroupElement
IlvValueSource
is the base class of all objects that
generate values. Value sources can be connected to prototype instances in a
panel with the subscribe
method. They can also be included in
prototypes to enable them to generate values.
To generate a value (or a set of values), a value source calls the
pushValue
or pushValues
method of its superclass
IlvGroupElement
.
There are several predefined value source subclasses that generate time and random values at specified time intervals.
You can define specific value sources that send the values produced or acquired by your application to your graphic objects.
Modifier and Type | Field and Description |
---|---|
static int |
RUNNING
Specifies that a value source must start generating values.
|
static int |
STOPPED
Specifies that a value source must stop generating values and reset its
internal state, if any.
|
static int |
SUSPENDED
Specifies that a value source must stop generating values without resetting
its internal state.
|
Constructor and Description |
---|
IlvValueSource(IlvInputStream in)
Reads the value source from an
IlvInputStream stream. |
IlvValueSource(IlvValueSource source)
Creates a new value source object by copying an existing one.
|
IlvValueSource(String name)
Creates a new value source.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a
PropertyChangeListener to this value source. |
IlvGroupElement |
copy()
Returns a copy of the value source.
|
int |
getState()
Returns the current state of this value source.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a
PropertyChangeListener from this value source. |
protected void |
resume()
Called when the state of the value source changes from
SUSPENDED to RUNNING . |
protected void |
set(String[] names,
Object[] values,
boolean[] done)
Changes a set of properties for this value source.
|
void |
setState(int state)
Sets the state of this value source.
|
protected void |
start()
Called when the state of the value source changes from
STOPPED
to RUNNING . |
protected void |
stop()
Called when the state of the value source changes from the initial state to
STOPPED . |
protected void |
suspend()
Called when the state of the value source changes from the initial state to
SUSPENDED . |
void |
write(IlvOutputStream out)
Writes the value source to an
IlvOutputStream . |
applyTransform, applyTransform, boundingBox, boundingBox, get, get, get, getBoolean, getDouble, getFloat, getInt, getLong, getName, getParent, getRelativePath, getString, getSubscribers, getSubscriptionValues, getValueNames, isOutput, move, pushValue, pushValues, set, set, set, set, set, set, set, setName, subscribe, traverse, unsubscribe
public static final int STOPPED
public static final int RUNNING
public static final int SUSPENDED
public IlvValueSource(String name)
name
- the name of the property source.public IlvValueSource(IlvValueSource source)
source
- The object to be copied.public IlvValueSource(IlvInputStream in) throws IlvReadFileException
IlvInputStream
stream. This
constructor must be called by the input constructors of subclasses.in
- The input stream.IlvReadFileException
- if the stream format is not correct.public void write(IlvOutputStream out) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
write
in class IlvGroupElement
out
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.IlvGroup.write(ilog.views.io.IlvOutputStream)
public IlvGroupElement copy()
copy
in class IlvGroupElement
IlvGroup.copy(ilog.views.prototypes.IlvGroup)
public final void setState(int state)
RUNNING
, the start
method
is called if the current state is STOPPED
or the
resume
method is called if it is SUSPENDED
.
STOPPED
, the stop
method
is called.
SUSPENDED
, the suspend
method is called.
state
- the new state, which must be one of the fields
RUNNING
, STOPPED
or
SUSPENDED
.IllegalArgumentException
- if state
is not a valid state for the value
source.public final int getState()
RUNNING
,
STOPPED
or SUSPENDED
.protected void start()
STOPPED
to RUNNING
.protected void stop()
STOPPED
.protected void suspend()
SUSPENDED
.protected void resume()
SUSPENDED
to RUNNING
.public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to this value source. The
listeners are called when a property is changed for this value, either by a
call to one of the set
methods or when an object connected to
the source outputs a value.public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from this value source.protected void set(String[] names, Object[] values, boolean[] done) throws IlvValueException
This method is overridden from the superclass to call the property change listeners added to this value source.
names
- the names of the properties to set.values
- the new values.done
- an array of booleans indicating which values have been handled.IlvValueException
- if a value error occurred.addPropertyChangeListener(java.beans.PropertyChangeListener)
,
removePropertyChangeListener(java.beans.PropertyChangeListener)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.