001    /**
002     * Copyright (c) 2000-2013 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    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class SuccessTag extends IncludeTag {
025    
026            @Override
027            public int doStartTag() {
028                    return EVAL_BODY_INCLUDE;
029            }
030    
031            public void setKey(String key) {
032                    _key = key;
033            }
034    
035            public void setMessage(String message) {
036                    _message = message;
037            }
038    
039            public void setTranslateMessage(boolean translateMessage) {
040                    _translateMessage = translateMessage;
041            }
042    
043            @Override
044            protected String getPage() {
045                    return _PAGE;
046            }
047    
048            @Override
049            protected boolean isCleanUpSetAttributes() {
050                    return _CLEAN_UP_SET_ATTRIBUTES;
051            }
052    
053            @Override
054            protected void setAttributes(HttpServletRequest request) {
055                    request.setAttribute("liferay-ui:success:key", _key);
056                    request.setAttribute("liferay-ui:success:message", _message);
057                    request.setAttribute(
058                            "liferay-ui:success:translateMessage",
059                            String.valueOf(_translateMessage));
060            }
061    
062            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
063    
064            private static final String _PAGE = "/html/taglib/ui/success/page.jsp";
065    
066            private String _key;
067            private String _message;
068            private boolean _translateMessage = true;
069    
070    }