001    /**
002     * Copyright (c) 2000-2013 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.portal.kernel.lar;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    
020    /**
021     * @author Raymond Aug??
022     */
023    public class PortletDataHandlerControl {
024    
025            public static String getNamespacedControlName(
026                    String namespace, String controlName) {
027    
028                    StringBundler sb = new StringBundler(4);
029    
030                    sb.append(StringPool.UNDERLINE);
031                    sb.append(namespace);
032                    sb.append(StringPool.UNDERLINE);
033                    sb.append(controlName);
034    
035                    return sb.toString();
036            }
037    
038            public PortletDataHandlerControl(String namespace, String controlName) {
039                    this(namespace, controlName, false);
040            }
041    
042            public PortletDataHandlerControl(
043                    String namespace, String controlName, boolean disabled) {
044    
045                    _namespace = namespace;
046                    _controlName = controlName;
047                    _disabled = disabled;
048            }
049    
050            public String getControlName() {
051                    return _controlName;
052            }
053    
054            public String getNamespace() {
055                    return _namespace;
056            }
057    
058            public String getNamespacedControlName() {
059                    return getNamespacedControlName(_namespace, getControlName());
060            }
061    
062            public boolean isDisabled() {
063                    return _disabled;
064            }
065    
066            private String _controlName;
067            private boolean _disabled;
068            private String _namespace;
069    
070    }