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 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(Class gxpClass)
           
protected AbstractGxp(Class gxpClass, Method writeMethod, Method getGxpClosureMethod)
           
 
Method Summary
protected  Object[] getArgs(Appendable out, com.google.gxp.base.GxpContext gxpContext, Map overrides)
           
 Class getGxpClass()
           
static Class getGxpClassForPath(String gxpPath)
          Returns generated GXP class given an absolute path to a GXP file.
 T getGxpClosure()
          Creates GXP closure.
protected  T getGxpClosure(T body, Map params)
          Creates GXP closure.
protected  Object getGxpInstance()
           
protected  Map getOverrides(T body, Map params)
           
 List<Param> getParams()
          Returns list of parameters requested by GXP.
protected static Method lookupMethodByName(Class clazz, String name)
          Returns first method with the given name.
 void setValueStackFactory(com.opensymphony.xwork2.util.ValueStackFactory valueStackFactory)
           
 void write(Appendable out, com.google.gxp.base.GxpContext gxpContext)
          Writes GXP.
protected  void write(Appendable out, com.google.gxp.base.GxpContext gxpContext, 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(Class gxpClass)

AbstractGxp

protected AbstractGxp(Class gxpClass,
                      Method writeMethod,
                      Method getGxpClosureMethod)
Method Detail

write

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


write

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

Parameters:
overrides - parameter map pushed onto the value stack

getArgs

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

getGxpInstance

protected 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,
                          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 Map getOverrides(T body,
                           Map params)

lookupMethodByName

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


getGxpClass

public Class getGxpClass()

getParams

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


getGxpClassForPath

public static Class getGxpClassForPath(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(com.opensymphony.xwork2.util.ValueStackFactory valueStackFactory)


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