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.theme.ThemeDisplay;
018    import com.liferay.portlet.asset.AssetRendererFactoryRegistryUtil;
019    import com.liferay.portlet.asset.model.AssetRendererFactory;
020    
021    /**
022     * @author Jorge Ferrer
023     */
024    public abstract class BaseCustomAttributesDisplay
025            implements CustomAttributesDisplay {
026    
027            public long getClassNameId() {
028                    return _classNameId;
029            }
030    
031            @Override
032            public String getIconCssClass() {
033                    AssetRendererFactory<?> assetRendererFactory =
034                            AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(
035                                    getClassName());
036    
037                    if (assetRendererFactory != null) {
038                            return assetRendererFactory.getIconCssClass();
039                    }
040    
041                    return "icon-file-alt";
042            }
043    
044            @Override
045            public String getIconPath(ThemeDisplay themeDisplay) {
046                    return themeDisplay.getPathThemeImages() + "/common/page.png";
047            }
048    
049            @Override
050            public String getPortletId() {
051                    return _portletId;
052            }
053    
054            @Override
055            public void setClassNameId(long classNameId) {
056                    _classNameId = classNameId;
057            }
058    
059            @Override
060            public void setPortletId(String portletId) {
061                    _portletId = portletId;
062            }
063    
064            private long _classNameId;
065            private String _portletId;
066    
067    }