/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.trash.web.internal.portlet.configuration.icon; import com.liferay.portal.kernel.portlet.configuration.icon.BaseJSPPortletConfigurationIcon; import com.liferay.portal.kernel.portlet.configuration.icon.PortletConfigurationIcon; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.Validator; import com.liferay.trash.web.internal.constants.TrashPortletKeys; import javax.portlet.PortletRequest; import javax.servlet.ServletContext; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; /** * Provides an implementation of <code>PortletConfigurationIcon</code> (in * <code>com.liferay.portal.kernel</code>) to render the <i>Empty the Recycle * Bin</i> menu item for the Options menu. * * @author Eudaldo Alonso */ @Component( immediate = true, property = {"javax.portlet.name=" + TrashPortletKeys.TRASH}, service = PortletConfigurationIcon.class ) public class EmptyTrashPortletConfigurationIcon extends BaseJSPPortletConfigurationIcon { @Override public String getJspPath() { return "/configuration/icon/empty_trash.jsp"; } @Override public double getWeight() { return 100.0; } @Override public boolean isShow(PortletRequest portletRequest) { String keywords = ParamUtil.getString(portletRequest, "keywords"); if (Validator.isNotNull(keywords)) { return false; } return true; } @Override @Reference( target = "(osgi.web.symbolicname=com.liferay.trash.web)", unbind = "-" ) public void setServletContext(ServletContext servletContext) { super.setServletContext(servletContext); } }