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.portlet.expando.model;
016    
017    import com.liferay.portal.kernel.util.StringPool;
018    import com.liferay.portal.theme.ThemeDisplay;
019    import com.liferay.portlet.asset.AssetRendererFactoryRegistryUtil;
020    import com.liferay.portlet.asset.model.AssetRendererFactory;
021    
022    /**
023     * @author Jorge Ferrer
024     */
025    public abstract class BaseCustomAttributesDisplay
026            implements CustomAttributesDisplay {
027    
028            public long getClassNameId() {
029                    return _classNameId;
030            }
031    
032            @Override
033            public String getIconCssClass() {
034                    AssetRendererFactory<?> assetRendererFactory =
035                            AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(
036                                    getClassName());
037    
038                    if (assetRendererFactory != null) {
039                            return assetRendererFactory.getIconCssClass();
040                    }
041    
042                    return StringPool.BLANK;
043            }
044    
045            /**
046             * @deprecated As of 7.0.0, with no direct replacement
047             */
048            @Deprecated
049            @Override
050            public String getIconPath(ThemeDisplay themeDisplay) {
051                    return StringPool.BLANK;
052            }
053    
054            @Override
055            public String getPortletId() {
056                    return _portletId;
057            }
058    
059            @Override
060            public void setClassNameId(long classNameId) {
061                    _classNameId = classNameId;
062            }
063    
064            @Override
065            public void setPortletId(String portletId) {
066                    _portletId = portletId;
067            }
068    
069            private long _classNameId;
070            private String _portletId;
071    
072    }