Package org.apache.click

Examples of org.apache.click.ActionResult


        save.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Update the form which might contain errors
                return new ActionResult(form.toString(), ActionResult.HTML);
            }
        });

        cancel.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Update the form and ensure errors and values have been cleared
                form.clearValues();
                form.clearErrors();
                return new ActionResult(form.toString(), ActionResult.HTML);
            }
        });

        // NOTE: we explicitly register the Form as an Ajax target so that the
        // Fom#onProcess method can be invoked. The save button's Behavior will
View Full Code Here


        return form.onSubmitCheck(this, "/pageflow/invalid-submit.html");
    }

    // A pageAction that handles Ajax requests for a particular customer
    public ActionResult onChangeCustomer() {
        ActionResult actionResult = new ActionResult();

        // Lookup customer based on request parameter 'customerId'
        String customerId = getContext().getRequest().getParameter("customerId");
        Customer customer = customerService.findCustomerByID(customerId);

        // CustomerPanel will render the customer as an HTML snippet
        CustomerPanel customerPanel = new CustomerPanel(this, customer);
        actionResult.setContent(customerPanel.toString());

        // Set content type and character encoding
        actionResult.setCharacterEncoding("UTF-8");
        actionResult.setContentType(ActionResult.HTML);

        return actionResult;
    }
View Full Code Here

    // Event Handlers ---------------------------------------------------------

    // A pageAction that handles Ajax requests for a particular customer
    public ActionResult onChangeCustomer() {
        ActionResult actionResult = new ActionResult();

        // Lookup customer based on request parameter 'customerId'
        String customerId = getContext().getRequest().getParameter("customerId");
        Customer customer = customerService.findCustomerByID(customerId);

        // CustomerPanel will render the customer as an HTML snippet
        CustomerPanel customerPanel = new CustomerPanel(this, customer);
        actionResult.setContent(customerPanel.toString());

        // Set content type and character encoding
        actionResult.setCharacterEncoding("UTF-8");
        actionResult.setContentType(ActionResult.HTML);

        return actionResult;
    }
View Full Code Here

    protected Behavior createBehavior() {
        AjaxBehavior internalBehavior = new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                ActionResult actionResult = new ActionResult();

                String contentType = getPage().getContentType();
                actionResult.setContentType(contentType);

                List<?> autocompleteList = getAutoCompleteList(getValue());
                if (autocompleteList != null) {
                    HtmlStringBuffer buffer = new HtmlStringBuffer(10 + (autocompleteList.size() * 20));
                    renderAutoCompleteList(buffer, autocompleteList);
                    actionResult.setContent(buffer.toString());
                }
                return actionResult;
            }
        };

View Full Code Here

                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

                String msg = "AjaxBehavior <tt>onAction()</tt> method invoked at: " + now;
                // Return an action result containing the message
                return new ActionResult(msg, ActionResult.HTML);
            }
        });

        // If JavaScript is disabled, the ActionListener will be called instead
        link.setActionListener(new ActionListener() {
View Full Code Here

        String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

        String msg = "PageAction method <tt>onLinkClicked()</tt> invoked at: " + now;

        // Return an action result containing the message
        return new ActionResult(msg, ActionResult.HTML);
    }
View Full Code Here

                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

                String msg = "Hello from jQuery at: " + now;
                // Return an action result containing the message
                return new ActionResult(msg, ActionResult.HTML);
            }
        });
    }
View Full Code Here

                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

                String msg = "Hello from JavaScript at: " + now;
                // Return an action result containing the message
                return new ActionResult(msg, ActionResult.HTML);
            }
        });
    }
View Full Code Here

                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");

                String msg = "Hello from Prototype at: " + now;
                // Return an action result containing the message
                return new ActionResult(msg, ActionResult.HTML);
            }
        });
    }
View Full Code Here

        editLink.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                Customer customer = customerService.getCustomerForID(editLink.getValue());
                return new ActionResult("Edit Clicked for customer: " + customer.getName(), ActionResult.TEXT);
            }
        });

        addControl(deleteLink);
        deleteLink.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                Customer customer = customerService.getCustomerForID(deleteLink.getValue());
                return new ActionResult("Delete Clicked for customer: " + customer.getName(), ActionResult.TEXT);
            }
        });

        table.getControlLink().addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {

                // NOTE: Ajax requests only process the target Control. Here we
                // process the table in order to update paging and sorting state
                table.onProcess();

                return new ActionResult(table.toString(), ActionResult.HTML);
            }
        });

        addControl(table);
View Full Code Here

TOP

Related Classes of org.apache.click.ActionResult

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.