001    /**
002     * Copyright (c) 2000-2011 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.portal.kernel.util.Validator;
018    import com.liferay.taglib.util.IncludeTag;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Julio Camarero
024     */
025    public class InputLocalizedTag extends IncludeTag {
026    
027            public void setCssClass(String cssClass) {
028                    _cssClass = cssClass;
029            }
030    
031            public void setDisabled(boolean disabled) {
032                    _disabled = disabled;
033            }
034    
035            public void setFormName(String formName) {
036                    _formName = formName;
037            }
038    
039            public void setLanguageId(String languageId) {
040                    _languageId = languageId;
041            }
042    
043            public void setName(String name) {
044                    _name = name;
045            }
046    
047            public void setType(String type) {
048                    _type = type;
049            }
050    
051            public void setXml(String xml) {
052                    _xml = xml;
053            }
054    
055            @Override
056            protected void cleanUp() {
057                    _cssClass = null;
058                    _disabled = false;
059                    _formName = null;
060                    _languageId = null;
061                    _name = null;
062                    _type = "input";
063                    _xml = null;
064            }
065    
066            @Override
067            protected String getPage() {
068                    return _PAGE;
069            }
070    
071            @Override
072            protected void setAttributes(HttpServletRequest request) {
073                    String formName = _formName;
074    
075                    if (Validator.isNull(formName)) {
076                            formName = "fm";
077                    }
078    
079                    request.setAttribute("liferay-ui:input-localized:cssClass", _cssClass);
080                    request.setAttribute(
081                            "liferay-ui:input-localized:disabled", String.valueOf(_disabled));
082                    request.setAttribute(
083                            "liferay-ui:input-localized:dynamicAttributes",
084                            getDynamicAttributes());
085                    request.setAttribute("liferay-ui:input-localized:formName", formName);
086                    request.setAttribute(
087                            "liferay-ui:input-localized:languageId", _languageId);
088                    request.setAttribute("liferay-ui:input-localized:name", _name);
089                    request.setAttribute("liferay-ui:input-localized:type", _type);
090                    request.setAttribute("liferay-ui:input-localized:xml", _xml);
091            }
092    
093            private static final String _PAGE =
094                    "/html/taglib/ui/input_localized/page.jsp";
095    
096            private String _cssClass;
097            private boolean _disabled;
098            private String _formName;
099            private String _languageId;
100            private String _name;
101            private String _type = "input";
102            private String _xml;
103    
104    }