Package org.apache.click.ajax

Examples of org.apache.click.ajax.DefaultAjaxBehavior


        addControl(link);

        // Add an Ajax behavior to the link. The behavior will be invoked when the
        // link is clicked. See the basic-ajax-demo.htm template for the client-side
        // Ajax code
        link.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
View Full Code Here


    public void onInit() {
        super.onInit();
        redirectLink.setId("redirectLinkId");
        addControl(redirectLink);

        redirectLink.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                Context context = getContext();
                context.setFlashAttribute("flash", "Redirected at " + new Date());
View Full Code Here

        addControl(link);

        // Add an Ajax behavior to the link. The behavior will be invoked when the
        // link is clicked. See the basic-ajax-demo.htm template for the client-side
        // Ajax code
        link.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
View Full Code Here

        addControl(link);

        // Add an Ajax behavior to the link. The behavior will be invoked when the
        // link is clicked. See the basic-ajax-demo.htm template for the client-side
        // Ajax code
        link.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
View Full Code Here

    @Resource(name="customerService")
    private CustomerService customerService;

    public TableAjaxPage() {
        addControl(editLink);
        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
View Full Code Here

        addControl(link);

        // Add an Ajax behavior to the link. The behavior will be invoked when the
        // link is clicked. See the basic-ajax-demo.htm template for the client-side
        // Ajax code
        link.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
View Full Code Here

        addControl(link);

        // Add an Ajax behavior to the link. The behavior will be invoked when the
        // link is clicked. See the basic-ajax-demo.htm template for the client-side
        // Ajax code
        link.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
View Full Code Here

        addControl(link);

        // Add an Ajax behavior to the link. The behavior will be invoked when the
        // link is clicked. See the basic-ajax-demo.htm template for the client-side
        // Ajax code
        link.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Formatted date instance that will be added to the
                String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
View Full Code Here

        form.add(ageField);
        form.add(dateField);
        form.add(save);
        form.add(cancel);

        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
        // handles the Behavior action event
        form.addBehavior(new DefaultAjaxBehavior());

        // Instead of adding a behavior, the same can be achived by explicitly registering the Form as an Ajax Target:
        // ControlRegistry.registerAjaxTarget(form);
    }
View Full Code Here

    public SimpleFormAjaxPage() {
        addControl(form);
        form.add(nameFld);
        form.add(saveBtn);

        saveBtn.addBehavior(new DefaultAjaxBehavior() {

            @Override
            public ActionResult onAction(Control source) {
                // Return a success response
                // Form data can be saved here
View Full Code Here

TOP

Related Classes of org.apache.click.ajax.DefaultAjaxBehavior

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.