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.aui;
016    
017    import com.liferay.portal.kernel.util.TextFormatter;
018    import com.liferay.taglib.aui.base.BaseFieldWrapperTag;
019    
020    import javax.servlet.http.HttpServletRequest;
021    
022    /**
023     * @author Julio Camarero
024     * @author Jorge Ferrer
025     * @author Brian Wing Shun Chan
026     */
027    public class FieldWrapperTag extends BaseFieldWrapperTag {
028    
029            @Override
030            protected boolean isCleanUpSetAttributes() {
031                    return _CLEAN_UP_SET_ATTRIBUTES;
032            }
033    
034            @Override
035            protected void setAttributes(HttpServletRequest request) {
036                    super.setAttributes(request);
037    
038                    String label = getLabel();
039    
040                    if (label == null) {
041                            label = TextFormatter.format(getName(), TextFormatter.P);
042                    }
043    
044                    setNamespacedAttribute(request, "label", label);
045            }
046    
047            private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
048    
049    }