001    /**
002     * Copyright (c) 2000-2012 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.portlet.PortletURL;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Julio Camarero
025     */
026    public class TrashUndoTag extends IncludeTag {
027    
028            @Override
029            public int doStartTag() {
030                    return EVAL_BODY_INCLUDE;
031            }
032    
033            public void setPortletURL(PortletURL portletURL) {
034                    _portletURL = portletURL.toString();
035            }
036    
037            public void setPortletURL(String portletURL) {
038                    _portletURL = portletURL;
039            }
040    
041            @Override
042            protected void cleanUp() {
043                    super.cleanUp();
044    
045                    _portletURL = null;
046            }
047    
048            @Override
049            protected String getPage() {
050                    return _PAGE;
051            }
052    
053            @Override
054            protected boolean isCleanUpSetAttributes() {
055                    return _CLEAN_UP_SET_ATTRIBUTES;
056            }
057    
058            @Override
059            protected void setAttributes(HttpServletRequest request) {
060                    request.setAttribute("liferay-ui:trash-undo:portletURL", _portletURL);
061            }
062    
063            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
064    
065            private static final String _PAGE = "/html/taglib/ui/trash_undo/page.jsp";
066    
067            private String _portletURL;
068    
069    }