org.apache.struts2.views.gxp

## Class AbstractGxp<T extends com.google.gxp.base.MarkupClosure>

- java.lang.Object
- - 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

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractGxp(Class gxpClass)`
    `protected` | `AbstractGxp(Class gxpClass, Method writeMethod, Method getGxpClosureMethod)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object[]` | `getArgs(Appendable out, com.google.gxp.base.GxpContext gxpContext, Map overrides)`
    `Class` | `getGxpClass()`
    `static Class` | `getGxpClassForPath(String gxpPath)`
    `T` | `getGxpClosure()`
    `protected T` | `getGxpClosure(T body, Map params)`
    `protected Object` | `getGxpInstance()`
    `protected Map` | `getOverrides(T body, Map params)`
    `List<Param>` | `getParams()`
    `protected static Method` | `lookupMethodByName(Class clazz, String name)`
    `void` | `setValueStackFactory(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.
      Parameters:
        `out` - Appendable
        `gxpContext` - GXP content

    - #### 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:
        `out` - Appendable
        `gxpContext` - GXP content
        `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()

      Returns:
        Creates GXP closure. Pulls GXP parameters from Struts 2 value stack.

    - #### getGxpClosure

          protected T getGxpClosure(T body,
                                    Map params)

      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.
      Returns:
        Creates GXP closure. Pulls GXP parameters from Struts 2 value stack.

    - #### getOverrides

          protected Map getOverrides(T body,
                                     Map params)

    - #### lookupMethodByName

          protected static Method lookupMethodByName(Class clazz,
                                                     String name)

      Parameters:
        `clazz` - class
        `name` - method name for lookup
      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)

      Parameters:
        `gxpPath` - Gxp path
      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–2026 Apache Software Foundation. All rights reserved.