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


                return algorithm;
            } if (CalculatedFieldAlgorithm.class.isAssignableFrom(clazz)) {
                CalculatedFieldAlgorithm algorithm = (CalculatedFieldAlgorithm)beanFactory.getBean( name );
                return algorithm;
            } else {
                throw new FormsException("Spring bean " + name + " is not a " + CalculatedFieldAlgorithm.class.getName(), DomHelper.getLocationObject( algorithmElement ));
            }
        } catch(NoSuchBeanDefinitionException nsbde) {
            throw new FormsException("Spring bean " + name + " does not exist in Spring context", DomHelper.getLocationObject( algorithmElement ));
        } catch(BeansException be) {
            throw new FormsException("Spring bean " + name + " cannot be retrieved/instantiated", DomHelper.getLocationObject( algorithmElement ));
        }
    }
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

*/
public class ButtonDefinitionBuilder extends AbstractWidgetDefinitionBuilder {

    public WidgetDefinition buildWidgetDefinition(Element widgetElement, WidgetDefinitionBuilderContext context)
    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 BooleanFieldDefinition)) {
            throw new FormsException("Ancestor definition " + definition.getClass().getName() + " is not a BooleanFieldDefinition.",
                                     getLocation());
        }

        BooleanFieldDefinition other = (BooleanFieldDefinition) definition;

View Full Code Here

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

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

        AggregateFieldDefinition other = (AggregateFieldDefinition) definition;

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

            // FormDefinition is the *only* kind of widget that has an optional id
            widgetDefinition.setId(DomHelper.getAttribute(widgetElement, "id", ""));
        } else {
            String id = DomHelper.getAttribute(widgetElement, "id");
            if (id.indexOf('/') != -1 || id.indexOf('.') != -1) {
                throw new FormsException("A widget name cannot contain '.' or '/' as this conflicts with widget paths.",
                                         DomHelper.getLocationObject(widgetElement));
            }
            // NewDefinitions are allowed to have a : in their id because they can look up
            // class widgets from the library directly
            if (id.indexOf(':') != -1 && !(widgetDefinition instanceof NewDefinition)) {
                throw new FormsException("A widget name cannot contain ':' as this conflicts with library prefixes",
                                         DomHelper.getLocationObject(widgetElement));
            }
            widgetDefinition.setId(id);
        }

        // state
        String stateValue = DomHelper.getAttribute(widgetElement, "state", null);
        if (stateValue != null) {
            WidgetState state = WidgetState.stateForName(stateValue);
            if (state == null) {
                throw new FormsException("Unknown value '" + stateValue +"' for state attribute.",
                                         DomHelper.getLocationObject(widgetElement));
            }
            widgetDefinition.setState(state);
        }

View Full Code Here

    protected WidgetDefinition buildAnotherWidgetDefinition(Element widgetElement, WidgetDefinitionBuilderContext context)
    throws Exception {
        String widgetName = widgetElement.getLocalName();
        WidgetDefinitionBuilder builder = (WidgetDefinitionBuilder) widgetDefinitionBuilders.get(widgetName);
        if (builder == null) {
            throw new FormsException("Unknown kind of widget '" + widgetName + "'.",
                                     DomHelper.getLocationObject(widgetElement));
        }

        WidgetDefinition def = builder.buildWidgetDefinition(widgetElement, context);
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.