Package org.apache.cocoon.forms.formmodel

Examples of org.apache.cocoon.forms.formmodel.Form


    public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
            throws Exception {
        String formSource = parameters.getParameter("form-definition");
        String formAttribute = parameters.getParameter("attribute-name");

        Form form = formManager.createForm(resolver.resolveURI(formSource));

        Field birthDate = (Field)form.getChild("birthdate");
        birthDate.setValue(new Date());

        Repeater repeater = (Repeater)form.getChild("contacts");
        repeater.addRow();
        Field field = (Field)repeater.getWidget(0, "firstname");
        field.setValue("Jules");

        repeater.addRow();
View Full Code Here


    }

    public ScriptableWidget(Object widget) {
        this.delegate = (Widget)unwrap(widget);
        if (delegate instanceof Form) {
            Form form = (Form)delegate;
            form.setFormHandler(new ScriptableFormHandler());
            formWidget = this;
            Map widgetMap = new HashMap();
            widgetMap.put(delegate, this);
            defineProperty(WIDGETS_PROPERTY, widgetMap, DONTENUM|PERMANENT);
        }
View Full Code Here

        String formAttribute = parameters.getParameter("attribute-name");

        Source source = null;
        try {
            source = resolver.resolveURI(formSource);
            Form form = formManager.createForm(source);

            Request request = ObjectModelHelper.getRequest(objectModel);
            request.setAttribute(formAttribute, form);
        } finally {
            resolver.release(source);
View Full Code Here

        contentHandler.startDocument();
        contentHandler.startPrefixMapping(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS);
        Attributes formAtts = this.config.getFormAttributes();
       
        contentHandler.startElement(Constants.INSTANCE_NS, FORM_GENERATED_EL, Constants.INSTANCE_PREFIX_COLON +FORM_GENERATED_EL, formAtts);
        Form form = config.findForm();
        form.generateSaxFragment(contentHandler, Locale.US);
        contentHandler.endElement(Constants.INSTANCE_NS, FORM_GENERATED_EL, Constants.INSTANCE_PREFIX_COLON +FORM_GENERATED_EL);
       
        contentHandler.endPrefixMapping(Constants.INSTANCE_PREFIX);
        contentHandler.endDocument();
    }
View Full Code Here

            locale = I18nUtils.parseLocale(localeStr, locale);
        }

        Source source = resolver.resolveURI(formSource);
        try {
            Form form = formManager.createForm(source);

            Request request = ObjectModelHelper.getRequest(objectModel);
            FormHandler formHandler = null;

            if (formHandlerClassName != null) {
                // TODO cache these classes
                Class clazz = Class.forName(formHandlerClassName);
                formHandler = (FormHandler)clazz.newInstance();
                LifecycleHelper.setupComponent(formHandler, null, null, manager, null);
                form.setFormHandler(formHandler);
            }

            FormContext formContext = new FormContext(request, locale);

            boolean finished = form.process(formContext);
            request.setAttribute(formAttribute, form);

            if (finished) {
                return Collections.EMPTY_MAP;
            }
View Full Code Here

        widgetDefinitionBuilderSelector.configure(configuration.getChild("widgets"));
    }

    public Form createForm(Source source) throws Exception {
        FormDefinition formDefinition = getFormDefinition(source);
        Form form = (Form)formDefinition.createInstance();
        form.initialize();
        return form;
    }
View Full Code Here

        try {
            sourceResolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);

            source = sourceResolver.resolveURI(uri);
            Form form = createForm(source);
            return form;
        } finally {
            if (source != null) {
                sourceResolver.release(source);
            }
View Full Code Here

            }
        }
    }

    public Form createForm(Element formElement) throws Exception {
        Form form = (Form)getFormDefinition(formElement).createInstance();
        form.initialize();
        return form;
    }
View Full Code Here

        String formAttribute = parameters.getParameter("attribute-name");

        Source source = null;
        try {
            source = resolver.resolveURI(formSource);
            Form form = formManager.createForm(source);

            Request request = ObjectModelHelper.getRequest(objectModel);
            request.setAttribute(formAttribute, form);
        } finally {
            resolver.release(source);
View Full Code Here

            locale = I18nUtils.parseLocale(localeStr, locale);
        }

        Source source = resolver.resolveURI(formSource);
        try {
            Form form = formManager.createForm(source);

            Request request = ObjectModelHelper.getRequest(objectModel);
            FormHandler formHandler = null;

            if (formHandlerClassName != null) {
                // TODO cache these classes
                Class clazz = Class.forName(formHandlerClassName);
                formHandler = (FormHandler)clazz.newInstance();
                LifecycleHelper.setupComponent(formHandler, null, null, manager, null, null);
                form.setFormHandler(formHandler);
            }

            FormContext formContext = new FormContext(request, locale);

            boolean finished = form.process(formContext);
            request.setAttribute(formAttribute, form);

            if (finished) {
                return Collections.EMPTY_MAP;
            } else {
View Full Code Here

TOP

Related Classes of org.apache.cocoon.forms.formmodel.Form

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.