001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }