Framework Serveur J2EE ACube V3.1.0
CLASSE PRECEDANTE CLASSE SUIVANTE
SOMMAIRE: ATTR CONSTR METH DETAIL: ATTR CONSTR METH

acube.framework.webcomp.views
Classe WebCompAdapterFactory
java.lang.Object
  org.apache.struts2.views.xslt.AdapterFactory
      acube.framework.webcomp.views.WebCompAdapterFactory

public class WebCompAdapterFactory
hérite de org.apache.struts2.views.xslt.AdapterFactory
AdapterFactory produces Node adapters for Java object types. Adapter classes are generally instantiated dynamically via a no-args constructor and populated with their context information via the AdapterNode interface. This factory supports proxying of generic DOM Node trees, allowing arbitrary Node types to be mixed together. You may simply return a Document or Node type as an object property and it will appear as a sub-tree in the XML as you'd expect. See #proxyNode(). Customization of the result XML can be accomplished by providing alternate adapters for Java types. Adapters are associated with Java types through the registerAdapterType() method. For example, since there is no default Date adapter, Date objects will be rendered with the generic Bean introspecting adapter, producing output like:
     
        19
        1
        0
        7
        8
        4
        
        300
        105
    
 
By extending the StringAdapter and overriding its normal behavior we can create a custom Date formatter:
      public static class CustomDateAdapter extends StringAdapter {
        protected String getStringValue() {
            Date date = (Date)getPropertyValue();
            return DateFormat.getTimeInstance( DateFormat.FULL ).format( date );
        }
    }
 
Producing output like:
     12:02:54 AM CDT
 
The StringAdapter (which is normally invoked only to adapt String values) is a useful base for these kinds of customizations and can produce structured XML output as well as plain text by setting its parseStringAsXML() property to true. See provided examples.

Sommaire des Constructeurs
Sommaire des Méthodes
org.w3c.dom.Node
adaptNode(org.apache.struts2.views.xslt.AdapterNode parent, String propertyName, Object value)
Create an Node adapter for a child element.
private org.w3c.dom.Node
constructAdapterInstance(Class adapterClass, org.apache.struts2.views.xslt.AdapterNode parent, String propertyName, Object propertyValue)
Create an instance of an adapter dynamically and set its context via the AdapterNode interface.
Méthodes héritées de la classe org.apache.struts2.views.xslt.AdapterFactory
adaptDocument, adaptNode, adaptNullValue, getAdapterForValue, proxyNamedNodeMap, proxyNode, registerAdapterType
Méthodes héritées de la classe java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Détail des Constructeurs
WebCompAdapterFactory
public WebCompAdapterFactory()
Détail des méthodes
adaptNode
public org.w3c.dom.Node adaptNode(org.apache.struts2.views.xslt.AdapterNode parent,
                                  String propertyName,
                                  Object value)
Create an Node adapter for a child element. Note that the parent of the created node must be an AdapterNode, however the child node itself may be any type of Node.
Dépacées:
adaptNode in class org.apache.struts2.views.xslt.AdapterFactory
Voir Aussi:
adaptDocument( String, Object )

constructAdapterInstance
private org.w3c.dom.Node constructAdapterInstance(Class adapterClass,
                                                  org.apache.struts2.views.xslt.AdapterNode parent,
                                                  String propertyName,
                                                  Object propertyValue)
Create an instance of an adapter dynamically and set its context via the AdapterNode interface.

Framework Serveur J2EE ACube V3.1.0
CLASSE PRECEDANTE CLASSE SUIVANTE
SOMMAIRE: ATTR CONSTR METH DETAIL: ATTR CONSTR METH

Version 3.1.0 du 06/11/2009 / Etat : Validé
Cette création est mise à disposition selon le Contrat Paternité - Pas d'Utilisation Commerciale - Partage des Conditions Initiales à l'Identique disponible en ligne http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ ou par courrier postal à Creative Commons, 559 Nathan Abbott Way, Stanford,California 94305, USA.
Documentation generated by DocFlex