Package org.apache.cocoon.forms

Examples of org.apache.cocoon.forms.FormsException


        String widgetName = widgetElement.getLocalName();
        WidgetDefinitionBuilder builder;
        try {
            builder = (WidgetDefinitionBuilder) widgetDefinitionBuilderSelector.select(widgetName);
        } catch (ServiceException e) {
            throw new FormsException("Unknown kind of widget '" + widgetName + "'.",
                                     e, DomHelper.getLocationObject(widgetElement));
        }

        WidgetDefinition def = builder.buildWidgetDefinition(widgetElement, context);
View Full Code Here


                    Element listenerElement = (Element)list.item(i);
                    WidgetListenerBuilder builder;
                    try {
                        builder = (WidgetListenerBuilder) widgetListenerBuilderSelector.select(listenerElement.getLocalName());
                    } catch (ServiceException e) {
                        throw new FormsException("Unknown kind of eventlistener '" + listenerElement.getLocalName() + "'.", e,
                                                 DomHelper.getLocationObject(listenerElement));
                    }
                    WidgetListener listener = builder.buildListener(listenerElement, listenerClass);
                    widgetListenerBuilderSelector.release(builder);
                    if (result == null) {
View Full Code Here

                    String name = element.getLocalName();
                    WidgetValidatorBuilder builder;
                    try {
                        builder = (WidgetValidatorBuilder)this.widgetValidatorBuilderSelector.select(name);
                    } catch(ServiceException e) {
                        throw new FormsException("Unknown kind of validator '" + name + "'.",
                                                 e, DomHelper.getLocationObject(element));
                    }

                    widgetDefinition.addValidator(builder.build(element, widgetDefinition));
                    widgetValidatorBuilderSelector.release(builder);
View Full Code Here

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

        Library lib = 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

        }

        // parse "@whitespace"
        Whitespace whitespace = Whitespace.getEnum(DomHelper.getAttribute(widgetElement, "whitespace", "trim"));
        if (whitespace == null) {
            throw new FormsException("Unknown value for 'whitespace' attribute; valid values are 'trim', 'trim-start', 'trim-end', and 'preserve'.",
                                     DomHelper.getLocationObject(widgetElement));
        }
        definition.setWhitespaceTrim(whitespace);

        SelectionList list = buildSelectionList(widgetElement, definition, "suggestion-list");
View Full Code Here

    throws Exception {
        String id = DomHelper.getAttribute(element, "id");

        WidgetDefinition definition = context.getLocalLibrary().getDefinition(id);
        if (definition == null) {
            throw new FormsException("Widget '" + id + "' not found.",
                                     DomHelper.getLocationObject(element));
        }

        return definition;
    }
View Full Code Here

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

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

        RepeaterActionDefinition other = (RepeaterActionDefinition) definition;

View Full Code Here

         */
        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

                Deprecation.logger.info("The 'action-command' attribute is deprecated and replaced by 'command', at " +
                    DomHelper.getLocation(widgetElement));
            }
        }
        if (actionCommand == null) {
            throw new FormsException("Required attribute 'command' is missing.",
                                     DomHelper.getLocationObject(widgetElement));
        }

        RowActionDefinition definition = createDefinition(widgetElement, actionCommand);
        setupDefinition(widgetElement, definition, context);
        setDisplayData(widgetElement, definition);

        definition.setActionCommand(actionCommand);

        // Warn of the mis-named 'on-action' that existed initially
        Element buggyOnActivate = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "on-activate", false);
        if (buggyOnActivate != null) {
            throw new FormsException("Use 'on-action' instead of 'on-activate' on row-action.",
                                     DomHelper.getLocationObject(buggyOnActivate));
        }

        Iterator i = buildEventListeners(widgetElement, "on-action", ActionListener.class).iterator();
        while (i.hasNext()) {
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.