001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }