| java.lang.Object org.netbeans.modules.visualweb.insync.beans.BeansUnit
All known Subclasses: org.netbeans.modules.visualweb.insync.faces.FacesUnit,
BeansUnit | public class BeansUnit implements Unit(Code) | | An abstract compilation Unit that represents a single outer (or 'this' or 'root') JavaBean class
under construction. Within this Unit will be instance Beans, as well as event handling methods.
author: cquinn |
Method Summary | |
final public Bean | addBean(BeanInfo beanInfo, Bean parent, String name, String facet, Position pos) Create and add a new bean to an existing parent. | final public void | addBindingBean(String name) Create binding bean in java source. | public void | addXRefAccessor(String bname, String type) Ensures that a cross-reference accessor to a sibling bean is in place. | protected void | bind() | protected Bean | bindBean(String name, List<String> typeNames) | protected void | bindBeanParents() | protected void | bindBeans() Scan all the fields of the host class and attempt to bind each to a new bean, updating our
beans list as we go. | protected void | bindEventSets(List<Statement> stmts) | protected void | bindProperties(List<Statement> stmts) | public boolean | canCreateBean(BeanInfo bi, Bean parent) | public void | destroy() | public void | dumpTo(PrintWriter w) | public EventMethod | ensureEventMethod(MethodDescriptor md, String name, String defaultBody, String[] parameterNames, String[] requiredImports) Add as needed an event method with a given name and event type, and return type. | public void | ensureImportForType(String type) Use the junit method to enure that we have an import for this type so that
the identifier can use its short form. | protected Bean | firstBeanOfType(Bean bean, Class type) | protected Bean | firstBeanOfType(Bean[] beans, Class type) | public Class | getBaseBeanClass() | public String | getBaseBeanClassName() | public Bean | getBean(String name) | public Class | getBeanClass(String type) Get the actual class of a bean or supporting object, given its type. | public static BeanInfo | getBeanInfo(Class cls, ClassLoader classLoader) Get the BeanInfo given a class for a bean.
Parameters: cls - The Class of the bean. | public BeanInfo | getBeanInfo(String type) Get the BeanInfo for a bean by type using this unit's class loader. | public String | getBeanName() | public BeanStructureScanner | getBeanStructureScanner() Return my currently active scanner, if a sync has been performed or is not in progress
then the result will be null. | public Bean[] | getBeans() | public ClassLoader | getClassLoader() | public Method | getCleanupMethod() | public ParserAnnotation[] | getErrors() | public Method | getEventMethod(String name, MethodDescriptor md) | public Method | getInitializerMethod() | public JavaUnit | getJavaUnit() | public Model | getModel() | protected BeanStructureScanner | getNewBeanStructureScanner() | public Method | getPropertiesInitMethod() | public List<Statement> | getPropertiesInitStatements() | public org.w3c.dom.Element | getRootElement() | public Object | getRootInstance() | public State | getState() | public JavaClass | getThisClass() | public String | getThisClassName() | public String | getThisPackageName() | public boolean | hasEventMethod(MethodDescriptor md, String name) | public Object | instantiateBean(Class cls) Instantiate a bean (or any object really) given its Class. | protected boolean | isBeanNameAvailable(String name, Bean bean) | public boolean | isPageBean() | public boolean | isWriteLocked() | public void | moveBean(Bean bean, Bean newparent, Position pos) | protected Bean | newBoundBean(BeanInfo beanInfo, String name, List<String> typeNames) | protected EventSet | newBoundEventSet(Statement stmt) Overridable hook to allow subclasses an opportunity to create different kinds of bound event
sets. | protected Property | newBoundProperty(Statement stmt) | protected Bean | newCreatedBean(BeanInfo beanInfo, Bean parent, String name, String facet, Position pos) | protected String | nextAvailableName(String base, Bean bean, boolean alwaysNumber) | protected String | nextNameForType(String type) Retrieve the next generated name for a type. | public void | readLock() | public void | readUnlock() | final public void | removeBean(Bean bean) | final public void | removeBindingBean(String name) Remove binding bean in java source. | protected void | scan() | protected void | scanName(String type, String name) Examine a given type and name to adjust the max ordinal used. | public void | setClassLoader(ClassLoader cl) | public boolean | sync() Read the underlying java model and rebuild ourselves if it had changed or we are new. | protected boolean | syncSubUnits() Since a unit can be composed of other units, this is where a subclass should add code
to sync there sub units. | public String | toString() | protected void | updateName(String type, int index) | public void | writeLock(UndoEvent event) | public boolean | writeUnlock(UndoEvent event) |
nameCounters | final protected Map nameCounters(Code) | | |
syncedSinceConstructed | protected boolean syncedSinceConstructed(Code) | | |
BeansUnit | public BeansUnit(JavaUnit junit, ClassLoader cl, String packageName, Model model)(Code) | | Construct an BeansUnit from an existing source file
Parameters: junit - Underlying Java Unit Parameters: cl - Project-wide classloader Parameters: packageName - Package name for this class |
addBean | final public Bean addBean(BeanInfo beanInfo, Bean parent, String name, String facet, Position pos)(Code) | | Create and add a new bean to an existing parent.
Parameters: beanInfo - The definition of the bean to create Parameters: parent - The parent for the new bean Parameters: name - The instance name for the new bean Parameters: facet - The (optional) facet to tag this child within the parent The newly created bean |
addBindingBean | final public void addBindingBean(String name)(Code) | | Create binding bean in java source. This should be called
only to add the binding for a component.
Parameters: name - The instance name for the new bean The newly created bean |
addXRefAccessor | public void addXRefAccessor(String bname, String type)(Code) | | Ensures that a cross-reference accessor to a sibling bean is in place. Accessor method is of
the form:
public get() {
return () getBean("");
}
Parameters: bname - Parameters: type - |
bind | protected void bind()(Code) | | Bind beans & their properties, events and parents
|
bindBeanParents | protected void bindBeanParents()(Code) | | Run a pass over the beans to see if they need to do parent-child wiring
|
bindBeans | protected void bindBeans()(Code) | | Scan all the fields of the host class and attempt to bind each to a new bean, updating our
beans list as we go.
Run a second parent-child wiring pass
|
bindEventSets | protected void bindEventSets(List<Statement> stmts)(Code) | | Scan the init block statements and create matching EventSets and register with their beans
|
destroy | public void destroy()(Code) | | |
ensureEventMethod | public EventMethod ensureEventMethod(MethodDescriptor md, String name, String defaultBody, String[] parameterNames, String[] requiredImports)(Code) | | Add as needed an event method with a given name and event type, and return type. Do nothing
if the method is already present.
Parameters: md - The MethodDescriptor that identifies the method signature+return. Parameters: name - The name of the metod to find or create. The existing or newly created method. |
ensureImportForType | public void ensureImportForType(String type)(Code) | | Use the junit method to enure that we have an import for this type so that
the identifier can use its short form. By default explicit imports are ensured
Parameters: type - fully-qualified type name |
firstBeanOfType | protected Bean firstBeanOfType(Bean bean, Class type)(Code) | | Parameters: bean - Parameters: type - |
firstBeanOfType | protected Bean firstBeanOfType(Bean[] beans, Class type)(Code) | | Parameters: beans - Parameters: type - |
getBaseBeanClass | public Class getBaseBeanClass()(Code) | | the base bean class if the bean is a known managed bean |
getBaseBeanClassName | public String getBaseBeanClassName()(Code) | | the base bean class name |
getBeanClass | public Class getBeanClass(String type) throws ClassNotFoundException(Code) | | Get the actual class of a bean or supporting object, given its type. The type may be a
primitive and/or it may be an array.
Parameters: type - The type retrieve the Class for. The Class that represents the given type. throws: ClassNotFoundException - |
getBeanInfo | public static BeanInfo getBeanInfo(Class cls, ClassLoader classLoader)(Code) | | Get the BeanInfo given a class for a bean.
Parameters: cls - The Class of the bean. The BeanInfo. |
getBeanInfo | public BeanInfo getBeanInfo(String type)(Code) | | Get the BeanInfo for a bean by type using this unit's class loader.
Parameters: type - The fully-qualified bean type name The BeanInfo, or null if not found. |
getBeanStructureScanner | public BeanStructureScanner getBeanStructureScanner()(Code) | | Return my currently active scanner, if a sync has been performed or is not in progress
then the result will be null.
|
getInitializerMethod | public Method getInitializerMethod()(Code) | | Find the initializer method for the page
Parameters: name - |
getPropertiesInitMethod | public Method getPropertiesInitMethod()(Code) | | |
getRootInstance | public Object getRootInstance()(Code) | | Get the live instance (if any) for the root live container
the live root instance |
getState | public State getState()(Code) | | |
hasEventMethod | public boolean hasEventMethod(MethodDescriptor md, String name)(Code) | | Add an event method with a given name and event type, and return type
Parameters: md - Parameters: name - |
instantiateBean | public Object instantiateBean(Class cls)(Code) | | Instantiate a bean (or any object really) given its Class. Handles primitives and arrays by
creating default values for them.
Parameters: cls - Class to instantiate. The new instance of the given Class. |
isBeanNameAvailable | protected boolean isBeanNameAvailable(String name, Bean bean)(Code) | | Parameters: name - whether or not a given name is available for use as a bean name |
isPageBean | public boolean isPageBean()(Code) | | |
isWriteLocked | public boolean isWriteLocked()(Code) | | |
moveBean | public void moveBean(Bean bean, Bean newparent, Position pos)(Code) | | Parameters: bean - Parameters: newparent - Parameters: pos - |
newBoundBean | protected Bean newBoundBean(BeanInfo beanInfo, String name, List<String> typeNames)(Code) | | Return a new Bean instance bound to an existing field, getter & setter
|
newBoundEventSet | protected EventSet newBoundEventSet(Statement stmt)(Code) | | Overridable hook to allow subclasses an opportunity to create different kinds of bound event
sets.
Parameters: s - |
nextAvailableName | protected String nextAvailableName(String base, Bean bean, boolean alwaysNumber)(Code) | | Retrieve the next available name given a base
Parameters: base - The base name to use. Parameters: bean - The bean that wants the name--used to ignore for autonumbering Parameters: alwaysNumber - true to always include a number suffix, false to first attempt to use base The next available name from base, returns base itself if no collisions |
nextNameForType | protected String nextNameForType(String type)(Code) | | Retrieve the next generated name for a type.
Parameters: type - The type name of type to gen name for The next generated name for the type. |
readLock | public void readLock()(Code) | | |
readUnlock | public void readUnlock()(Code) | | |
removeBean | final public void removeBean(Bean bean)(Code) | | Parameters: bean - |
removeBindingBean | final public void removeBindingBean(String name)(Code) | | Remove binding bean in java source. This should be called
only to remove the binding for a component.
Parameters: name - The instance name for the new bean |
scan | protected void scan()(Code) | | Scan our underlying document to find or create our tracked items
|
scanName | protected void scanName(String type, String name)(Code) | | Examine a given type and name to adjust the max ordinal used.
|
syncSubUnits | protected boolean syncSubUnits()(Code) | | Since a unit can be composed of other units, this is where a subclass should add code
to sync there sub units. In order for my sync to proceed, I must ensure that my sub
units are synced successfully. Once they are sync'ed, I can go ahead and sync myself.
This method provides the capability of a subclass to add on additional sub-units and have
them synced when I am asked to sync.
NOTE: Make sure that if ANY of the child units did a sync, this method must return true
as I must assume something has changed in that case and continue the sync process.
|
updateName | protected void updateName(String type, int index)(Code) | | Update the names counter for a given type to be at least as large as a specific ordinal value
|
|
|