ilog.views.prototypes
Class IlvPrototypeBeanSupport

java.lang.Object
  extended by ilog.views.prototypes.IlvPrototypeBeanSupport
All Implemented Interfaces:
IlvGraphicBag, IlvObjectInteractorContext, Serializable

public class IlvPrototypeBeanSupport
extends Object
implements IlvGraphicBag, IlvObjectInteractorContext, Serializable

Support for beans generated from prototypes.

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:

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.

See Also:
IlvGroup, IlvPrototype, IlvPrototypeInstance, IlvPrototypeBeanGenerator, Serialized Form

Field Summary
static long eventMask
          The mask of events that will be enabled in the generated Java Beans.
 
Constructor Summary
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.
 
Method Summary
 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, float x, float 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventMask

public static long eventMask
The mask of events that will be enabled in the generated Java Beans.

Constructor Detail

IlvPrototypeBeanSupport

public IlvPrototypeBeanSupport(Component component,
                               String prototypeName)
Creates a new bean support object which provides the implementation of a Java Bean for a given prototype.

Parameters:
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.

IlvPrototypeBeanSupport

public IlvPrototypeBeanSupport(Component component)
Creates a new bean support object which provides the implementation of a Java Bean for a prototype.

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.

Parameters:
component - the Java Bean with which this support object is associated.
Method Detail

paint

public void paint(Graphics g)
Draws the elements of the prototype.

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.


getPreferredSize

public Dimension getPreferredSize()
Returns the size of the prototype instance's bounding box.

This method is called from the associated bean's getPreferredSize method.


processEvent

public void processEvent(AWTEvent event)
Process events occurring on this bean.

This method is called from the associated bean's processEvent method.

Events are dispatched to the graphic elements that have an object interactor.

Parameters:
event - the event to process.

addObject

public void addObject(IlvGraphic graphic,
                      boolean redraw)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
addObject in interface IlvGraphicBag
Parameters:
graphic - the graphic object.
redraw - if true, the object is redrawn.

removeObject

public void removeObject(IlvGraphic graphic,
                         boolean redraw)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
removeObject in interface IlvGraphicBag
Parameters:
graphic - the graphic object.
redraw - if true, the object is redrawn.

getObjects

public IlvGraphicEnumeration getObjects()
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
getObjects in interface IlvGraphicBag
Since:
JViews 5.0

reDrawObj

public void reDrawObj(IlvGraphic graphic)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
reDrawObj in interface IlvGraphicBag
Parameters:
graphic - the graphic object.

reDrawRegion

public void reDrawRegion(IlvRegion region)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
reDrawRegion in interface IlvGraphicBag
Parameters:
region - the region to redraw.

reshapeObject

public void reshapeObject(IlvGraphic obj,
                          IlvRect newrect,
                          boolean redraw)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
reshapeObject in interface IlvGraphicBag
Parameters:
obj - The graphic object.
newrect - The new desired bounding rectangle.
redraw - If true the object is redrawn.

moveObject

public void moveObject(IlvGraphic graphic,
                       float x,
                       float y,
                       boolean redraw)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
moveObject in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
x - The new desired x position.
y - The new desired y position.
redraw - If true the object is redrawn.

applyToObject

public void applyToObject(IlvGraphic graphic,
                          IlvApplyObject f,
                          Object arg,
                          boolean redraw)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
applyToObject in interface IlvGraphicBag
Parameters:
graphic - the graphic object.
f - the method to apply.
arg - the arguments passed to f.
redraw - if true the object is redrawn.

setObjectName

public boolean setObjectName(IlvGraphic graphic,
                             String name)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
setObjectName in interface IlvGraphicBag
Parameters:
graphic - The graphic object.
name - The new name.
Returns:
true if the name can be changed.

getObject

public IlvGraphic getObject(String name)
Implementation of the IlvGraphicBag interface. Do not call this method directly.

Specified by:
getObject in interface IlvGraphicBag
Parameters:
name - The graphic object name.

getGraphicBag

public IlvGraphicBag getGraphicBag()
Implementation of IlvGraphicBag interface. The method returns null.

Specified by:
getGraphicBag in interface IlvGraphicBag
Since:
JViews 5.0

getTransformer

public IlvTransformer getTransformer()
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
getTransformer in interface IlvObjectInteractorContext

ensureVisible

public void ensureVisible(IlvPoint p)
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
ensureVisible in interface IlvObjectInteractorContext
Parameters:
p - The point.

getGrid

public IlvGrid getGrid()
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
getGrid in interface IlvObjectInteractorContext
Returns:
The grid, or null if there is no grid.
Since:
JViews 5.0
See Also:
IlvManagerView.getGrid()

snapToGrid

public void snapToGrid(IlvPoint p)
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
snapToGrid in interface IlvObjectInteractorContext
Parameters:
p - The point to be snapped to the grid.
See Also:
IlvGrid, IlvGrid.snap(IlvPoint)

getDefaultXORColor

public Color getDefaultXORColor()
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
getDefaultXORColor in interface IlvObjectInteractorContext

getDefaultGhostColor

public Color getDefaultGhostColor()
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
getDefaultGhostColor in interface IlvObjectInteractorContext

setCursor

public void setCursor(Cursor cursor)
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
setCursor in interface IlvObjectInteractorContext
Parameters:
cursor - The cursor.

getCursor

public Cursor getCursor()
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
getCursor in interface IlvObjectInteractorContext

isCursorSet

public boolean isCursorSet()
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
isCursorSet in interface IlvObjectInteractorContext
Since:
JViews 8.0

getGraphics

public Graphics getGraphics()
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
getGraphics in interface IlvObjectInteractorContext

repaint

public void repaint(IlvRect rect)
Implementation of the IlvObjectInteractorContext interface. Do not call this method directly.

Specified by:
repaint in interface IlvObjectInteractorContext
Parameters:
rect - The rectangular region.
Since:
JViews 5.0

getComponent

public Component getComponent()
Returns the bean to which this support object is associated.


getPrototypeName

public String getPrototypeName()
Returns the name of the prototype associated with this support object.


setPrototypeName

public void setPrototypeName(String prototypeName)
                      throws IlvValueException,
                             IlvReadFileException
Creates a new instance of the prototype specified by the prototypeName parameters and sets it as the new group encapsulated by this support object.

Parameters:
prototypeName - the prototype name. Prototype names are of the form protolib.protoname.
Throws:
IlvValueException
IlvReadFileException

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Adds a property change listener for a named property.

Parameters:
propertyName - the name of the property.
listener - the listener object.

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Removes a property change listener for a named property.

Parameters:
propertyName - the name of the property.
listener - the listener object.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener for any property.

Parameters:
listener - the listener object.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener for any property.

Parameters:
listener - the listener object.

getGroup

public IlvGroup getGroup()
Returns the group (usually an IlvPrototypeInstance) associated with this prototype bean support object.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.