public class IlvConditionBehavior extends IlvSingleBehavior
IlvConditionBehavior
class is used to set a property
depending on a condition.Constructor and Description |
---|
IlvConditionBehavior(IlvConditionBehavior source)
Creates a new behavior object by copying an existing one.
|
IlvConditionBehavior(IlvInputStream in)
Reads the behavior from an
IlvInputStream stream. |
IlvConditionBehavior(String name,
String expression,
String target,
String ifTrue,
String ifFalse)
Creates a new condition behavior.
|
Modifier and Type | Method and Description |
---|---|
IlvBehavior |
copy()
Returns a copy of the behavior.
|
String |
getExpression()
Gets the
expression parameter. |
String |
getIfFalse()
Gets the
ifFalse parameter. |
String |
getIfTrue()
Gets the
ifTrue parameter of this behavior. |
String |
getTarget()
Gets the
target parameter. |
protected void |
set(IlvGroup group,
String name,
Object value)
Tests the condition defined by the
expression
argument passed to the constructor. |
void |
setExpression(String expression)
Sets the
expression parameter. |
void |
setIfFalse(String ifFalse)
Sets the
ifFalse parameter. |
void |
setIfTrue(String ifTrue)
Sets the
ifTrue parameter. |
void |
setTarget(String target)
Sets the
target parameter of this behavior. |
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, isReadable, isWritable
public IlvConditionBehavior(String name, String expression, String target, String ifTrue, String ifFalse)
name
- the name of the behavior object.expression
- the condition expression. The expression
is evaluated and the result is converted to a boolean
.
If the result is true
, the target
property is set to the value of ifTrue
. Otherwise,
it is set to the value of ifFalse
.target
- the name of the property that will be set depending on the
result of the test.ifTrue
- the value that is assigned to target
if the
test returns true
. This value
can be either a direct value, the
name of another property, or an expression.
ifTrue
can also be the empty String ""
to indicate that the target
property must not be
set if the condition expression evaluates to true
.ifFalse
- the value that is assigned to target
if the
test returns false
. This value
can be either a direct value, the
name of another property, or an expression.
ifFalse
can also be the empty String ""
to indicate that the target
property must not be
set if the condition expression evaluates to false
.public IlvConditionBehavior(IlvConditionBehavior source)
source
- the behavior object to be copied.public IlvConditionBehavior(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
protected void set(IlvGroup group, String name, Object value) throws IlvValueException
expression
argument passed to the constructor. If the result is true
,
the value specified by the target
parameter of
the constructor is set to ifTrue
. Otherwise, it is
set to ifFalse
.set
in class IlvSingleBehavior
group
- the group to which the behavior object is attached.name
- the name of the behavior object.value
- the new value for which the condition is tested.IlvValueException
- if an error occurred while setting a property.IlvSingleBehavior.set(ilog.views.prototypes.IlvGroup,
java.lang.String[], java.lang.Object[], boolean[])
public void setExpression(String expression)
expression
parameter.public String getExpression()
expression
parameter.public void setTarget(String target)
target
parameter of this behavior.public String getTarget()
target
parameter.public void setIfTrue(String ifTrue)
ifTrue
parameter.public String getIfTrue()
ifTrue
parameter of this behavior.public void setIfFalse(String ifFalse)
ifFalse
parameter.public String getIfFalse()
ifFalse
parameter.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.