Package org.apache.cocoon.components.xmlform

Examples of org.apache.cocoon.components.xmlform.Form$FormViewState


        src_ = src;
        params_ = params;

        // ensure that there is a form available
        // through the rest of the flow
        Form form = getForm();

        if (form==null) {
            throw new IllegalStateException("Action could not obtain the Form");
        }

        // find and save the action command
        findCommand();

        // call the subclass prepare()
        // give it a chance to get ready for action
        Map prepareResult = prepare();

        if (prepareResult!=null) {
            return prepareResult;
        }

        // attache callback hooks to the form
        // in case the action subclasses are interested in
        // form events
        getForm().addFormListener(this);
        Map result = null;

        try {
            // populate form with request parameters
            // population is automatically followed by validation by default.
            // If this is not the desired behaviour, the Form class can be subclassed
            form.populate(objectModel);

            result = perform();
        } finally {
            // since the action may be recycled immediately after
            // the request. It is important that it's callback hooks
View Full Code Here


     * is working on.
     *
     * @return Form the form object this action works with
     */
    protected Form getForm() {
        Form form = Form.lookup(getObjectModel(), getFormId());

        if (form!=null) {
            return form;
        } else {
            // create new form
            form = new Form(getFormId(), getFormModel());
            Validator v = getFormValidator();

            form.setValidator(v);
            form.save(getObjectModel(), getFormScope());
            return form;
        }
    }
View Full Code Here

        src_ = src;
        params_ = params;

        // ensure that there is a form available
        // through the rest of the flow
        Form form = getForm();

        if (form==null) {
            throw new IllegalStateException("Action could not obtain the Form");
        }

        // find and save the action command
        findCommand();

        // call the subclass prepare()
        // give it a chance to get ready for action
        Map prepareResult = prepare();

        if (prepareResult!=null) {
            return prepareResult;
        }

        // attache callback hooks to the form
        // in case the action subclasses are interested in
        // form events
        getForm().addFormListener(this);
        Map result = null;

        try {
            // populate form with request parameters
            // population is automatically followed by validation by default.
            // If this is not the desired behaviour, the Form class can be subclassed
            form.populate(objectModel);

            result = perform();
        } finally {
            // since the action may be recycled immediately after
            // the request. It is important that it's callback hooks
View Full Code Here

        }

        super.startElement(uri, name, raw, attributes);

        // load up the referenced form
        Form currentForm = Form.lookup(objectModel, id);

        // if the form wasn't found, we're in trouble
        if (currentForm==null) {
            String error = "Form is null [id="+String.valueOf(id)+"]";
View Full Code Here

                                          Attributes attributes)
                                            throws SAXException {

        // we will either use the locally referenced form id
        // or the global id. At least one of the two must be available
        Form form = null;
        String formAttr = attributes.getValue(TAG_OUTPUT_ATTR_FORM);

        if (formAttr==null) {
            if (formStack.isEmpty()) {
                throw new SAXException("When used outside of a form tag, the output tag requires an '"+
                                       TAG_OUTPUT_ATTR_FORM+"' attribute");
            }
            form = (Form) formStack.peek();
        } else {
            form = Form.lookup(objectModel, formAttr);
        }

        SortedSet violations = form.getViolationsAsSortedSet();

        // if there are no violations, there is nothing to show
        if (violations==null) {
            return;
        }
View Full Code Here

                                      Attributes attributes)
                                        throws SAXException {

        // we will either use the locally referenced form id
        // or the global id. At least one of the two must be available
        Form form = null;
        String formAttr = attributes.getValue(TAG_OUTPUT_ATTR_FORM);

        if (formAttr==null) {
            if (formStack.isEmpty()) {
                throw new SAXException("When used outside of a form tag, the output tag requires an '"+
View Full Code Here

        if (formStack.isEmpty()) {
            throw new SAXException(name+
                                   " element should be either nested within a form tag or provide a form attribute");
        }

        Form form = getCurrentForm();

        getLogger().debug("["+String.valueOf(name)+
                          "] getting value from form [id="+form.getId()+
                          ", ref="+String.valueOf(ref)+"]");

        // retrieve current value of referenced property
        value_ = form.getValue(ref);

        // we will only forward the SAX event once we know
        // that the value of the tag is available
        super.startElement(uri, name, raw, attributes);

        getLogger().debug("Value of form [id="+form.getId()+", ref="+
                          String.valueOf(ref)+"] = ["+value_+"]");

        // Only render value sub-elements
        // at this point
        // if this is not a xf:hidden element.
View Full Code Here

     */
    protected void saveModelReferenceForFormView(String ref, String name) {
        // the xf:form/@view attribute is not mandatory
        // although it is strongly recommended
        if (currentFormView!=null) {
            Form form = getCurrentForm();

            form.saveExpectedModelReferenceForView(currentFormView, ref,
                                                   name);
        }
    }
View Full Code Here

     * It needs to reset previously saved references for another
     * transformation of the same view.
     */
    protected void resetSavedModelReferences() {
        if (currentFormView!=null) {
            Form form = getCurrentForm();

            form.clearSavedModelReferences(currentFormView);
        }

    }
View Full Code Here

        if (formStack.isEmpty()) {
            throw new SAXException(name+
                                   " element should be either nested within a form tag or provide a form attribute");
        }

        Form form = (Form) formStack.peek();

        getLogger().debug("["+String.valueOf(name)+
                          "] getting value from form [id="+form.getId()+
                          ", ref="+String.valueOf(ref)+"]");

        Object value = form.getValue(ref);

        // we will only forward the SAX event once we know
        // that the value of the tag is available
        super.startElement(uri, name, raw, attributes);

        getLogger().debug("Value of form [id="+form.getId()+", ref="+
                          String.valueOf(ref)+"] = ["+value_+"]");

        // Now render the character data inside the tag
        String v = String.valueOf(value);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.xmlform.Form$FormViewState

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.