org.apache.cocoon.forms.transformation
Class EffectWidgetReplacingPipe

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.forms.transformation.EffectPipe
                  extended byorg.apache.cocoon.forms.transformation.EffectWidgetReplacingPipe
All Implemented Interfaces:
ContentHandler, LexicalHandler, Poolable, Recyclable, XMLConsumer, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer
Direct Known Subclasses:
FormsTemplateTransformer

public class EffectWidgetReplacingPipe
extends EffectPipe

The basic operation of this Pipe is that it replaces ft:widget (in the FormsConstants.TEMPLATE_NS namespace) tags (having an id attribute) by the XML representation of the corresponding widget instance.

These XML fragments (normally all in the "CForms Instance" namespace), can then be translated to a HTML presentation by an XSLT. This XSLT will then only have to style individual widget, and will not need to do the whole page layout.

For more information about the supported tags and their function, see the user documentation for the forms template transformer.

Version:
$Id: EffectWidgetReplacingPipe.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
protected  class EffectWidgetReplacingPipe.AggregateWidgetHandler
          Handles ft:aggregate element.
protected  class EffectWidgetReplacingPipe.ChooseHandler
          Handles ft:choose element.
protected  class EffectWidgetReplacingPipe.ChoosePassThruHandler
          Handles ft:choose/ft:when element.
protected  class EffectWidgetReplacingPipe.ClassHandler
          Handles ft:class element.
protected  class EffectWidgetReplacingPipe.ContinuationIdHandler
          Handles ft:continuation-id element.
protected  class EffectWidgetReplacingPipe.DocHandler
          Top level handler for the forms template
protected  class EffectWidgetReplacingPipe.FormHandler
          ft:form-template element handler.
protected  class EffectWidgetReplacingPipe.GroupHandler
          Handles ft:group element.
protected  class EffectWidgetReplacingPipe.NestedHandler
           
protected  class EffectWidgetReplacingPipe.NewHandler
          Handles ft:new element.
protected  class EffectWidgetReplacingPipe.RepeaterHandler
          Handles ft:repeater element.
protected  class EffectWidgetReplacingPipe.RepeaterRowsHandler
          Handles ft:repeater-rows element.
protected  class EffectWidgetReplacingPipe.RepeaterSizeHandler
          Handles ft:repeater-size element.
protected  class EffectWidgetReplacingPipe.RepeaterWidgetHandler
          Handles ft:repeater-widget element: a single element for both the repeater and its rows
protected  class EffectWidgetReplacingPipe.RepeaterWidgetLabelHandler
          Handles ft:repeater-widget-label element.
protected  class EffectWidgetReplacingPipe.SkipHandler
          ft:choose, ft:union use this.
protected  class EffectWidgetReplacingPipe.StructHandler
          Handles ft:struct element.
protected  class EffectWidgetReplacingPipe.StylingContentHandler
          This ContentHandler helps in inserting SAX events before the closing tag of the root element.
protected  class EffectWidgetReplacingPipe.UnionHandler
          Handles ft:union element.
protected  class EffectWidgetReplacingPipe.UnionPassThruHandler
          Handles ft:union/ft:case element.
protected  class EffectWidgetReplacingPipe.ValidationErrorHandler
          Inserts validation errors (if any) for the Field widgets
protected  class EffectWidgetReplacingPipe.WidgetHandler
          Handles ft:widget element.
protected  class EffectWidgetReplacingPipe.WidgetLabelHandler
          Handles ft:widget-label element.
 
Nested classes inherited from class org.apache.cocoon.forms.transformation.EffectPipe
EffectPipe.BufferHandler, EffectPipe.CopyHandler, EffectPipe.ErrorHandler, EffectPipe.Handler, EffectPipe.NullHandler
 
Field Summary
protected  LinkedList chooseWidgets
           
protected  Map classes
           
protected  Widget contextWidget
           
protected  LinkedList contextWidgets
           
protected  boolean hasInstanceNamespace
          True if instance namespace has been mapped to the 'fi' prefix.
protected  EffectWidgetReplacingPipe.ChoosePassThruHandler hChoosePassThru
           
protected  EffectWidgetReplacingPipe.FormHandler hForm
           
protected  EffectWidgetReplacingPipe.NestedHandler hNested
           
protected  EffectWidgetReplacingPipe.SkipHandler hSkip
           
protected  EffectWidgetReplacingPipe.StylingContentHandler hStyling
           
protected  EffectWidgetReplacingPipe.UnionPassThruHandler hUnionPassThru
           
protected  FormsPipelineConfig pipeContext
           
