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 Sergio Gonz??lez
023     */
024    public class ImageSelectorTag extends IncludeTag {
025    
026            public void setFileEntryId(long fileEntryId) {
027                    _fileEntryId = fileEntryId;
028            }
029    
030            public void setParamName(String paramName) {
031                    _paramName = paramName;
032            }
033    
034            public void setValidExtensions(String validExtensions) {
035                    _validExtensions = validExtensions;
036            }
037    
038            @Override
039            protected void cleanUp() {
040                    _fileEntryId = 0;
041                    _paramName = "imageSelectorFileEntryId";
042                    _validExtensions = null;
043            }
044    
045            @Override
046            protected String getPage() {
047                    return _PAGE;
048            }
049    
050            @Override
051            protected void setAttributes(HttpServletRequest request) {
052                    request.setAttribute(
053                            "liferay-ui:image-selector:fileEntryId", _fileEntryId);
054                    request.setAttribute("liferay-ui:image-selector:paramName", _paramName);
055                    request.setAttribute(
056                            "liferay-ui:image-selector:validExtensions", _validExtensions);
057            }
058    
059            private static final String _PAGE =
060                    "/html/taglib/ui/image_selector/page.jsp";
061    
062            private long _fileEntryId;
063            private String _paramName = "imageSelectorFileEntryId";
064            private String _validExtensions;
065    
066    }