public class IlvPrototypeBeanSupport extends Object implements IlvGraphicBag, IlvObjectInteractorContext, Serializable
This class provides support for the implementation of subclasses of
Component
which encapsulate prototype instances.
IlvPrototypeBeanSupport
is not meant to be used directly by
application developers. It is used as a supporting class for Java Bean
generated from prototypes.
The class IlvPrototypeBeanGenerator
generates Java Beans that
delegate most of their methods to an instance of
IlvPrototypeBeanSupport
.
This delegation mechanism allows the Bean generator to output different kinds of beans. A prototype bean can be:
java.awt.Component
),
java.awt.Panel
),
In addition, each Java Bean subclass will define property setters/getters for the prototype's public properties. Each bean will also define methods for adding and removing property change listeners for all the output properties of the prototype.
Modifier and Type | Field and Description |
---|---|
static long |
eventMask
The mask of events that will be enabled in the generated Java Beans.
|
Constructor and Description |
---|
IlvPrototypeBeanSupport(Component component)
Creates a new bean support object which provides the implementation of a
Java Bean for a prototype.
|
IlvPrototypeBeanSupport(Component component,
String prototypeName)
Creates a new bean support object which provides the implementation of a
Java Bean for a given prototype.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(IlvGraphic graphic,
boolean redraw)
Implementation of the
IlvGraphicBag interface. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener for any property.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Adds a property change listener for a named property.
|
void |
applyToObject(IlvGraphic graphic,
IlvApplyObject f,
Object arg,
boolean redraw)
Implementation of the
IlvGraphicBag interface. |
void |
ensureVisible(IlvPoint p)
Implementation of the
IlvObjectInteractorContext interface. |
Component |
getComponent()
Returns the bean to which this support object is associated.
|
Cursor |
getCursor()
Implementation of the
IlvObjectInteractorContext interface. |
Color |
getDefaultGhostColor()
Implementation of the
IlvObjectInteractorContext interface. |
Color |
getDefaultXORColor()
Implementation of the
IlvObjectInteractorContext interface. |
IlvGraphicBag |
getGraphicBag()
Implementation of
IlvGraphicBag interface. |
Graphics |
getGraphics()
Implementation of the
IlvObjectInteractorContext interface. |
IlvGrid |
getGrid()
Implementation of the
IlvObjectInteractorContext interface. |
IlvGroup |
getGroup()
Returns the group (usually an
IlvPrototypeInstance ) associated
with this prototype bean support object. |
IlvGraphic |
getObject(String name)
Implementation of the
IlvGraphicBag interface. |
IlvGraphicEnumeration |
getObjects()
Implementation of the
IlvGraphicBag interface. |
Dimension |
getPreferredSize()
Returns the size of the prototype instance's bounding box.
|
String |
getPrototypeName()
Returns the name of the prototype associated with this support object.
|
IlvTransformer |
getTransformer()
Implementation of the
IlvObjectInteractorContext interface. |
boolean |
isCursorSet()
Implementation of the
IlvObjectInteractorContext interface. |
void |
moveObject(IlvGraphic graphic,
double x,
double y,
boolean redraw)
Implementation of the
IlvGraphicBag interface. |
void |
paint(Graphics g)
Draws the elements of the prototype.
|
void |
processEvent(AWTEvent event)
Process events occurring on this bean.
|
void |
reDrawObj(IlvGraphic graphic)
Implementation of the
IlvGraphicBag interface. |
void |
reDrawRegion(IlvRegion region)
Implementation of the
IlvGraphicBag interface. |
void |
removeObject(IlvGraphic graphic,
boolean redraw)
Implementation of the
IlvGraphicBag interface. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener for any property.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a property change listener for a named property.
|
void |
repaint(IlvRect rect)
Implementation of the
IlvObjectInteractorContext interface. |
void |
reshapeObject(IlvGraphic obj,
IlvRect newrect,
boolean redraw)
Implementation of the
IlvGraphicBag interface. |
void |
setCursor(Cursor cursor)
Implementation of the
IlvObjectInteractorContext interface. |
boolean |
setObjectName(IlvGraphic graphic,
String name)
Implementation of the
IlvGraphicBag interface. |
void |
setPrototypeName(String prototypeName)
Creates a new instance of the prototype specified by the
prototypeName parameters and sets it as the new group
encapsulated by this support object. |
void |
snapToGrid(IlvPoint p)
Implementation of the
IlvObjectInteractorContext interface. |
public static long eventMask
public IlvPrototypeBeanSupport(Component component, String prototypeName)
component
- the Java Bean with which this support object is associated.prototypeName
- the name of the prototype, of the form
"libName.protoName"
. A new instance of this prototype
is created.public IlvPrototypeBeanSupport(Component component)
This constructor can be used to implement a generic bean which can
encapsulate any prototype. The setPrototypeName
method must be
called to choose a specific prototype.
component
- the Java Bean with which this support object is associated.public void paint(Graphics g)
This method is called from the associated bean's paint
method.
The graphic elements of the prototype instance encapsulated by this bean support object are drawn in an order that takes into account the relative layers of the elements.
public Dimension getPreferredSize()
This method is called from the associated bean's
getPreferredSize
method.
public void processEvent(AWTEvent event)
This method is called from the associated bean's processEvent
method.
Events are dispatched to the graphic elements that have an object interactor.
event
- the event to process.public void addObject(IlvGraphic graphic, boolean redraw)
IlvGraphicBag
interface. Do not call
this method directly.addObject
in interface IlvGraphicBag
graphic
- the graphic object.redraw
- if true
, the object is redrawn.public void removeObject(IlvGraphic graphic, boolean redraw)
IlvGraphicBag
interface. Do not call
this method directly.removeObject
in interface IlvGraphicBag
graphic
- the graphic object.redraw
- if true
, the object is redrawn.public IlvGraphicEnumeration getObjects()
IlvGraphicBag
interface. Do not call
this method directly.getObjects
in interface IlvGraphicBag
IlvGraphic
objects, or
null
.public void reDrawObj(IlvGraphic graphic)
IlvGraphicBag
interface. Do not call
this method directly.reDrawObj
in interface IlvGraphicBag
graphic
- the graphic object.public void reDrawRegion(IlvRegion region)
IlvGraphicBag
interface. Do not call
this method directly.reDrawRegion
in interface IlvGraphicBag
region
- the region to redraw.public void reshapeObject(IlvGraphic obj, IlvRect newrect, boolean redraw)
IlvGraphicBag
interface. Do not call
this method directly.reshapeObject
in interface IlvGraphicBag
obj
- The graphic object.newrect
- The new desired bounding rectangle.redraw
- If true
the object is redrawn.public void moveObject(IlvGraphic graphic, double x, double y, boolean redraw)
IlvGraphicBag
interface. Do not call
this method directly.moveObject
in interface IlvGraphicBag
graphic
- The graphic object.x
- The new desired x position.y
- The new desired y position.redraw
- If true
the object is redrawn.public void applyToObject(IlvGraphic graphic, IlvApplyObject f, Object arg, boolean redraw)
IlvGraphicBag
interface. Do not call
this method directly.applyToObject
in interface IlvGraphicBag
graphic
- the graphic object.f
- the method to apply.arg
- the arguments passed to f
.redraw
- if true the object is redrawn.public boolean setObjectName(IlvGraphic graphic, String name)
IlvGraphicBag
interface. Do not call
this method directly.setObjectName
in interface IlvGraphicBag
graphic
- The graphic object.name
- The new name.true
if the name can be changed.public IlvGraphic getObject(String name)
IlvGraphicBag
interface. Do not call
this method directly.getObject
in interface IlvGraphicBag
name
- The graphic object name.public IlvGraphicBag getGraphicBag()
IlvGraphicBag
interface. The method returns
null
.getGraphicBag
in interface IlvGraphicBag
public IlvTransformer getTransformer()
IlvObjectInteractorContext
interface. Do
not call this method directly.getTransformer
in interface IlvObjectInteractorContext
public void ensureVisible(IlvPoint p)
IlvObjectInteractorContext
interface. Do
not call this method directly.ensureVisible
in interface IlvObjectInteractorContext
p
- The point.public IlvGrid getGrid()
IlvObjectInteractorContext
interface. Do
not call this method directly.getGrid
in interface IlvObjectInteractorContext
null
if
there is no grid.IlvManagerView.getGrid()
public void snapToGrid(IlvPoint p)
IlvObjectInteractorContext
interface. Do
not call this method directly.snapToGrid
in interface IlvObjectInteractorContext
p
- The point to be snapped to the grid.IlvGrid
,
IlvGrid.snap(IlvPoint)
public Color getDefaultXORColor()
IlvObjectInteractorContext
interface. Do
not call this method directly.getDefaultXORColor
in interface IlvObjectInteractorContext
public Color getDefaultGhostColor()
IlvObjectInteractorContext
interface. Do
not call this method directly.getDefaultGhostColor
in interface IlvObjectInteractorContext
public void setCursor(Cursor cursor)
IlvObjectInteractorContext
interface. Do
not call this method directly.setCursor
in interface IlvObjectInteractorContext
cursor
- The cursor.public Cursor getCursor()
IlvObjectInteractorContext
interface. Do
not call this method directly.getCursor
in interface IlvObjectInteractorContext
public boolean isCursorSet()
IlvObjectInteractorContext
interface. Do
not call this method directly.isCursorSet
in interface IlvObjectInteractorContext
public Graphics getGraphics()
IlvObjectInteractorContext
interface. Do
not call this method directly.getGraphics
in interface IlvObjectInteractorContext
public void repaint(IlvRect rect)
IlvObjectInteractorContext
interface. Do
not call this method directly.repaint
in interface IlvObjectInteractorContext
rect
- The rectangular region.public Component getComponent()
public String getPrototypeName()
public void setPrototypeName(String prototypeName) throws IlvValueException, IlvReadFileException
prototypeName
parameters and sets it as the new group
encapsulated by this support object.prototypeName
- the prototype name. Prototype names are of the form
protolib.protoname
.IlvValueException
IlvReadFileException
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- the name of the property.listener
- the listener object.public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- the name of the property.listener
- the listener object.public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the listener object.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the listener object.public IlvGroup getGroup()
IlvPrototypeInstance
) associated
with this prototype bean support object.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.