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