001    /**
002     * Copyright (c) 2000-2013 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.ui;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Julio Camarero
023     */
024    public class LogoSelectorTag extends IncludeTag {
025    
026            public void setDefaultLogoURL(String defaultLogoURL) {
027                    _defaultLogoURL = defaultLogoURL;
028            }
029    
030            public void setEditLogoURL(String editLogoURL) {
031                    _editLogoURL = editLogoURL;
032            }
033    
034            public void setImageId(long imageId) {
035                    _imageId = imageId;
036            }
037    
038            public void setLogoDisplaySelector(String logoDisplaySelector) {
039                    _logoDisplaySelector = logoDisplaySelector;
040            }
041    
042            public void setShowBackground(boolean showBackground) {
043                    _showBackground = showBackground;
044            }
045    
046            @Override
047            protected void cleanUp() {
048                    _defaultLogoURL = null;
049                    _editLogoURL = null;
050                    _imageId = 0;
051                    _logoDisplaySelector = null;
052                    _showBackground = true;
053            }
054    
055            @Override
056            protected String getPage() {
057                    return _PAGE;
058            }
059    
060            @Override
061            protected void setAttributes(HttpServletRequest request) {
062                    request.setAttribute(
063                            "liferay-ui:logo-selector:defaultLogoURL", _defaultLogoURL);
064                    request.setAttribute(
065                            "liferay-ui:logo-selector:editLogoURL", _editLogoURL);
066                    request.setAttribute(
067                            "liferay-ui:logo-selector:imageId", String.valueOf(_imageId));
068                    request.setAttribute(
069                            "liferay-ui:logo-selector:logoDisplaySelector",
070                            _logoDisplaySelector);
071                    request.setAttribute(
072                            "liferay-ui:logo-selector:showBackground",
073                            String.valueOf(_showBackground));
074            }
075    
076            private static final String _PAGE =
077                    "/html/taglib/ui/logo_selector/page.jsp";
078    
079            private String _defaultLogoURL;
080            private String _editLogoURL;
081            private long _imageId;
082            private String _logoDisplaySelector;
083            private boolean _showBackground = true;
084    
085    }