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.portlet.documentlibrary.display.context.logic;
016    
017    import com.liferay.portal.kernel.util.ParamUtil;
018    import com.liferay.portal.util.PortletKeys;
019    import com.liferay.portlet.documentlibrary.display.context.util.DLRequestHelper;
020    
021    /**
022     * @author Iv??n Zaera
023     */
024    public class DLVisualizationHelper {
025    
026            public DLVisualizationHelper(DLRequestHelper dlRequestHelper) {
027                    _dlRequestHelper = dlRequestHelper;
028            }
029    
030            public boolean isAddFolderButtonVisible() {
031                    String portletName = _dlRequestHelper.getPortletName();
032    
033                    if (portletName.equals(PortletKeys.DOCUMENT_LIBRARY) ||
034                            portletName.equals(PortletKeys.DOCUMENT_LIBRARY_ADMIN)) {
035    
036                            return true;
037                    }
038    
039                    return false;
040            }
041    
042            public boolean isMountFolderVisible() {
043                    return ParamUtil.getBoolean(
044                            _dlRequestHelper.getRequest(), "showMountFolder", true);
045            }
046    
047            public boolean isShowMinimalActionsButton() {
048                    String portletName = _dlRequestHelper.getPortletName();
049    
050                    if (portletName.equals(PortletKeys.DOCUMENT_LIBRARY) ||
051                            portletName.equals(PortletKeys.DOCUMENT_LIBRARY_ADMIN)) {
052    
053                            return true;
054                    }
055    
056                    return ParamUtil.getBoolean(
057                            _dlRequestHelper.getRequest(), "showMinimalActionButtons");
058            }
059    
060            public boolean isShowWhenSingleIconActionButton() {
061                    String portletName = _dlRequestHelper.getPortletName();
062    
063                    if (portletName.equals(PortletKeys.DOCUMENT_LIBRARY) ||
064                            portletName.equals(PortletKeys.DOCUMENT_LIBRARY_ADMIN)) {
065    
066                            return true;
067                    }
068    
069                    return false;
070            }
071    
072            private final DLRequestHelper _dlRequestHelper;
073    
074    }