Package org.apache.cocoon.forms

Examples of org.apache.cocoon.forms.FormsException


                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


        } else if ("move-down".equals(actionCommand)) {
            return new RowActionDefinition.MoveDownDefinition();

        } else {
            throw new FormsException("Unknown repeater row action '" + actionCommand + "'.",
                                     DomHelper.getLocationObject(element));
        }
    }
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

    throws FormsException {
        String attrValue = getAttribute(element, attributeName);
        try {
            return Integer.parseInt(attrValue);
        } catch (NumberFormatException e) {
            throw new FormsException("Cannot parse the value '" + attrValue + "' " +
                                     "as an integer in the attribute '" + attributeName + "'," +
                                     DomHelper.getLocationObject(element));
        }
    }
View Full Code Here

        }

        try {
            return Integer.parseInt(attrValue);
        } catch (NumberFormatException e) {
            throw new FormsException("Cannot parse the value '" + attrValue + "' " +
                                     "as an integer in the attribute '" + attributeName + "'," +
                                     DomHelper.getLocationObject(element));
        }
    }
View Full Code Here

                if (validator instanceof ConfigurableWidgetValidator) {
                    ((ConfigurableWidgetValidator)validator).setConfiguration( validationRuleElement );
                }
                return (WidgetValidator)validator;
            } else {
                throw new FormsException("Spring bean " + name + " is not a "
                                         + WidgetValidator.class.getName(),
                                         DomHelper.getLocationObject( validationRuleElement ));
            }
        } catch (BeansException be) {
            throw new FormsException("Spring bean " + name + " does not exist in Spring context",
                                     DomHelper.getLocationObject( validationRuleElement ));
        }
    }
View Full Code Here

        int minSize = DomHelper.getAttributeAsInteger(repeaterElement, "min-size", 0);
        int maxSize = DomHelper.getAttributeAsInteger(repeaterElement, "max-size", Integer.MAX_VALUE);

        // should throw error on negative values ? Just correct them for now.
        if (minSize < 0) {
            throw new FormsException("min-size should be positive.",
                                     DomHelper.getLocationObject(repeaterElement));
        }

        if (maxSize < 0) {
            throw new FormsException("max-size should be positive.",
                                     DomHelper.getLocationObject(repeaterElement));
        }

        if (maxSize < minSize) {
            throw new FormsException("max-size should be greater than or equal to min-size.",
                                     DomHelper.getLocationObject(repeaterElement));
        }

        // initial size is at least the min size
        initialSize = minSize > initialSize ? minSize : initialSize;
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 UnionDefinition)) {
            throw new FormsException("Parent definition " + definition.getClass().getName() + " is not a UnionDefinition.",
                                     getLocation());
        }

        UnionDefinition other = (UnionDefinition) 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

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.