org.apache.struts2.views.gxp
Class AbstractGxp<T extends com.google.gxp.base.MarkupClosure>

java.lang.Object
  extended by org.apache.struts2.views.gxp.AbstractGxp<T>
Direct Known Subclasses:
Gxp

public abstract class AbstractGxp<T extends com.google.gxp.base.MarkupClosure>
extends java.lang.Object

Struts2 to GXP adapter. Can be used to write a GXP or create a MarkupClosure. Pulls GXP parameters from Struts2 value stack.

Author:
Bob Lee

Constructor Summary
protected AbstractGxp(java.lang.Class gxpClass)
           
protected AbstractGxp(java.lang.Class gxpClass, java.lang.reflect.Method writeMethod, java.lang.reflect.Method getGxpClosureMethod)
           
 
Method Summary
protected  java.lang.Object[] getArgs(java.lang.Appendable out, com.google.gxp.base.GxpContext gxpContext, java.util.Map overrides)
           
 java.lang.Class getGxpClass()
           
static java.lang.Class getGxpClassForPath(java.lang.String gxpPath)
          Returns generated GXP class given an absolute path to a GXP file.
 T getGxpClosure()
          Creates GXP closure.
protected  T getGxpClosure(T body, java.util.Map params)
          Creates GXP closure.
protected  java.lang.Object getGxpInstance()
           
protected  java.util.Map getOverrides(T body, java.util.Map params)
           
 java.util.List<Param> getParams()
          Returns list of parameters requested by GXP.
protected static java.lang.reflect.Method lookupMethodByName(java.lang.Class clazz, java.lang.String name)
          Returns first method with the given name.
 void setValueStackFactory(ValueStackFactory valueStackFactory)
           
 void write(java.lang.Appendable out, com.google.gxp.base.GxpContext gxpContext)
          Writes GXP.
protected  void write(java.lang.Appendable out, com.google.gxp.base.GxpContext gxpContext, java.util.Map overrides)
          Writes GXP.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGxp

protected AbstractGxp(java.lang.Class gxpClass)

AbstractGxp

protected AbstractGxp(java.lang.Class gxpClass,
                      java.lang.reflect.Method writeMethod,
                      java.lang.reflect.Method getGxpClosureMethod)
Method Detail

write

public void write(java.lang.Appendable out,
                  com.google.gxp.base.GxpContext gxpContext)
Writes GXP. Pulls GXP parameters from Struts2's value stack.


write

protected void write(java.lang.Appendable out,
                     com.google.gxp.base.GxpContext gxpContext,
                     java.util.Map overrides)
Writes GXP. Pulls GXP parameters from Struts2's value stack.

Parameters:
overrides - parameter map pushed onto the value stack

getArgs

protected java.lang.Object[] getArgs(java.lang.Appendable out,
                                     com.google.gxp.base.GxpContext gxpContext,
                                     java.util.Map overrides)

getGxpInstance

protected java.lang.Object getGxpInstance()
Returns:
the object on which to call the write and getGxpClosure methods. If the methods are static, this can return null

getGxpClosure

public T getGxpClosure()
Creates GXP closure. Pulls GXP parameters from Struts 2 value stack.


getGxpClosure

protected T getGxpClosure(T body,
                          java.util.Map params)
Creates GXP closure. Pulls GXP parameters from Struts 2 value stack.

Parameters:
body - is pushed onto the stack if this GXP has a MarkupClosure (or subclass) parameter named "body".
params - comes first on the value stack.

getOverrides

protected java.util.Map getOverrides(T body,
                                     java.util.Map params)

lookupMethodByName

protected static java.lang.reflect.Method lookupMethodByName(java.lang.Class clazz,
                                                             java.lang.String name)
Returns first method with the given name. Should not be used if the method is overloaded.


getGxpClass

public java.lang.Class getGxpClass()

getParams

public java.util.List<Param> getParams()
Returns list of parameters requested by GXP.


getGxpClassForPath

public static java.lang.Class getGxpClassForPath(java.lang.String gxpPath)
Returns generated GXP class given an absolute path to a GXP file. The current implementation assumes that the GXP and generated Java source file share the same name with different extensions.


setValueStackFactory

public void setValueStackFactory(ValueStackFactory valueStackFactory)


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.