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.taglib.portletext;
016    
017    import com.liferay.portal.kernel.util.HtmlUtil;
018    import com.liferay.portal.theme.PortletDisplay;
019    import com.liferay.taglib.FileAvailabilityUtil;
020    import com.liferay.taglib.ui.IconTag;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     * @author Shuyang Zhou
025     */
026    public class IconMaximizeTag extends IconTag {
027    
028            @Override
029            protected String getPage() {
030                    if (FileAvailabilityUtil.isAvailable(servletContext, _PAGE)) {
031                            return _PAGE;
032                    }
033    
034                    PortletDisplay portletDisplay =
035                            (PortletDisplay)pageContext.getAttribute("portletDisplay");
036    
037                    if (!portletDisplay.isShowMaxIcon()) {
038                            return null;
039                    }
040    
041                    setCssClass("portlet-maximize portlet-maximize-icon");
042                    setImage("../aui/plus");
043                    setMessage("maximize");
044                    setMethod("get");
045    
046                    String onClick =
047                            "submitForm(document.hrefFm, '".concat(
048                                    HtmlUtil.escapeJS(portletDisplay.getURLMax())).concat(
049                                            "'); return false;");
050    
051                    setOnClick(onClick);
052    
053                    setToolTip(false);
054                    setUrl(portletDisplay.getURLMax());
055    
056                    return super.getPage();
057            }
058    
059            private static final String _PAGE =
060                    "/html/taglib/portlet/icon_maximize/page.jsp";
061    
062    }