com.sun.rave.designtime
Interface DesignBean

All Known Subinterfaces:
FacesDesignBean, MarkupDesignBean

public interface DesignBean

A DesignBean represents an instance of a JavaBean class at design-time. There is one DesignBean instance 'wrapping' each instance of a component class in a bean design tool. All access to properties and events should be done via the DesignBean interface at design-time, so that the tool is able to track changes and persist them. Think of the "DesignBean" as the design-time proxy for an instance of a JavaBean.

IMPLEMENTED BY CREATOR - This interface is implemented by Creator for use by the component (bean) author.

Version:
1.0
Author:
Joe Nuxoll

Method Summary
 void addDesignBeanListener(DesignBeanListener beanListener)
          Adds a DesignBeanListener event listener to this DesignBean
 boolean canSetInstanceName()
          Returns true if this instance can be renamed via this interface.
 java.beans.BeanInfo getBeanInfo()
          Returns the BeanInfo descriptor for this bean instance's type.
 DesignBean getBeanParent()
          Returns the DesignBean parent of this bean instance, or null if this is a top-level bean.
 DesignBean getChildBean(int index)
          Returns the child DesignBean at the specified cardinal index (zero-based).
 int getChildBeanCount()
          Returns the count of child DesignBeans contained in this DesignBean.
 DesignBean[] getChildBeans()
          Returns an array of DesignBean children of this DesignBean
 DesignBeanListener[] getDesignBeanListeners()
          Returns an array of DesignBeanListener currently listening to this DesignBean
 DesignContext getDesignContext()
          Returns the DesignContext that 'owns' this bean instance.
 DesignInfo getDesignInfo()
          Returns the DesignInfo instance for this bean instance.
 DesignEvent getEvent(EventDescriptor event)
          Returns a DesignEvent with the specified EventDescriptor.
 DesignEvent getEvent(java.beans.EventSetDescriptor eventSet, java.beans.MethodDescriptor event)
          Returns the DesignEvent from within the specified event set and having the specified MethodDescriptor.
 DesignEvent[] getEvents()
          Returns an array of DesignEvent objects representing the events of this DesignBean.
 DesignEvent[] getEvents(java.beans.EventSetDescriptor eventSet)
          Returns the DesignEvent objects for a particular event set.
 java.lang.Object getInstance()
          Returns the instance that this DesignBean is marshalling.
 java.lang.String getInstanceName()
          Returns the instance name of this bean - as declared in source code.
 DesignProperty[] getProperties()
          Returns an array of DesignProperty objects representing the properties of this DesignBean.
 DesignProperty getProperty(java.beans.PropertyDescriptor property)
          Returns a single DesignProperty object representing the specified property (by descriptor).
 DesignProperty getProperty(java.lang.String propertyName)
          Returns a single DesignProperty object representing the specified property (by name).
 boolean isContainer()
          Returns true if this DesignBean can be a logical container for other DesignBeans, or false if not.
 void removeDesignBeanListener(DesignBeanListener beanListener)
          Removes a DesignBeanListener event listener from this DesignBean
 boolean setInstanceName(java.lang.String name)
          Renames the instance variable for this bean instance in the source code.
 boolean setInstanceName(java.lang.String name, boolean autoNumber)
          Renames the instance variable for this bean instance in the source code, and appends an auto-incremented number.
 

Method Detail

addDesignBeanListener


public void addDesignBeanListener(DesignBeanListener beanListener)
Adds a DesignBeanListener event listener to this DesignBean

Parameters:
beanListener - the event listener to add

canSetInstanceName


public boolean canSetInstanceName()
Returns true if this instance can be renamed via this interface.

Returns:
true if this instance can be renamed via this interface, or false if not.

getBeanInfo


public java.beans.BeanInfo getBeanInfo()
Returns the BeanInfo descriptor for this bean instance's type.

Returns:
The BeanInfo descriptor for this bean instance's type.

getBeanParent


public DesignBean getBeanParent()
Returns the DesignBean parent of this bean instance, or null if this is a top-level bean.

Returns:
The DesignBean parent of this bean instance, or null if this is a top- level bean.

getChildBean


public DesignBean getChildBean(int index)
Returns the child DesignBean at the specified cardinal index (zero-based).

Parameters:
index - The zero-based cardinal index for the desired DesignBean child
Returns:
the DesignBean at the specified index

getChildBeanCount


public int getChildBeanCount()
Returns the count of child DesignBeans contained in this DesignBean. Children are "logical" children in that they represent the sub-components contained inside of another component in the markup (JSP) or containership hiearchy.

