|
Griffon 1.2.0 | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.codehaus.griffon.ast.AbstractASTTransformation
org.codehaus.griffon.ast.EventPublisherASTTransformation
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class EventPublisherASTTransformation extends AbstractASTTransformation
Handles generation of code for the @EventPublisher annotation.
Generally, it adds (if needed) an EventRouter field and the needed add/removeEventListener methods to support the listeners.| Field Summary | |
|---|---|
private static String |
ARGS
|
private static String |
ENABLED
|
private static ClassNode |
EVENT_HANDLER_TYPE
|
private static ClassNode |
EVENT_PUBLISHER_TYPE
|
private static ClassNode |
EVENT_ROUTER_TYPE
|
private static ClassNode |
GAH_TYPE
|
private static String |
LISTENER
|
private static Logger |
LOG
|
private static String |
NAME
|
private static ClassNode |
RUNNABLE_WITH_ARGS_TYPE
|
| Fields inherited from class AbstractASTTransformation | |
|---|---|
| APPLICATION_HOLDER_TYPE, COLLECTIONS_CLASS |
| Constructor Summary | |
EventPublisherASTTransformation()
|
|
| Method Summary | |
|---|---|
protected static void
|
addEventRouter(ClassNode declaringClass)
Adds the necessary field and methods to support event firing. |
static void
|
addEventRouterToClass(SourceUnit source, ClassNode classNode)
|
static Expression
|
eventRouterInstance()
|
static boolean
|
hasEventPublisherAnnotation(AnnotatedNode node)
Convenience method to see if an annotated node is @EventPublisher. |
protected static boolean
|
needsEventRouter(ClassNode declaringClass, SourceUnit sourceUnit)
Snoops through the declaring class and all parents looking for methods
|
void
|
visit(ASTNode[] nodes, SourceUnit source)
Handles the bulk of the processing, mostly delegating to other methods. |
| Methods inherited from class AbstractASTTransformation | |
|---|---|
| addError, applicationInstance, checkNodesForAnnotationAndType, emptyMap, makeClassSafe, makeClassSafe, makeClassSafe, newClass |
| Field Detail |
|---|
private static final String ARGS
private static final String ENABLED
private static final ClassNode EVENT_HANDLER_TYPE
private static final ClassNode EVENT_PUBLISHER_TYPE
private static final ClassNode EVENT_ROUTER_TYPE
private static final ClassNode GAH_TYPE
private static final String LISTENER
private static final Logger LOG
private static final String NAME
private static final ClassNode RUNNABLE_WITH_ARGS_TYPE
| Constructor Detail |
|---|
EventPublisherASTTransformation()
| Method Detail |
|---|
protected static void addEventRouter(ClassNode declaringClass)
protected final org.codehaus.griffon.runtime.core.EventRouter this$eventRouter = new org.codehaus.griffon.runtime.core.EventRouter()
Also adds support methods:
public void addEventListener(Object)public void addEventListener(String, Closure)public void addEventListener(String, RunnableWithArgs)public void removeEventListener(Object)public void removeEventListener(String, Closure)public void removeEventListener(String, RunnableWithArgs)public void publishEvent(String,List = [])public void publishEventOutsideUI(String,List = [])public void publishEventAsync(String,List = [])public boolean isEventPublishingEnabled()public void setEventPublishingEnabled(boolean)declaringClass - the class to which we add the support field and methods
public static void addEventRouterToClass(SourceUnit source, ClassNode classNode)
public static Expression eventRouterInstance()
public static boolean hasEventPublisherAnnotation(AnnotatedNode node)
node - the node to check
protected static boolean needsEventRouter(ClassNode declaringClass, SourceUnit sourceUnit)
declaringClass - the class to searchsourceUnit - the source unit, for error reporting. @NotNull.
public void visit(ASTNode[] nodes, SourceUnit source)
nodes - the ast nodessource - the source unit for the nodes
Groovy Documentation