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