public class IlvMultiRepBehavior extends IlvSingleBehavior
IlvMultiRepBehavior
is used to set the graphic
representation of a group depending on an integer value. For example, a
prototype representing a switch could have two representations: one for the
"off" state and one for the "on" state.
Each representation is defined by the names of one or several elements.
Constructor and Description |
---|
IlvMultiRepBehavior(IlvInputStream in)
Reads the behavior from an
IlvInputStream stream. |
IlvMultiRepBehavior(IlvMultiRepBehavior source)
Creates a new behavior object by copying an existing one.
|
IlvMultiRepBehavior(String name,
Object[] representations)
Creates a new multi-representation behavior object.
|
Modifier and Type | Method and Description |
---|---|
IlvBehavior |
copy()
Returns a copy of the behavior.
|
Object[] |
getRepresentations()
Gets the
representations parameter of this behavior. |
boolean |
isReadable()
Returns
false |
protected void |
set(IlvGroup group,
String name,
Object value)
Shows the elements of the group
group designated by the
value -th element in the representations array
passed to the constructor. |
void |
setRepresentations(Object[] representations)
Sets the
representations 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, isWritable
public IlvMultiRepBehavior(String name, Object[] representations)
name
- the name of this behavior object.representations
- an array containing the names of the group elements that represent
each state. Each element of the representations
array
can be either a single String, or an array of Strings. In the
first case, the String is the name of the element that must be
shown for the corresponding state. In the second case, the String
array contains the names of several elements that must be shown
for the corresponding state. The value of the property to which
this behavior is attached is used as an index into the
representations
array. Thus, the first element (
representations[0]
) contains the name(s) of the group
element(s) that will be visible if the property's value is
0
.public IlvMultiRepBehavior(IlvMultiRepBehavior source)
source
- the behavior object to be copied.public IlvMultiRepBehavior(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
group
designated by the
value
-th element in the representations
array
passed to the constructor. The value
is converted to an
integer and is used as an index in the representations
array.
The array element is either a String or an array of Strings. The names
obtained are then used to retrieve the group elements by calls to the
findNode
method. If the group elements are found, they are
made visible by setting their visible
value to
true
. All the other elements specified by
representations
are made invisible.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, used as an index in the representation
array.IlvValueException
- if an error occurred while setting a property.IlvSingleBehavior.set(ilog.views.prototypes.IlvGroup,
java.lang.String[], java.lang.Object[], boolean[])
public void setRepresentations(Object[] representations)
representations
parameter of this behavior.public Object[] getRepresentations()
representations
parameter of this behavior.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.