public class IlvInheritBehavior extends IlvBehavior implements IlvInteractiveBehavior
IlvInheritBehavior
makes it possible for various
groups (or prototypes) to share behavior objects. When an inherit behavior
object is added to a group, the group inherits from all the behavior objects
of the specified group.
This class allows you to define complex behaviors that can be reused by various groups that have different graphic appearances.
IlvPrototype
,
Serialized FormConstructor and Description |
---|
IlvInheritBehavior(IlvGroup group)
Creates a new inherit behavior object.
|
IlvInheritBehavior(IlvInheritBehavior source)
Creates a new behavior object by copying an existing one.
|
IlvInheritBehavior(IlvInputStream in)
Reads the behavior from an
IlvInputStream stream. |
IlvInheritBehavior(String prototypeName)
Creates a new inherit behavior object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
attach(IlvGroup group)
Called when this behavior object is added to the specified group.
|
IlvBehavior |
copy()
Returns a copy of the behavior.
|
protected void |
detach(IlvGroup group)
Called when this behavior object is removed from the specified group.
|
protected void |
get(IlvGroup group,
String[] names,
Object[] values,
boolean[] done)
Calls the
get method of all the behavior objects associated
with the group specified by the group parameter passed to the
constructor. |
String |
getPrototypeName()
Returns the name of the prototype from which the behaviors are inherited.
|
String[] |
getValueNames(IlvGroup group)
Returns the names of the properties inherited from the group specified by
the
group parameter passed to the constructor. |
boolean |
processEvent(IlvGroup group,
IlvGraphicElement element,
AWTEvent event,
IlvObjectInteractorContext context)
Implementation of the
IlvInteractiveBehavior interface. |
protected void |
set(IlvGroup group,
String[] names,
Object[] values,
boolean[] done)
Calls the
set method of all the behavior objects associated
with the group specified by the group parameter passed to the
constructor. |
void |
setPrototypeName(String prototypeName)
Sets the prototype from which the behavior objects are inherited.
|
String |
toString()
Returns a short text describing this behavior object.
|
void |
write(IlvOutputStream out)
Writes the behavior to an
IlvOutputStream . |
getParameter, isOutput, isReadable, isWritable, setName
public IlvInheritBehavior(IlvGroup group)
group
- the group from which the behavior objects are inherited.public IlvInheritBehavior(String prototypeName)
prototypeName
- the name of the prototype from which the behavior objects are
inherited. The name must be of the form
library_name.prototype_name
.public IlvInheritBehavior(IlvInheritBehavior source)
source
- The behavior object to be copied.public IlvInheritBehavior(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 IlvBehavior
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 attach(IlvGroup group)
attach
in class IlvBehavior
group
- the group to which this behavior object is attached.IlvGroup.addBehavior(ilog.views.prototypes.IlvBehavior)
protected void detach(IlvGroup group)
detach
in class IlvBehavior
group
- the group to which this behavior object is attached.IlvGroup.removeBehavior(ilog.views.prototypes.IlvBehavior)
protected void set(IlvGroup group, String[] names, Object[] values, boolean[] done) throws IlvValueException
set
method of all the behavior objects associated
with the group specified by the group
parameter passed to the
constructor.set
in class IlvBehavior
group
- the group to which this behavior object is attached.names
- the names of the properties to be set.values
- the objects containing the new values.done
- an array of boolean values indicating which properties were
successfully set.IlvValueException
- if an error occurred while changing the values.IlvSingleBehavior.set(ilog.views.prototypes.IlvGroup,
java.lang.String, java.lang.Object)
protected void get(IlvGroup group, String[] names, Object[] values, boolean[] done) throws IlvValueException
get
method of all the behavior objects associated
with the group specified by the group
parameter passed to the
constructor.get
in class IlvBehavior
group
- the group to which this behavior object is attached.names
- the names of the properties to be retrieved.values
- the array where the objects containing the values will be stored.done
- an array of boolean values indicating which properties were
successfully read.IlvValueException
- if an error occurred while reading the values.IlvSingleBehavior.get(ilog.views.prototypes.IlvGroup,
java.lang.String)
public String[] getValueNames(IlvGroup group) throws IlvValueException
group
parameter passed to the constructor.getValueNames
in class IlvBehavior
group
- the group to which the behavior object is attached.IlvValueException
- if an error occurred while reading a property.public void setPrototypeName(String prototypeName)
prototypeName
- the name of a prototype. This name has the following format:
library.prototype
.public String getPrototypeName()
library.prototype
.public boolean processEvent(IlvGroup group, IlvGraphicElement element, AWTEvent event, IlvObjectInteractorContext context)
IlvInteractiveBehavior
interface.
Forwards the events to the behavior objects inherited from the prototype.processEvent
in interface IlvInteractiveBehavior
group
- the group containing the element in which the event occurred.element
- the graphic element in which the event occurred.event
- the event, which can be a MouseEvent
or a
KeyEvent
.context
- the interactor context, which can be used to get the view
transformer.true
if the event was actually processed, or
false
if the event was ignored.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.