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 setCurrentLogoURL(String currentLogoURL) {
027                    _currentLogoURL = currentLogoURL;
028            }
029    
030            public void setDefaultLogoURL(String defaultLogoURL) {
031                    _defaultLogoURL = defaultLogoURL;
032            }
033    
034            public void setEditLogoURL(String editLogoURL) {
035                    _editLogoURL = editLogoURL;
036            }
037    
038            public void setImageId(long imageId) {
039                    _imageId = imageId;
040            }
041    
042            public void setLogoDisplaySelector(String logoDisplaySelector) {
043                    _logoDisplaySelector = logoDisplaySelector;
044            }
045    
046            public void setShowBackground(boolean showBackground) {
047                    _showBackground = showBackground;
048            }
049    
050            @Override
051            protected void cleanUp() {
052                    _currentLogoURL = null;
053                    _defaultLogoURL = null;
054                    _editLogoURL = null;
055                    _imageId = 0;
056                    _logoDisplaySelector = null;
057                    _showBackground = true;
058            }
059    
060            @Override
061            protected String getPage() {
062                    return _PAGE;
063            }
064    
065            @Override
066            protected void setAttributes(HttpServletRequest request) {
067                    request.setAttribute(
068                            "liferay-ui:logo-selector:currentLogoURL", _currentLogoURL);
069                    request.setAttribute(
070                            "liferay-ui:logo-selector:defaultLogoURL", _defaultLogoURL);
071                    request.setAttribute(
072                            "liferay-ui:logo-selector:editLogoURL", _editLogoURL);
073                    request.setAttribute(
074                            "liferay-ui:logo-selector:imageId", String.valueOf(_imageId));
075                    request.setAttribute(
076                            "liferay-ui:logo-selector:logoDisplaySelector",
077                            _logoDisplaySelector);
078                    request.setAttribute(
079                            "liferay-ui:logo-selector:showBackground",
080                            String.valueOf(_showBackground));
081            }
082    
083            private static final String _PAGE =
084                    "/html/taglib/ui/logo_selector/page.jsp";
085    
086            private String _currentLogoURL;
087            private String _defaultLogoURL;
088            private String _editLogoURL;
089            private long _imageId;
090            private String _logoDisplaySelector;
091            private boolean _showBackground = true;
092    
093    }