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.portletext;
016    
017    import com.liferay.portal.kernel.servlet.taglib.FileAvailabilityUtil;
018    import com.liferay.portal.theme.PortletDisplay;
019    import com.liferay.taglib.ui.IconTag;
020    
021    /**
022     * @author Jorge Ferrer
023     * @author Shuyang Zhou
024     */
025    public class IconExportImportTag extends IconTag {
026    
027            @Override
028            protected String getPage() {
029                    if (FileAvailabilityUtil.isAvailable(getServletContext(), _PAGE)) {
030                            return _PAGE;
031                    }
032    
033                    PortletDisplay portletDisplay =
034                            (PortletDisplay)pageContext.getAttribute("portletDisplay");
035    
036                    if (!portletDisplay.isShowExportImportIcon()) {
037                            return null;
038                    }
039    
040                    setCssClass("portlet-export-import portlet-export-import-icon");
041                    setImage("download");
042                    setMessage("export-import");
043                    setMethod("get");
044                    setToolTip(false);
045                    setUrl(portletDisplay.getURLExportImport());
046    
047                    return super.getPage();
048            }
049    
050            private static final String _PAGE =
051                    "/html/taglib/portlet/icon_export_import/page.jsp";
052    
053    }