Returns:
The count of DesignBean children contained by this DesignBean

getChildBeans


public DesignBean[] getChildBeans()
Returns an array of DesignBean children of this DesignBean

Returns:
An array of DesignBean children of this DesignBean

getDesignBeanListeners


public DesignBeanListener[] getDesignBeanListeners()
Returns an array of DesignBeanListener currently listening to this DesignBean

Returns:
An array of DesignBeanListener currently listening to this DesignBean

getDesignContext


public DesignContext getDesignContext()
Returns the DesignContext that 'owns' this bean instance.

Returns:
The DesignContext 'owner' of this bean instance.

getDesignInfo


public DesignInfo getDesignInfo()
Returns the DesignInfo instance for this bean instance.

Returns:
The DesignInfo instance for this bean instance.

getEvent


public DesignEvent getEvent(EventDescriptor event)
Returns a DesignEvent with the specified EventDescriptor.

Parameters:
event - The desired event's EventDescriptor
Returns:
The DesignEvent representing the event desired, or null if none matched criteria

getEvent


public DesignEvent getEvent(java.beans.EventSetDescriptor eventSet,
                            java.beans.MethodDescriptor event)
Returns the DesignEvent from within the specified event set and having the specified MethodDescriptor.

Parameters:
eventSet - The desired EventSetDescriptor
event - The desired MethodDescriptor
Returns:
The DesignEvent representing the event desired, or null if none matched criteria

getEvents


public DesignEvent[] getEvents()
Returns an array of DesignEvent objects representing the events of this DesignBean.

Returns:
An array of DesignEvent objecst representing the events of this DesignBean.

getEvents


public DesignEvent[] getEvents(java.beans.EventSetDescriptor eventSet)
Returns the DesignEvent objects for a particular event set.

Parameters:
eventSet - The EventSetDescriptor containing the desired events.
Returns:
An array of DesignEvent objects representing the events contained in the specified event set.

getInstance


public java.lang.Object getInstance()
Returns the instance that this DesignBean is marshalling.

Returns:
The instance of the wrapped bean instance.

getInstanceName


public java.lang.String getInstanceName()
Returns the instance name of this bean - as declared in source code.

Returns:
The source code instance name of this bean.

getProperties


public DesignProperty[] getProperties()
Returns an array of DesignProperty objects representing the properties of this DesignBean.

Returns:
An array of DesignProperty objects representing the properties of this DesignBean.

getProperty


public DesignProperty getProperty(java.beans.PropertyDescriptor property)
Returns a single DesignProperty object representing the specified property (by descriptor).

Parameters:
property - The PropertyDescriptor of the desired DesignProperty to retrieve.
Returns:
The DesignProperty representing the desired property, or null if the specified property does not exist in this DesignBean.

getProperty


public DesignProperty getProperty(java.lang.String propertyName)
Returns a single DesignProperty object representing the specified property (by name).

Parameters:
propertyName - The name of the desired DesignProperty to retrieve.
Returns:
The DesignProperty representing the desired property, or null if the specified property does not exist in this DesignBean.

isContainer


public boolean isContainer()
Returns true if this DesignBean can be a logical container for other DesignBeans, or false if not. For example, if a DesignBean is representing a HtmlCommandButton instance, it will return false from this method, whereas a DesignBean representing an HtmlDataTable will return true. You can only add children to a DesignBean that returns true from this method.

Returns:
true if this DesignBean is a container, and false if it is not

removeDesignBeanListener


public void removeDesignBeanListener(DesignBeanListener beanListener)
Removes a DesignBeanListener event listener from this DesignBean

Parameters:
beanListener - the event listener to remove

setInstanceName


public boolean setInstanceName(java.lang.String name)
Renames the instance variable for this bean instance in the source code. If successful, this method returns true, if there is a problem, including the existance of a duplicate instance variable name, this method returns false.

Parameters:
name - The desired source code instance name for this bean.
Returns:
true if the rename was successful, or false if not.

setInstanceName


public boolean setInstanceName(java.lang.String name,
                               boolean autoNumber)
Renames the instance variable for this bean instance in the source code, and appends an auto-incremented number. For example: setInstanceName("button", true) --> button1 --> button2 --> button3, etc. If successful, this method returns true, if there is a problem, this method returns false.

Parameters:
name - The desired source code instance name (base) for this bean.
autoNumber - true to auto-number the instance name, false to strictly attempt the specified name.
Returns:
true if the rename was successful, or false if not.