Package org.apache.cocoon.components.xmlform

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


     * 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

        int oldIgnoreHooksCount = ignoreHooksCount;

        try {
            // reset ignore hooks counter
            this.ignoreHooksCount = 0;
            Form currentForm = (Form) formStack.peek();
            Collection locations = currentForm.locate(nodeset);
            Iterator iter = locations.iterator();

            // iterate over each node in the nodeset
            while (iter.hasNext()) {
                String nextNodeLocation = (String) iter.next();
View Full Code Here

        try {
            // reset ignore hooks counter
            this.ignoreHooksCount = 0;

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

            Collection locations = currentForm.locate(nodeset);
            Iterator iter = locations.iterator();

            // iterate over each node in the nodeset
            while (iter.hasNext()) {
                String nextNodeLocation = (String) iter.next();
View Full Code Here

        String base = request.getRequestURI().substring(0,
                          request.getRequestURI().length()-path.length());

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

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

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

        // If the currect form have incorrect values, then process the same page
        if (form.getViolations()!=null) {
            return EMPTY_MAP;
        }

        // find and save the action command
        String command = getCommand(request);

        if ((command==null) || (command.length()==0)) {
            // if no command send, process current page
            return EMPTY_MAP;
        }

        // find the action name for the method, which should be performed.
        String action = getAction(config, path);

        // perform action method
        String forward = command;

        if ((action!=null) && (action.length()>0)) {
            Method method = (Method) methodIndex.get(action);

            if (method!=null) {
                forward = ((String) method.invoke(this, new Object[]{ command,
                                                                      form }));
                if (forward==null) {
                    forward = command;
                }
            }
        }
        if ((command==null) || (command.length()==0)) {
            // if no command send, process current page
            return EMPTY_MAP;
        }

        // if action returns violation, process current form
        if ((forward==null) && (form.getViolations()!=null)) {
            return EMPTY_MAP;
        }

        // process forward
        String newpath = getForward(config, path, forward);
View Full Code Here

     * is working on.
     *
     * @return Form the form object this action works with
     */
    private Form getForm(Configuration config, String path, Map objectModel) {
        Form form = Form.lookup(objectModel, getFormId(config, path));

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

            form.setValidator(v);
            form.save(objectModel, getFormScope(config, path));
            return form;
        }
    }
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

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.