public class IlvCounterBehavior extends IlvSingleBehavior
IlvCounterBehavior
is used to increment a
specified value handled by a group. Each time the property handled by this behavior object is
set, another value, called a counter, is incremented by one
until a specified maximum value is reached. When this value is reached, the counter
is reset to zero.
This class is defined only for compatibility with Views C++ prototypes.
It should not be used when creating new prototypes. Instead, you should
use an IlvTriggerBehavior
object, and use the expression
"(source + 1) % max"
for the source value.IlvTriggerBehavior
,
Serialized FormConstructor and Description |
---|
IlvCounterBehavior(IlvCounterBehavior source)
Creates a new behavior object by copying an existing one.
|
IlvCounterBehavior(IlvInputStream in)
Reads the behavior from an
IlvInputStream stream. |
IlvCounterBehavior(String name,
String counter,
String max)
Creates a new counter behavior object.
|
Modifier and Type | Method and Description |
---|---|
IlvBehavior |
copy()
Returns a copy of the behavior.
|
String |
getCounter()
Gets the
counter parameter for this behavior object. |
String |
getMax()
Gets the
max parameter for this behavior object. |
boolean |
isReadable()
Returns
false |
protected void |
set(IlvGroup group,
String name,
Object value)
Increments the value contained in the
counter
parameter passed to the constructor. |
void |
setCounter(String counter)
Sets the
counter parameter for this behavior object. |
void |
setMax(String max)
Sets the
max parameter for this behavior object. |
String |
toString()
Returns a short text describing this behavior object.
|
void |
write(IlvOutputStream out)
Writes the behavior to an
IlvOutputStream . |
get, get, getName, getValueNames, set, setName
attach, detach, getParameter, isOutput, isWritable
public IlvCounterBehavior(String name, String counter, String max)
name
- the name of the behavior object.counter
- the name of the property used as a counter.max
- the maximum value of the counter. This value
can be either a direct value, the
name of another property, or an expression.public IlvCounterBehavior(IlvCounterBehavior source)
source
- the behavior object to be copied.public IlvCounterBehavior(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 IlvSingleBehavior
out
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public IlvBehavior copy()
copy
in class IlvBehavior
public String toString()
toString
in class IlvBehavior
public boolean isReadable()
false
isReadable
in class IlvBehavior
protected void set(IlvGroup group, String name, Object value) throws IlvValueException
counter
parameter passed to the constructor. When the counter value
equals the max
parameter given to the constructor,
it is reset to 0
.set
in class IlvSingleBehavior
group
- the group to which this behavior object is attached.name
- the name of this behavior object.value
- the new value. This value is ignored because setting the
value of the behavior object increments the counter regardless of the
actual value.IlvValueException
- if an error occurred while setting a property.IlvSingleBehavior.set(ilog.views.prototypes.IlvGroup,
java.lang.String[], java.lang.Object[], boolean[])
public void setCounter(String counter)
counter
parameter for this behavior object.public String getCounter()
counter
parameter for this behavior object.public void setMax(String max)
max
parameter for this behavior object.public String getMax()
max
parameter for this behavior object.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.