|
|||||
FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Mix of BuilderSupport and SwingBuilder's factory support.
Field Summary | |
---|---|
String |
CURRENT_FACTORY
|
String |
CURRENT_NAME
|
String |
CURRENT_NODE
|
Logger |
LOG
|
String |
OWNER
|
String |
PARENT_CONTEXT
|
String |
PARENT_FACTORY
|
String |
PARENT_NAME
|
String |
PARENT_NODE
|
LinkedList |
attributeDelegates
|
LinkedList |
contexts
|
List |
disposalClosures
|
Map |
factories
|
Closure |
nameMappingClosure
|
LinkedList |
postInstantiateDelegates
|
LinkedList |
postNodeCompletionDelegates
|
LinkedList |
preInstantiateDelegates
|
FactoryBuilderSupport |
proxyBuilder
|
Constructor Summary | |
FactoryBuilderSupport()
|
|
FactoryBuilderSupport(Closure nameMappingClosure)
|
Method Summary | |
---|---|
Closure |
addAttributeDelegate(Closure attrDelegate)
Add an attribute delegate so it can intercept attributes being set. |
void |
addDisposalClosure(Closure closure)
|
Closure |
addPostInstantiateDelegate(Closure delegate)
Add a postInstantiate delegate so it can intercept nodes after they are created. |
Closure |
addPostNodeCompletionDelegate(Closure delegate)
Add a nodeCompletion delegate so it can intercept nodes after they done with building. |
Closure |
addPreInstantiateDelegate(Closure delegate)
Add a preInstantiate delegate so it can intercept nodes before they are created. |
Object |
build(Class viewClass)
|
Object |
build(Script script)
|
Object |
build(String script, GroovyClassLoader loader)
|
static void |
checkValueIsNull(Object value, Object name)
Throws an exception if value is null. |
static boolean |
checkValueIsType(Object value, Object name, Class type)
Returns true if type is assignalbe to the value's class, false if value is null. |
static boolean |
checkValueIsTypeNotString(Object value, Object name, Class type)
Returns true if type is assignale to the value's class, false if value is null or a String. |
Object |
createNode(Object name, Map attributes, Object value)
This method is responsible for instanciating a node and configure its properties. |
void |
dispose()
|
Object |
doInvokeMethod(String methodName, Object name, Object args)
This method is the workhorse of the builder. |
Map |
getContext()
Returns the context of the current node. |
Object |
getContextAttribute(String key)
|
LinkedList |
getContexts()
Returns the stack of available contexts. |
Object |
getCurrent()
Returns the current node being built. |
Factory |
getCurrentFactory()
Returns the factory that built the current node. |
String |
getCurrentName()
Returns the current node's name. |
Map |
getFactories()
Returns the factory map (Unmodifiable Map). |
Object |
getName(String methodName)
A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX. |
Map |
getParentContext()
Returns the context of the parent of the current node. |
Factory |
getParentFactory()
Returns the factory of the parent of the current node. |
String |
getParentName()
Returns the parent's name of the current node. |
Object |
getParentNode()
Returns the parent of the current node. |
FactoryBuilderSupport |
getProxyBuilder()
Returns the current builder that serves as a proxy. |
void |
handleNodeAttributes(Object node, Map attributes)
Assigns any existing properties to the node. |
Object |
invokeMethod(String methodName)
Convenience method when no arguments are required |
Object |
invokeMethod(String methodName, Object args)
|
void |
newContext()
Pushes a new context on the stack. |
void |
nodeCompleted(Object parent, Object node)
A hook to allow nodes to be processed once they have had all of their children applied. |
Map |
popContext()
Removes the last context from the stack. |
void |
postInstantiate(Object name, Map attributes, Object node)
A hook after the factory creates the node and before attributes are set. |
Object |
postNodeCompletion(Object parent, Object node)
A hook to allow nodes to be processed once they have had all of their children applied and allows the actual node object that represents the Markup element to be changed. |
void |
preInstantiate(Object name, Map attributes, Object value)
A hook before the factory creates the node. |
void |
registerBeanFactory(String theName, Class beanClass)
Registers a factory for a JavaBean. |
void |
registerFactory(String name, Factory factory)
Registers a factory for a node name. |
void |
removeAttributeDelegate(Closure attrDelegate)
Remove the most recently added instance of the attribute delegate. |
void |
removePostInstantiateDelegate(Closure delegate)
Remove the most recently added instance of the postInstantiate delegate. |
void |
removePostNodeCompletionDelegate(Closure delegate)
Remove the most recently added instance of the nodeCompletion delegate. |
void |
removePreInstantiateDelegate(Closure delegate)
Remove the most recently added instance of the preInstantiate delegate. |
void |
reset()
Clears the context stack. |
Factory |
resolveFactory(Object name, Map attributes, Object value)
Returns the Factory associated with name. |
void |
setClosureDelegate(Closure closure, Object node)
A strategy method to allow derived builders to use builder-trees and switch in different kinds of builders. |
void |
setNodeAttributes(Object node, Map attributes)
Maps attributes key/values to properties on node. |
void |
setParent(Object parent, Object child)
Strategy method to stablish parent/child relationships. |
void |
setProxyBuilder(FactoryBuilderSupport proxyBuilder)
Sets the builder to be used as a proxy. |
Object |
withBuilder(FactoryBuilderSupport builder, Closure closure)
Switches the builder's proxyBuilder during the execution of a closure. |
Object |
withBuilder(FactoryBuilderSupport builder, String name, Closure closure)
Switches the builder's proxyBuilder during the execution of a closure. |
Object |
withBuilder(Map attributes, FactoryBuilderSupport builder, String name, Closure closure)
Switches the builder's proxyBuilder during the execution of a closure. |
Constructor Detail |
---|
public FactoryBuilderSupport()
public FactoryBuilderSupport(Closure nameMappingClosure)
Method Detail |
---|
public Closure addAttributeDelegate(Closure attrDelegate)
public void addDisposalClosure(Closure closure)
public Closure addPostInstantiateDelegate(Closure delegate)
public Closure addPostNodeCompletionDelegate(Closure delegate)
public Closure addPreInstantiateDelegate(Closure delegate)
public Object build(Class viewClass)
public Object build(Script script)
public Object build(String script, GroovyClassLoader loader)
public static void checkValueIsNull(Object value, Object name)
public static boolean checkValueIsType(Object value, Object name, Class type)
public static boolean checkValueIsTypeNotString(Object value, Object name, Class type)
Object createNode(Object name, Map attributes, Object value)
public void dispose()
Object doInvokeMethod(String methodName, Object name, Object args)
public Map getContext()
Object getContextAttribute(String key)
LinkedList getContexts()
public Object getCurrent()
public Factory getCurrentFactory()
public String getCurrentName()
public Map getFactories()
Object getName(String methodName)
public Map getParentContext()
public Factory getParentFactory()
public String getParentName()
public Object getParentNode()
FactoryBuilderSupport getProxyBuilder()
void handleNodeAttributes(Object node, Map attributes)
public Object invokeMethod(String methodName)
public Object invokeMethod(String methodName, Object args)
void newContext()
void nodeCompleted(Object parent, Object node)
Map popContext()
void postInstantiate(Object name, Map attributes, Object node)
Object postNodeCompletion(Object parent, Object node)
void preInstantiate(Object name, Map attributes, Object value)
public void registerBeanFactory(String theName, Class beanClass)
public void registerFactory(String name, Factory factory)
public void removeAttributeDelegate(Closure attrDelegate)
public void removePostInstantiateDelegate(Closure delegate)
public void removePostNodeCompletionDelegate(Closure delegate)
public void removePreInstantiateDelegate(Closure delegate)
void reset()
Factory resolveFactory(Object name, Map attributes, Object value)
void setClosureDelegate(Closure closure, Object node)
void setNodeAttributes(Object node, Map attributes)
void setParent(Object parent, Object child)
void setProxyBuilder(FactoryBuilderSupport proxyBuilder)
public Object withBuilder(FactoryBuilderSupport builder, Closure closure)
public Object withBuilder(FactoryBuilderSupport builder, String name, Closure closure)
public Object withBuilder(Map attributes, FactoryBuilderSupport builder, String name, Closure closure)