public class IlvFillBehavior extends IlvSingleBehavior implements IlvInteractiveBehavior
IlvFillBehavior
class is used to partially fill a polygon.
It can be used to represent objects such as tanks, pipes, and so on.
This behavior object uses two graphic elements of the group: the "filled"
element and the "filler" element. Both elements must contain an instance of a
subclass of IlvPolyPoint
(usually two IlvPolygon
objects). The points of the filler element are recomputed so that it looks as
if the filled element was filled up to the specified ratio.
The angle
parameter specifies the angle of the boundary of the
filled surface. For example, you can fill an object from right to left using
an angle of 90 degrees.
IlvPolyPoints
,
IlvPolygon
,
Serialized FormConstructor and Description |
---|
IlvFillBehavior(IlvFillBehavior source)
Creates a new behavior object by copying an existing one.
|
IlvFillBehavior(IlvInputStream in)
Reads the behavior from an
IlvInputStream stream. |
IlvFillBehavior(String name,
String elementName,
String fillerElementName,
String angle)
Creates a new behavior to fill an element.
|
IlvFillBehavior(String name,
String elementName,
String fillerElementName,
String angle,
String valueMin,
String valueRange,
boolean dragAllowed,
String increment)
Creates a new behavior to fill an element.
|
Modifier and Type | Method and Description |
---|---|
protected void |
attach(IlvGroup group)
This method is overridden to set an
IlvGroupInteractor on the
translated element(s) to let the user drag the object with the mouse. |
IlvBehavior |
copy()
Returns a copy of the behavior.
|
protected Object |
get(IlvGroup group,
String name)
Returns the value of the behavior that corresponds to the current filling
ratio.
|
String |
getAngle()
Gets the
angle parameter. |
String |
getElementName()
Gets the
elementName parameter. |
String |
getFillerElementName()
Gets the
fillerElementName parameter. |
String |
getIncrement()
Returns the
increment parameter of this behavior. |
String |
getValueMin()
Gets the
valueMin parameter for this behavior object. |
String |
getValueRange()
Gets the
valueRange parameter for this behavior object. |
boolean |
isDragAllowed()
Returns the
dragAllowed parameter of this behavior. |
boolean |
processEvent(IlvGroup group,
IlvGraphicElement element,
AWTEvent event,
IlvObjectInteractorContext context)
Implementation of the
IlvInteractiveBehavior interface:
changes the fill level on mouse events. |
protected void |
set(IlvGroup group,
String name,
Object value)
Fills the element specified by the
elementName of the
constructor by modifying the points of the fillerElementName
element. |
void |
setAngle(String angle)
Sets the
angle parameter. |
void |
setDragAllowed(boolean dragAllowed)
Sets the
dragAllowed parameter of this behavior. |
void |
setElementName(String elementName)
Sets the
elementName parameter. |
void |
setFillerElementName(String fillerElementName)
Sets the
fillerElementName parameter. |
void |
setIncrement(String increment)
Sets the
increment parameter of this behavior. |
void |
setValueMin(String valueMin)
Sets the
valueMin parameter for this behavior object. |
void |
setValueRange(String valueRange)
Sets the
valueRange parameter for this behavior object. |
String |
toString()
Returns a short text describing this behavior object.
|
boolean |
useRangeAsMax()
Returns the
useRangeAsMax parameter of this behavior. |
void |
useRangeAsMax(boolean useRangeAsMax)
If
useRangeAsMax is true , the
valueRange parameter will be interpreted as the
maximum value instead of the value range. |
void |
write(IlvOutputStream out)
Writes the behavior to an
IlvOutputStream . |
get, getName, getValueNames, set, setName
detach, getParameter, isOutput, isReadable, isWritable
public IlvFillBehavior(String name, String elementName, String fillerElementName, String angle, String valueMin, String valueRange, boolean dragAllowed, String increment)
name
- the name of the behavior, which is the name of the value
representing the filling ratio.elementName
- the name of the element to be filled. The filled element must
contain an instance of a subclass of IlvPolyPoints
.fillerElementName
- the name of the element used to fill the element specified by
elementName
. This element must contain an instance of
a subclass of IlvPolyPoints
.angle
- the filling angle. This can be either a constant value (for
example, 90
) or an arithmetic expression containing
property names and/or constant values.valueMin
- the minimum value used to compute the filling ratio. This can be
either a constant value (for example, 0
) or an
arithmetic expression containing property names and/or constant
values.valueRange
- the value range used to compute the filling ratio. This can be
either a constant value (for example, 100
) or an
arithmetic expression containing property names and/or constant
values.dragAllowed
- if true
, the user can modify the filling level with
the mouse.increment
- specifies the minimum increment by which the filling level is
modified. The increment is in "value" units. For example, if
valueMin
is 0
, valueRange
is 100
and increment
is 20
,
the filling ratio can be set to 6 different levels corresponding
to the values 0, 20, 40, 60, 80 and 100. The
increment
parameter can be specified either as a
direct value, the name of another property, or an expression.public IlvFillBehavior(String name, String elementName, String fillerElementName, String angle)
This constructor calls the first constructor, with the following default parameter values:
valueMin = "0"
valueRange = "1"
dragAllowed = false
increment = "0"
name
- the name of the behavior, which is the name of the value
representing the filling ratio.elementName
- the name of the element to be filled. The filled element must
contain an instance of a subclass of IlvPolyPoints
.fillerElementName
- the name of the element used to fill the element specified by
elementName
. This element must contain an instance of
a subclass of IlvPolyPoints
.angle
- the filling angle. This can be either a constant value (for
example, 90
) or an arithmetic expression containing
property names and/or constant values.public IlvFillBehavior(IlvFillBehavior source)
source
- the behavior object to be copied.public IlvFillBehavior(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
elementName
of the
constructor by modifying the points of the fillerElementName
element.set
in class IlvSingleBehavior
group
- the group to which this behavior is attached.name
- the name of this behavior.value
- the new value used to compute the filler polygon. The filling
ratio (which is between 0 and 1) is computed using the formula:
ratio = (value - valueMin) / valueRange;
IlvValueException
- if a value error occurred.IlvSingleBehavior.set(ilog.views.prototypes.IlvGroup,
java.lang.String[], java.lang.Object[], boolean[])
protected Object get(IlvGroup group, String name) throws IlvValueException
get
in class IlvSingleBehavior
group
- the group to which this behavior is attached.name
- the name of this behavior.IlvValueException
- if a value error occurred.IlvSingleBehavior.get(ilog.views.prototypes.IlvGroup,
java.lang.String[], java.lang.Object[], boolean[])
protected void attach(IlvGroup group)
IlvGroupInteractor
on the
translated element(s) to let the user drag the object with the mouse.attach
in class IlvBehavior
group
- the group to which this behavior object is attached.IlvGroup.addBehavior(ilog.views.prototypes.IlvBehavior)
public void setElementName(String elementName)
elementName
parameter.public String getElementName()
elementName
parameter.public void setFillerElementName(String fillerElementName)
fillerElementName
parameter.public String getFillerElementName()
fillerElementName
parameter.public void setAngle(String angle)
angle
parameter.public String getAngle()
angle
parameter.public void setValueMin(String valueMin)
valueMin
parameter for this behavior object.public String getValueMin()
valueMin
parameter for this behavior object.public void setValueRange(String valueRange)
valueRange
parameter for this behavior object.public String getValueRange()
valueRange
parameter for this behavior object.public void setDragAllowed(boolean dragAllowed)
dragAllowed
parameter of this behavior.public boolean isDragAllowed()
dragAllowed
parameter of this behavior.public void useRangeAsMax(boolean useRangeAsMax)
useRangeAsMax
is true
, the
valueRange
parameter will be interpreted as the
maximum value instead of the value range.public boolean useRangeAsMax()
useRangeAsMax
parameter of this behavior.public void setIncrement(String increment)
increment
parameter of this behavior.public String getIncrement()
increment
parameter of this behavior.public boolean processEvent(IlvGroup group, IlvGraphicElement element, AWTEvent event, IlvObjectInteractorContext context)
IlvInteractiveBehavior
interface:
changes the fill level on mouse events.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.