001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.taglib.ui;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import javax.servlet.http.HttpServletRequest;
020    import javax.servlet.jsp.tagext.BodyTag;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class SuccessTag extends IncludeTag implements BodyTag {
026    
027            @Override
028            public int doStartTag() {
029                    HttpServletRequest request =
030                            (HttpServletRequest)pageContext.getRequest();
031    
032                    request.setAttribute("liferay-ui:success:key", _key);
033                    request.setAttribute("liferay-ui:success:message", _message);
034                    request.setAttribute(
035                            "liferay-ui:success:translateMessage",
036                            String.valueOf(_translateMessage));
037    
038                    return EVAL_BODY_BUFFERED;
039            }
040    
041            public void setKey(String key) {
042                    _key = key;
043            }
044    
045            public void setMessage(String message) {
046                    _message = message;
047            }
048    
049            public void setTranslateMessage(boolean translateMessage) {
050                    _translateMessage = translateMessage;
051            }
052    
053            @Override
054            protected String getPage() {
055                    return _PAGE;
056            }
057    
058            private static final String _PAGE = "/html/taglib/ui/success/page.jsp";
059    
060            private String _key;
061            private String _message;
062            private boolean _translateMessage = true;
063    
064    }