com.sun.rave.designtime
Interface DesignInfo

All Superinterfaces:
DesignBeanListener, java.util.EventListener
All Known Subinterfaces:
MarkupDesignInfo
All Known Implementing Classes:
BasicDesignInfo

public interface DesignInfo
extends DesignBeanListener

The DesignInfo interface is another type of BeanInfo interface to provide more live design- time functionality for a JavaBean. BeanInfo represents static meta-data about a JavaBean, while DesignInfo provides dynamic design-time behavior.

To provide a DesignInfo for a JavaBean, a component author must provide an implementation of the DesignInfo interface available at design-time that matches the name of the JavaBean class with "DesignInfo" appended to it.

For example, a component author may supply a JavaBean class named 'com.company.Donkey', and may also supply a corresponding 'com.company.DonkeyBeanInfo' (implements BeanInfo) as well as 'com.company.DonkeyDesignInfo' (implements DesignInfo). Note that these cannot be the same class, as there is no gaurantee that the supplied BeanInfo class will be the same instance that is used in the designer - typically, a BeanInfo class is 'deep-copied' into another instance inside of an IDE.

IMPLEMENTED BY THE COMPONENT AUTHOR - This interface is designed to be implemented by the component (bean) author. BasicDesignInfo is supplied for convenience for subclassing.

Version:
1.0
Author:
Joe Nuxoll
See Also:
BasicDesignInfo

Method Summary
 Result beanCreatedSetup(DesignBean designBean)
          Provides an opportunity for a DesignInfo to setup the initial state of a newly created bean.
 Result beanDeletedCleanup(DesignBean designBean)
          Provides an opportunity for a DesignInfo to cleanup just before a bean gets deleted.
 Result beanPastedSetup(DesignBean designBean)
          Provides an opportunity for a DesignInfo to fix-up the state of a pasted bean.
 boolean canLinkBeans(DesignBean targetBean, DesignBean sourceBean, java.lang.Class sourceClass)
          This method is called when an object from a design surface or palette is being dragged 'over' a JavaBean type handled by this DesignInfo.
 java.lang.Class getBeanClass()
          Returns the class type of the JavaBean that this DesignInfo was designed to work with
 DisplayAction[] getContextItems(DesignBean designBean)
          Returns the list (or hierarchy) of items to be included in a right-click context menu for this bean at design-time.
 Result linkBeans(DesignBean targetBean, DesignBean sourceBean)
          This method is called when an object from a design surface or palette has been dropped 'on' a JavaBean type handled by this DesignInfo (to establish a link).
 
Methods inherited from interface com.sun.rave.designtime.DesignBeanListener
beanChanged, beanContextActivated, beanContextDeactivated, eventChanged, propertyChanged
 

Method Detail

beanCreatedSetup


public Result beanCreatedSetup(DesignBean designBean)
Provides an opportunity for a DesignInfo to setup the initial state of a newly created bean. Anything can be done here, including property settings, event hooks, and even the creation of other ancillary beans within the context. Note that this method is only called once after the component has been first created from the palette.

Parameters:
designBean - The bean that was just created
Returns:
A Result object, indicating success or failure and including messages for the user

beanDeletedCleanup


public Result beanDeletedCleanup(DesignBean designBean)
Provides an opportunity for a DesignInfo to cleanup just before a bean gets deleted. Anything can be done here, including property settings, event hooks, and even the creation/deletion of other ancillary beans within the context. Note, however, that this DesignBean will be deleted immediately upon the return of this method. This is intended for cleanup of ancillary items created in 'beanCreated'.

Parameters:
designBean - The bean that is about to be deleted
Returns:
A Result object, indicating success or failure and including messages for the user

beanPastedSetup


public Result beanPastedSetup(DesignBean designBean)
Provides an opportunity for a DesignInfo to fix-up the state of a pasted bean. Anything can be done here, including property settings, event hooks, and even the creation of other ancillary beans within the context.

Parameters:
designBean - The bean that was just pasted from the clipboard
Returns:
A Result object, indicating success or failure and including messages for the user

canLinkBeans


public boolean canLinkBeans(DesignBean targetBean,
                            DesignBean sourceBean,
                            java.lang.Class sourceClass)
This method is called when an object from a design surface or palette is being dragged 'over' a JavaBean type handled by this DesignInfo. If the 'sourceBean' or 'sourceClass' is of interest to the 'targetBean' instance (they can be "linked"), this method should return true. The user will then be presented with visual cues that this is an appropriate place to 'drop' the item and establish a link. If the user decides to drop the item on this targetBean, the 'linkBeans' method will be called. Note that the 'sourceBean' argument may be null if this drag operation is originating from the palette, because an instance of the bean will not have been created yet.

Parameters:
targetBean - The DesignBean instance that the user is 'hovering' the mouse over
sourceBean - The DesignBean instance that the user may potentially 'drop' to link - may be null if this drag operation originated from the palette, because the instance will not have been created yet
sourceClass - The class type of the object that the user may potentially 'drop' to link
Returns:
true if the 'targetBean' cares to have the 'sourceBean' or an instance of type 'sourceClass' linked to it, false if not
See Also:
linkBeans(DesignBean, DesignBean)

getBeanClass


public java.lang.Class getBeanClass()
Returns the class type of the JavaBean that this DesignInfo was designed to work with

Returns:
The JavaBean's class type object

getContextItems


public DisplayAction[] getContextItems(DesignBean designBean)
Returns the list (or hierarchy) of items to be included in a right-click context menu for this bean at design-time.

Parameters:
designBean - The DesignBean that a user has right-clicked on
Returns:
An array of DisplayAction objects representing a context menu to display to the user

linkBeans


public Result linkBeans(DesignBean targetBean,
                        DesignBean sourceBean)

This method is called when an object from a design surface or palette has been dropped 'on' a JavaBean type handled by this DesignInfo (to establish a link). This method will not be called unless the corresponding 'canLinkBeans' method call returned true. Typically, this results in property settings on potentially both of the DesignBean objects.

Parameters:
targetBean - The target DesignBean instance that the user has 'dropped' an object onto to establish a link
sourceBean - The DesignBean instance that has been 'dropped'
Returns:
A Result object, indicating success or failure and including messages for the user
See Also:
canLinkBeans(DesignBean, DesignBean, Class)