com.sun.rave.designtime.faces
Interface FacesDesignContext

All Superinterfaces:
DesignContext, DisplayItem, MarkupDesignContext

public interface FacesDesignContext
extends MarkupDesignContext

The FacesDesignContext is an extension to the DesignContext interface (and MarkupDesignContext interface) that adds JSF-specific functionality. This adds methods for creating new facets and handling value reference expressions at design-time. A FacesDesignContext can be accessed by calling the DesignBean.getDesignContext() method and testing the returned DesignContext for 'instanceof' FacesDesignContext. If the file being designed is a JSF-specific backing file (eg Page1.jsp + Page1.java), the DesignContext will be an instanceof FacesDesignContext.

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

Version:
1.0
Author:
Joe Nuxoll
See Also:
DesignContext, DesignBean.getDesignContext()

Method Summary
 boolean canCreateFacet(java.lang.String facetName, java.lang.String type, DesignBean parent)
          Checks if a facet child of type 'facet' using a component of type 'type' on the faces bean 'parent' can be created.
 DesignBean createFacet(java.lang.String facetName, java.lang.String type, DesignBean parent)
          Creates a facet child of type 'facet' using a component of type 'type' on the faces bean 'parent'.
 java.lang.String getBindingExpr(DesignBean toBean)
          Returns a valid reference expression "#{...}" value to point to 'toBean'
 java.lang.String getBindingExpr(DesignBean toBean, java.lang.String subExpr)
          Returns a valid binding expression "#{...}" value to point to 'toBean' plus the sub- expression inside of toBean.
 FacesContext getFacesContext()
          Returns the FacesContext that can be used by component designers to retrieve design-time Faces information.
 java.lang.String getReferenceName()
          Returns the reference name to use in EL expressions to refer to this FacesDesignContext.
 boolean isValidBindingTarget(DesignBean toBean)
          Returns whether a binding expression can be created to point to 'toBean'
 java.lang.Object resolveBindingExpr(java.lang.String expr)
          Returns the live instance Object (not DesignBean) that the reference expression resolves to (at the moment called)
 ResolveResult resolveBindingExprToBean(java.lang.String expr)
          Returns a result that is resolved to the last DesignBean that can be found, plus the remaining un-resolvable string (at least doesn't resolve to a DesignBean)
 
Methods inherited from interface com.sun.rave.designtime.markup.MarkupDesignContext
convertCssStyleToMap, convertMapToCssStyle, getCssPreviewImage
 
Methods inherited from interface com.sun.rave.designtime.DesignContext
addDesignContextListener, addResource, canCreateBean, canMoveBean, copyBeans, createBean, deleteBean, getBeanByName, getBeanForInstance, getBeans, getBeansOfType, getContextData, getDesignContextListeners, getProject, getRootContainer, moveBean, pasteBeans, removeDesignContextListener, resolveResource, setContextData
 
Methods inherited from interface com.sun.rave.designtime.DisplayItem
getDescription, getDisplayName, getHelpKey, getLargeIcon, getSmallIcon
 

Method Detail

canCreateFacet


public boolean canCreateFacet(java.lang.String facetName,
                              java.lang.String type,
                              DesignBean parent)
Checks if a facet child of type 'facet' using a component of type 'type' on the faces bean 'parent' can be created. This method should be called as a test before a call to createFacet.

Parameters:
facetName - The desired facet name to create
type - The desired component type to create as a facet
parent - The desired parent component to create a facet in
Returns:
true if the creation of this facet would be successful, or false if not
See Also:
createFacet(String, String, DesignBean)

createFacet


public DesignBean createFacet(java.lang.String facetName,
                              java.lang.String type,
                              DesignBean parent)
Creates a facet child of type 'facet' using a component of type 'type' on the faces bean 'parent'. Before this method is called, a test call should be made to canCreateFacet.

Parameters:
facetName - The desired facet name to create
type - The desired component type to create as a facet
parent - The desired parent component to create a facet in
Returns:
The resulting DesignBean representing the new facet
See Also:
canCreateFacet(String, String, DesignBean)

getBindingExpr


public java.lang.String getBindingExpr(DesignBean toBean)
Returns a valid reference expression "#{...}" value to point to 'toBean'

Parameters:
toBean - the 'target' bean to create a value expression to point to
Returns:
A valid reference expression pointing to 'toBean'

getBindingExpr


public java.lang.String getBindingExpr(DesignBean toBean,
                                       java.lang.String subExpr)
Returns a valid binding expression "#{...}" value to point to 'toBean' plus the sub- expression inside of toBean. For example, toBean might be button2 on Page1, and the desired expression might be to get the value of button2. The call would then be getReferenceExpr(button2, "value") --> "#{Page1.button2.value}"

Parameters:
toBean - the 'target' bean to create a value expression to point to
subExpr - An optional sub-expression
Returns:
A valid reference expression pointing to 'toBean' plus the specified sub-expression

getFacesContext


public FacesContext getFacesContext()
Returns the FacesContext that can be used by component designers to retrieve design-time Faces information.

Returns:
The 'runtime' FacesContext running at design-time

getReferenceName


public java.lang.String getReferenceName()
Returns the reference name to use in EL expressions to refer to this FacesDesignContext.

Returns:
The String to use as a reference name (in JSF EL)

isValidBindingTarget


public boolean isValidBindingTarget(DesignBean toBean)
Returns whether a binding expression can be created to point to 'toBean'

Parameters:
toBean - the 'target' bean to create a value expression to point to
Returns:
true if a binding expression can be created to point to 'toBean', false if not

resolveBindingExpr


public java.lang.Object resolveBindingExpr(java.lang.String expr)
Returns the live instance Object (not DesignBean) that the reference expression resolves to (at the moment called)

Parameters:
expr - The EL reference expression to evaluate
Returns:
the live instance Object (not DesignBean) that the reference expression resolves to

resolveBindingExprToBean


public ResolveResult resolveBindingExprToBean(java.lang.String expr)
Returns a result that is resolved to the last DesignBean that can be found, plus the remaining un-resolvable string (at least doesn't resolve to a DesignBean)

Parameters:
expr - The EL reference expression to evaluate
Returns:
A ResolveResult, which includes the deepest DesignBean that could be resolved, plus the remainder of the EL expression that could not be resolved to a DesignBean