Package org.springmodules.xt.ajax.action

Examples of org.springmodules.xt.ajax.action.ReplaceContentAction


        Image img = new Image(ajaxSubmitEvent.getHttpRequest().getContextPath() + "/images/ok.gif", "success");
        TaggedText msg = new TaggedText(
                this.messageSource.getMessage("message.successful", null, "Successful", LocaleContextHolder.getLocale()),
                TaggedText.Tag.SPAN);
       
        ReplaceContentAction action1 = new ReplaceContentAction("onSuccessMessage", img, msg);
        Effect action2 = new Effect("Shake", "onSuccessMessage");
        SetAttributeAction action3 = new SetAttributeAction("name.field", "value", "");
        SetAttributeAction action4 = new SetAttributeAction("url.field", "value", "");
       
        return new AjaxAction[]{action1, action2, action3, action4};
View Full Code Here


                    // Render the feed via external JSP content:
                    event.getHttpRequest().setAttribute("feed", feed);
                    event.getHttpRequest().setAttribute("subscription", subscriptionName);
                    JspComponent jsp = new JspComponent(event.getHttpRequest(), "/personal/includes/feedPanel.page");
                    // Replace the content of the "viewer" page part:
                    ReplaceContentAction action1 = new ReplaceContentAction("viewer", jsp);
                    // Re-apply javascript Behaviour rules:
                    ApplyBehaviour action2 = new ApplyBehaviour();
                   
                    // Add actions to response:
                    response.addAction(action1);
View Full Code Here

                   
                    // Construct the CSS selector identifying the web page part that will be updated with the JSP content:
                    String selector = new StringBuilder("#").append(event.getElementId()).append("~").append("div.entryBody").toString();
                    ElementMatcher matcher = new SelectorMatcher(Arrays.asList(selector));
                    // Replace the content of the web page part identified by the selector:
                    ReplaceContentAction action2 = new ReplaceContentAction(matcher, jsp);
                    // Call a client-side javascript function:
                    Map<String, Object> params = new HashMap<String, Object>();
                    params.put("selector", selector);
                    ExecuteJavascriptFunctionAction action3 = new ExecuteJavascriptFunctionAction("showEntryEffect", params);
                   
View Full Code Here

        // If errors occur, render an error message with a proper icon:
        String message = this.messageSource.getMessage(messageCode, null, defaultMessage, LocaleContextHolder.getLocale());
        Image img = new Image(event.getHttpRequest().getContextPath() + "/images/error.gif", "error");
        TaggedText txt = new TaggedText(message, TaggedText.Tag.SPAN);
        // Put the message in its proper web page space:
        ReplaceContentAction action1 = new ReplaceContentAction("message", img, txt);
        // Shake the message:
        Effect action2 = new Effect("Shake", "message");
        // Add actions to response:
        response.addAction(action1);
        response.addAction(action2);
View Full Code Here

            TaggedText msg = new TaggedText(
                    this.messageSource.getMessage("user.available.username", null, "Available", LocaleContextHolder.getLocale()),
                    TaggedText.Tag.SPAN);
            msg.addAttribute("class", "okMessage");
           
            ReplaceContentAction action = new ReplaceContentAction("username.validation", msg);
           
            response.addAction(action);
        } else {
            TaggedText msg = new TaggedText(
                    this.messageSource.getMessage("user.unavailable.username", null, "Not Available", LocaleContextHolder.getLocale()),
                    TaggedText.Tag.SPAN);
            msg.addAttribute("class", "warnMessage");
           
            ReplaceContentAction action = new ReplaceContentAction("username.validation", msg);
           
            response.addAction(action);
        }
        return response;
    }
View Full Code Here

            Component errorImage = new Image(event.getHttpRequest().getContextPath() + "/images/error.gif", "error");
            Component errorMessage = new TaggedText(
                    this.messageSource.getMessage("message.error", null, "Error", LocaleContextHolder.getLocale()),
                    TaggedText.Tag.SPAN);
            AjaxAction removeAction = new RemoveContentAction("onSuccessMessage");
            AjaxAction replaceAction = new ReplaceContentAction("onErrorsMessage", errorImage, errorMessage);
            AjaxAction effectAction = new Effect("Shake", "onErrorsMessage");
            response.addAction(removeAction);
            response.addAction(replaceAction);
            response.addAction(effectAction);
        } else {
View Full Code Here

        String rendering = null;
        DefaultValidationHandler handler = new DefaultValidationHandler();
        handler.setMessageSource(new DelegatingMessageSource());
        handler.setSuccessRenderingCallback(new SuccessRenderingCallback() {
            public AjaxAction[] getSuccessActions(AjaxSubmitEvent event) {
                AjaxAction action = new ReplaceContentAction("test", new SimpleText("Default message"));
                return new AjaxAction[]{action};
            }
        });
       
        response = handler.validate(submitEvent);
View Full Code Here

        MockHttpServletResponse httpResponse = new MockHttpServletResponse();
        AjaxResponse ajaxResponse = new AjaxResponseImpl();
       
        String text = "simple text";
       
        ajaxResponse.addAction(new ReplaceContentAction("test", new SimpleText(text)));
       
        this.sender.sendResponse(httpResponse, ajaxResponse);
       
        assertTrue(httpResponse.getContentAsString().contains(text));
    }
View Full Code Here

        MockHttpServletResponse httpResponse = new MockHttpServletResponse();
        AjaxResponse ajaxResponse = new AjaxResponseImpl("UTF-8");
       
        String text = "questo è un semplice testo";
       
        ajaxResponse.addAction(new ReplaceContentAction("test", new SimpleText(text)));
       
        this.sender.sendResponse(httpResponse, ajaxResponse);
       
        assertTrue(httpResponse.getContentAsString().contains(text));
    }
View Full Code Here

        super(testName);
    }

    public void testRender() throws Exception {
        AppendContentAction action1 = new AppendContentAction("action1", new SimpleText("Test Text"));
        ReplaceContentAction action2 = new ReplaceContentAction("action2", new SimpleText("Test Text"));
        AjaxResponseImpl response = new AjaxResponseImpl();
       
        response.addAction(action1);
        response.addAction(action2);
       
View Full Code Here

TOP

Related Classes of org.springmodules.xt.ajax.action.ReplaceContentAction

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.