protected  Map templates
          Map containing all handlers
protected  Widget widget
           
 
Fields inherited from class org.apache.cocoon.forms.transformation.EffectPipe
buffer, hBuffer, hNull, locator
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Constructor Summary
EffectWidgetReplacingPipe()
           
 
Method Summary
 void endPrefixMapping(String prefix)
          Process the SAX event.
protected  String getAttributeValue(String loc, Attributes attrs, String name)
          Get value of the required attribute
protected  ContentHandler getContentHandler()
          Needed to get things working with JDK 1.3.
protected  LexicalHandler getLexicalHandler()
          Needed to get things working with JDK 1.3.
protected  String getRequiredAttributeValue(String loc, Attributes attrs, String name)
          Get non-empty value of the required attribute
protected  boolean hasPrefixMapping(String uri, String prefix)
           
 void init(Widget contextWidget, FormsPipelineConfig pipeContext)
           
protected  boolean isVisible(Widget widget)
           
 void recycle()
          Recycle the pipe after processing
protected  void setTypedWidget(String loc, Attributes attrs, Class wclass, String wname)
          Set typed widget by the id attribute
protected  void setWidget(String loc, Attributes attrs)
          Set the widget by the id attribute
protected  void setWidget(String loc, String path)
          Set the widget by its path
 void startPrefixMapping(String prefix, String uri)
          Process the SAX event.
 
Methods inherited from class org.apache.cocoon.forms.transformation.EffectPipe
beginBuffer, characters, comment, endBuffer, endCDATA, endDocument, endDTD, endElement, endEntity, getLocation, ignorableWhitespace, init, popHandler, processingInstruction, pushHandler, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

hChoosePassThru

protected final EffectWidgetReplacingPipe.ChoosePassThruHandler hChoosePassThru

hForm

protected final EffectWidgetReplacingPipe.FormHandler hForm

hNested

protected final EffectWidgetReplacingPipe.NestedHandler hNested

hSkip

protected final EffectWidgetReplacingPipe.SkipHandler hSkip

hStyling

protected final EffectWidgetReplacingPipe.StylingContentHandler hStyling

hUnionPassThru

protected final EffectWidgetReplacingPipe.UnionPassThruHandler hUnionPassThru

templates

protected final Map templates
Map containing all handlers


pipeContext

protected FormsPipelineConfig pipeContext

hasInstanceNamespace

protected boolean hasInstanceNamespace
True if instance namespace has been mapped to the 'fi' prefix.


contextWidget

protected Widget contextWidget

contextWidgets

protected LinkedList contextWidgets

chooseWidgets

protected LinkedList chooseWidgets

widget

protected Widget widget

classes

protected Map classes
Constructor Detail

EffectWidgetReplacingPipe

public EffectWidgetReplacingPipe()
Method Detail

init

public void init(Widget contextWidget,
                 FormsPipelineConfig pipeContext)

recycle

public void recycle()
Description copied from class: EffectPipe
Recycle the pipe after processing

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class EffectPipe

getAttributeValue

protected String getAttributeValue(String loc,
                                   Attributes attrs,
                                   String name)
                            throws SAXException
Get value of the required attribute

Throws:
SAXException

getRequiredAttributeValue

protected String getRequiredAttributeValue(String loc,
                                           Attributes attrs,
                                           String name)
                                    throws SAXException
Get non-empty value of the required attribute

Throws:
SAXException

setWidget

protected void setWidget(String loc,
                         Attributes attrs)
                  throws SAXException
Set the widget by the id attribute

Throws:
SAXException

setWidget

protected void setWidget(String loc,
                         String path)
                  throws SAXException
Set the widget by its path

Throws:
SAXException

setTypedWidget

protected void setTypedWidget(String loc,
                              Attributes attrs,
                              Class wclass,
                              String wname)
                       throws SAXException
Set typed widget by the id attribute

Throws:
SAXException

isVisible

protected boolean isVisible(Widget widget)

getContentHandler

protected ContentHandler getContentHandler()
Needed to get things working with JDK 1.3. Can be removed once we don't support that platform any more.


getLexicalHandler

protected LexicalHandler getLexicalHandler()
Needed to get things working with JDK 1.3. Can be removed once we don't support that platform any more.


startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Process the SAX event.

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class EffectPipe
Throws:
SAXException
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Process the SAX event.

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class EffectPipe
Throws:
SAXException
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

hasPrefixMapping

protected boolean hasPrefixMapping(String uri,
                                   String prefix)
Returns:
True if prefix is already mapped into the namespace


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.