Package org.apache.click

Examples of org.apache.click.ActionResult


                // 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);
            }
        });
    }
View Full Code Here


            context.getResponse().setHeader("REDIRECT_URL",redirectUrl);
            return false;

        } else if (performShowMessage) {
            ActionResult result = new ActionResult("You do not have permission "
                + "to access the link.");
            result.render(context);
            return false;
        }

            return true;
    }
View Full Code Here

                String msg = "<payload>"
                    + "<msg>XML returned at: </msg>"
                    + "<date>" + now + "</date>"
                    + "</payload>";
                // Return an action result containing the message
                return new ActionResult(msg, ActionResult.XML);
            }
        });
    }
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 = "{\"msg\": \"JSON returned at: \", \"date\": \"" + now + "\"}";
                // Return an action result containing the message
                return new ActionResult(msg, ActionResult.JSON);
            }
        });
    }
View Full Code Here

        Map actionResultModel = new HashMap();
        actionResultModel.put("customers", customers);
        actionResultModel.put("format", getFormat());

        // Return an action result for the customers.htm template and customers
        ActionResult actionResult = new ActionResult("/ajax/scroller/customers.htm", actionResultModel, 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

        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 add a Behavior to Form so that Click registers the Form as an Ajax target
        // ALSO NOTE: we don't implement the onAction method as the save and cancel Submits
View Full Code Here

            @Override
            public ActionResult onAction(Control source) {
                // Return a success response
                // Form data can be saved here
                return new ActionResult("Hello " + nameFld.getValue(), 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

        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            wb.write(baos);

            String contentTyype = ClickUtils.getMimeType(".xls");
            ActionResult actionResult = new ActionResult(baos.toByteArray(), contentTyype);

            return actionResult;

        } catch (IOException ioe) {
            throw new RuntimeException(ioe);
View Full Code Here

        // Lookup the contentType for a PNG image
        String contentType = ClickUtils.getMimeType("png");

        // Return an ActionResult containing the image data
        return new ActionResult(imageData, contentType);
    }
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.