Package org.apache.cocoon.forms

Examples of org.apache.cocoon.forms.FormsException


         */
        public void initializeFrom(WidgetDefinition definition) throws Exception {
            super.initializeFrom(definition);

            if (!(definition instanceof DeleteRowsActionDefinition)) {
                throw new FormsException("Ancestor definition " + definition.getClass().getName() + " is not a DeleteRowsActionDefinition.",
                                         getLocation());
            }

            DeleteRowsActionDefinition other = (DeleteRowsActionDefinition) definition;

View Full Code Here


         */
        public void initializeFrom(WidgetDefinition definition) throws Exception {
            super.initializeFrom(definition);

            if (!(definition instanceof InsertRowsActionDefinition)) {
                throw new FormsException("Ancestor definition " + definition.getClass().getName() + " is not an InsertRowsActionDefinition.",
                                         getLocation());
            }

            InsertRowsActionDefinition other = (InsertRowsActionDefinition) definition;

View Full Code Here

* @version $Id: ButtonDefinitionBuilder.java 449149 2006-09-23 03:58:05Z crossley $
*/
public class ButtonDefinitionBuilder extends AbstractWidgetDefinitionBuilder {

    public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception {
        throw new FormsException("The button widget has been renamed to action. Please update your form definition files.",
                                 DomHelper.getLocationObject(widgetElement));
    }
View Full Code Here

     */
    public void initializeFrom(WidgetDefinition definition) throws Exception {
        super.initializeFrom(definition);

        if (!(definition instanceof SubmitDefinition)) {
            throw new FormsException("Ancestor definition " + definition.getClass().getName() + " is not a SubmitDefinition.",
                                     getLocation());
        }

        SubmitDefinition other = (SubmitDefinition) definition;

View Full Code Here

     */
    public void initializeFrom(WidgetDefinition definition) throws Exception {
        super.initializeFrom(definition);

        if (!(definition instanceof AbstractContainerDefinition)) {
            throw new FormsException("Parent definition " + definition.getClass().getName() + " is not an AbstractContainerDefinition.",
                                     getLocation());
        }

        AbstractContainerDefinition other = (AbstractContainerDefinition) definition;

View Full Code Here

    public void addWidgetDefinition(WidgetDefinition definition) throws Exception, DuplicateIdException {
        // Check that no child is named "submit" if this form has no id. This causes some weird behaviour
        // in HTML as it collides with the submit() function on the <form> element...
        if ("submit".equals(definition.getId()) && StringUtils.isEmpty(this.getId())) {
            throw new FormsException("Top-level widgets should not be named 'submit' to avoid problems " +
                                     "with HTML <form> elements.", definition.getLocation());
        }

        super.addWidgetDefinition(definition);
    }
View Full Code Here

     * Imports a new library
     */
    public WidgetDefinition buildWidgetDefinition(Element widgetElement)
    throws Exception {
        if (this.context == null || this.context.getLocalLibrary() == null) {
            throw new FormsException("Import statement seen and context is empty.",
                                     DomHelper.getLocationObject(widgetElement));
        }

        Library lib = this.context.getLocalLibrary();
        String prefix = DomHelper.getAttribute(widgetElement, PREFIX_ATTRIBUTE);
        String uri = DomHelper.getAttribute(widgetElement, URI_ATTRIBUTE);

        if (!lib.includeAs(prefix, uri)) {
            throw new FormsException("Import statement did not succeed (probably used ':' in the prefix?).",
                                     DomHelper.getLocationObject(widgetElement));
        }

        return null;
    }
View Full Code Here

     */
    public void initializeFrom(WidgetDefinition definition) throws Exception {
        super.initializeFrom(definition);

        if (!(definition instanceof FieldDefinition)) {
            throw new FormsException("Ancestor definition " + definition.getClass().getName() + " is not a FieldDefinition.",
                                     getLocation());
        }

        FieldDefinition other = (FieldDefinition) definition;

View Full Code Here

                return (Element) node;
            }
        }

        if (required) {
            throw new FormsException("Required element '" + localName + "' is missing.",
                                     DomHelper.getLocationObject(element));
        }

        return null;
    }
View Full Code Here

     */
    public static String getAttribute(Element element, String attributeName)
    throws FormsException {
        String attrValue = element.getAttribute(attributeName);
        if (attrValue.length() == 0) {
            throw new FormsException("Required attribute '" + attributeName + "' is missing.",
                                     DomHelper.getLocationObject(element));
        }

        return attrValue;
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.forms.FormsException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.