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.portal.kernel.trash;
016    
017    import com.liferay.portal.kernel.util.WebKeys;
018    import com.liferay.portal.theme.ThemeDisplay;
019    import com.liferay.portlet.trash.util.TrashUtil;
020    
021    import java.util.Locale;
022    
023    import javax.portlet.PortletRequest;
024    import javax.portlet.PortletResponse;
025    import javax.portlet.RenderRequest;
026    import javax.portlet.RenderResponse;
027    
028    /**
029     * @author Alexander Chow
030     */
031    public abstract class BaseTrashRenderer implements TrashRenderer {
032    
033            @Override
034            public String getIconCssClass() {
035                    return "icon-file";
036            }
037    
038            @Override
039            public String getIconPath(PortletRequest portletRequest) {
040                    ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
041                            WebKeys.THEME_DISPLAY);
042    
043                    return getIconPath(themeDisplay);
044            }
045    
046            public String getIconPath(ThemeDisplay themeDisplay) {
047                    return themeDisplay.getPathThemeImages() + "/common/page.png";
048            }
049    
050            @Override
051            public String getNewName(String oldName, String token) {
052                    return TrashUtil.getNewName(oldName, token);
053            }
054    
055            /**
056             * @deprecated As of 7.0.0, replaced by {@link #getSummary(PortletRequest,
057             *             javax.portlet.PortletResponse)}
058             */
059            @Deprecated
060            @Override
061            public String getSummary(Locale locale) {
062                    return getSummary(null, null);
063            }
064    
065            @Override
066            public String render(
067                            PortletRequest portletRequest, PortletResponse portletResponse,
068                            String template)
069                    throws Exception {
070    
071                    return null;
072            }
073    
074            @Override
075            public String renderActions(
076                            RenderRequest renderRequest, RenderResponse renderResponse)
077                    throws Exception {
078    
079                    return null;
080            }
081    
082    }