Package org.apache.cocoon.woody.formmodel

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


            throws Exception {
        String formSource = parameters.getParameter("form-definition");
        String formAttribute = parameters.getParameter("attribute-name");

        FormDefinition formDefinition = formManager.getFormDefinition(resolver.resolveURI(formSource));
        Form form = (Form)formDefinition.createInstance();

        Request request = ObjectModelHelper.getRequest(objectModel);
        request.setAttribute(formAttribute, form);

        return null;
View Full Code Here


            throws Exception {
        String formSource = parameters.getParameter("form-definition");
        String formAttribute = parameters.getParameter("attribute-name");

        FormDefinition formDefinition = formManager.getFormDefinition(resolver.resolveURI(formSource));
        Form form = (Form)formDefinition.createInstance();

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

        repeater.addRow();
View Full Code Here

            throws Exception {
        String formSource = parameters.getParameter("form-definition");
        String formAttribute = parameters.getParameter("attribute-name");

        FormDefinition formDefinition = formManager.getFormDefinition(resolver.resolveURI(formSource));
        Form form = (Form)formDefinition.createInstance();

        Request request = ObjectModelHelper.getRequest(objectModel);
        form.readFromRequest(request, Locale.US);
        boolean validationSuccess = form.validate(Locale.US);
        request.setAttribute(formAttribute, form);

        if (validationSuccess)
            return Collections.EMPTY_MAP;
        else
View Full Code Here

            formAttribute = parameters.getParameter("attribute-name");
        } catch (ParameterException e) {
            throw new ProcessingException("Missing 'attribute-name' parameter for WoodyTemplateTransformer.");
        }
        Request request = ObjectModelHelper.getRequest(objectModel);
        Form form = (Form)request.getAttribute(formAttribute);
        if (form == null) {
            throw new ProcessingException("WoodyTemplateTransformer cannot find a form in the request attribute named " + formAttribute);
        }
        init(form);
    }
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

        if (localeStr != null)
            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

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

    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.getWidget("birthdate");
        birthDate.setValue(new Date());

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

        repeater.addRow();
View Full Code Here

    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));

        Request request = ObjectModelHelper.getRequest(objectModel);
        request.setAttribute(formAttribute, form);

        return null;
View Full Code Here

TOP

Related Classes of org.apache.cocoon.woody.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.