org.apache.cocoon.forms.generation
Class JXMacrosHelper

java.lang.Object
  extended by org.apache.cocoon.forms.generation.JXMacrosHelper

public class JXMacrosHelper
extends Object

Helper class for the implementation of the CForms template language with JXTemplate macros.

Version:
$Id: JXMacrosHelper.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Constructor Summary
JXMacrosHelper(XMLConsumer consumer, Request request, String locale)
           
 
Method Summary
static JXMacrosHelper createHelper(XMLConsumer consumer, Request request, String locale)
          Builds and helper object, given the generator's consumer.
 TreeWalker createWalker()
           
 void defineClassBody(Form form, String id, Object body)
           
 void endForm()
           
 void flushRoot()
           
 void flushRootAndPop()
          Flush the root element name that has been stored in generateWidget(Widget, Map).
 void generateRepeaterSize(Widget widget, String id)
           
 void generateRepeaterWidgetLabel(Widget widget, String id, String widgetId)
           
static boolean generateStyling(ContentHandler handler, Map attributes)
          Generate a <fi:styling> element holding the attributes of a ft:* element that are in the "fi:" namespace.
 boolean generateStyling(Map attributes)
           
 void generateValidationError(ValidationError error)
           
 void generateWidget(Widget widget, Map arguments)
          Generate a widget's SAX fragment, buffering the root element's endElement() event so that the template can insert styling information in it.
 void generateWidgetLabel(Widget widget, String id)
           
 Object getClassBody(String id)
           
 Form getForm(Form form, String attributeName)
           
 Widget getWidget(Widget currentWidget, String path)
          Get a child widget of a given widget, throwing an exception if no such child exists.
 boolean isModified(Widget widget)
           
 boolean isSelectedCase(Widget unionWidget, String caseValue)
           
 boolean isValidationError(Object object)
           
 boolean isVisible(Widget widget)
           
 Widget peekWidget()
           
 void popWidget()
           
 boolean pushContainer(String path)
           
 boolean pushRepeater(String path, boolean ajaxAware)
          Enter a repeater
 boolean pushWidget(String path)
           
protected  boolean pushWidget(String path, boolean unused)
           
 void startForm(Form form, Map attributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JXMacrosHelper

public JXMacrosHelper(XMLConsumer consumer,
                      Request request,
                      String locale)
Method Detail

createHelper

public static JXMacrosHelper createHelper(XMLConsumer consumer,
                                          Request request,
                                          String locale)
Builds and helper object, given the generator's consumer.

Parameters:
consumer - the generator's consumer
Returns:
a helper object

getForm

public Form getForm(Form form,
                    String attributeName)

startForm

public void startForm(Form form,
                      Map attributes)
               throws SAXException
Throws:
SAXException

endForm

public void endForm()
             throws SAXException
Throws:
SAXException

pushWidget

protected boolean pushWidget(String path,
                             boolean unused)
                      throws SAXException
Throws:
SAXException

peekWidget

public Widget peekWidget()

popWidget

public void popWidget()
               throws SAXException
Throws:
SAXException

pushWidget

public boolean pushWidget(String path)
                   throws SAXException
Throws:
SAXException

pushContainer

public boolean pushContainer(String path)
                      throws SAXException
Throws:
SAXException

pushRepeater

public boolean pushRepeater(String path,
                            boolean ajaxAware)
                     throws SAXException
Enter a repeater

Parameters:
path - widget path
ajaxAware - distinguishes between <ft:repeater-widget> and <ft:repeater>.
Returns:
true if the repeater template is to be executed
Throws:
SAXException

getWidget

public Widget getWidget(Widget currentWidget,
                        String path)
Get a child widget of a given widget, throwing an exception if no such child exists.

Parameters:
currentWidget -
path -

generateWidget

public void generateWidget(Widget widget,
                           Map arguments)
                    throws SAXException
Generate a widget's SAX fragment, buffering the root element's endElement() event so that the template can insert styling information in it.

Parameters:
widget -
arguments -
Throws:
SAXException

flushRootAndPop

public void flushRootAndPop()
                     throws SAXException
Flush the root element name that has been stored in generateWidget(Widget, Map).

Throws:
SAXException

flushRoot

public void flushRoot()
               throws SAXException
Throws:
SAXException

generateWidgetLabel

public void generateWidgetLabel(Widget widget,
                                String id)
                         throws SAXException
Throws:
SAXException

generateRepeaterWidgetLabel

public void generateRepeaterWidgetLabel(Widget widget,
                                        String id,
                                        String widgetId)
                                 throws SAXException
Throws:
SAXException

generateRepeaterSize

public void generateRepeaterSize(Widget widget,
                                 String id)
                          throws SAXException
Throws:
SAXException

generateValidationError

public void generateValidationError(ValidationError error)
                             throws SAXException
Throws:
SAXException

isValidationError

public boolean isValidationError(Object object)

defineClassBody

public void defineClassBody(Form form,
                            String id,
                            Object body)

getClassBody

public Object getClassBody(String id)

isSelectedCase

public boolean isSelectedCase(Widget unionWidget,
                              String caseValue)

createWalker

public TreeWalker createWalker()

isVisible

public boolean isVisible(Widget widget)
                  throws SAXException
Throws:
SAXException

isModified

public boolean isModified(Widget widget)

generateStyling

public boolean generateStyling(Map attributes)
                        throws SAXException
Throws:
SAXException

generateStyling

public static boolean generateStyling(ContentHandler handler,
                                      Map attributes)
                               throws SAXException
Generate a <fi:styling> element holding the attributes of a ft:* element that are in the "fi:" namespace.

Parameters:
attributes - the template instruction attributes
Returns:
true if a <fi:styling> was produced
Throws:
SAXException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.