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.ui;
016    
017    import com.liferay.taglib.util.IncludeTag;
018    
019    import javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Chema Balsas
023     */
024    public class MapTag extends IncludeTag {
025    
026            public void setApiKey(String apiKey) {
027                    _apiKey = apiKey;
028            }
029    
030            public void setGeolocation(boolean geolocation) {
031                    _geolocation = geolocation;
032            }
033    
034            public void setLatitude(double latitude) {
035                    _latitude = latitude;
036            }
037    
038            public void setLongitude(double longitude) {
039                    _longitude = longitude;
040            }
041    
042            public void setName(String name) {
043                    _name = name;
044            }
045    
046            public void setPoints(String points) {
047                    _points = points;
048            }
049    
050            public void setProvider(String provider) {
051                    _provider = provider;
052            }
053    
054            @Override
055            protected void cleanUp() {
056                    _apiKey = null;
057                    _geolocation = false;
058                    _latitude = 0;
059                    _longitude = 0;
060                    _name = null;
061                    _points = null;
062                    _provider = null;
063            }
064    
065            @Override
066            protected String getPage() {
067                    return _PAGE;
068            }
069    
070            @Override
071            protected void setAttributes(HttpServletRequest request) {
072                    request.setAttribute("liferay-ui:map:apiKey", _apiKey);
073                    request.setAttribute("liferay-ui:map:geolocation", _geolocation);
074                    request.setAttribute("liferay-ui:map:latitude", _latitude);
075                    request.setAttribute("liferay-ui:map:longitude", _longitude);
076                    request.setAttribute("liferay-ui:map:name", _name);
077                    request.setAttribute("liferay-ui:map:points", _points);
078                    request.setAttribute("liferay-ui:map:provider", _provider);
079            }
080    
081            private static final String _PAGE = "/html/taglib/ui/map/page.jsp";
082    
083            private String _apiKey;
084            private boolean _geolocation;
085            private double _latitude;
086            private double _longitude;
087            private String _name;
088            private String _points;
089            private String _provider;
090    
091    }