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 setGeolocation(boolean geolocation) {
027                    _geolocation = geolocation;
028            }
029    
030            public void setLatitude(double latitude) {
031                    _latitude = latitude;
032            }
033    
034            public void setLongitude(double longitude) {
035                    _longitude = longitude;
036            }
037    
038            public void setName(String name) {
039                    _name = name;
040            }
041    
042            public void setPoints(String points) {
043                    _points = points;
044            }
045    
046            public void setProvider(String provider) {
047                    _provider = provider;
048            }
049    
050            @Override
051            protected void cleanUp() {
052                    _geolocation = false;
053                    _latitude = 0;
054                    _longitude = 0;
055                    _name = null;
056                    _points = null;
057                    _provider = null;
058            }
059    
060            @Override
061            protected String getPage() {
062                    return _PAGE;
063            }
064    
065            @Override
066            protected void setAttributes(HttpServletRequest request) {
067                    request.setAttribute("liferay-ui:map:geolocation", _geolocation);
068                    request.setAttribute("liferay-ui:map:latitude", _latitude);
069                    request.setAttribute("liferay-ui:map:longitude", _longitude);
070                    request.setAttribute("liferay-ui:map:name", _name);
071                    request.setAttribute("liferay-ui:map:points", _points);
072                    request.setAttribute("liferay-ui:map:provider", _provider);
073            }
074    
075            private static final String _PAGE = "/html/taglib/ui/map/page.jsp";
076    
077            private boolean _geolocation;
078            private double _latitude;
079            private double _longitude;
080            private String _name;
081            private String _points;
082            private String _provider;
083    
084    }