001/* 002 * Copyright 2024 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.odf.tree; 017 018import org.apache.avalon.framework.configuration.Configuration; 019import org.apache.avalon.framework.configuration.ConfigurationException; 020 021import org.ametys.core.ui.StaticFileImportsClientSideElement; 022import org.ametys.runtime.i18n.I18nizableText; 023 024/** 025 * Abstract class for a static {@link ODFTreeIndicator} 026 * 027 */ 028public abstract class AbstractStaticODFTreeIndicator extends StaticFileImportsClientSideElement implements ODFTreeIndicator 029{ 030 private I18nizableText _label; 031 private I18nizableText _description; 032 private String _iconGlyph; 033 private int _priority; 034 private String _matchFn; 035 private String _applyFn; 036 037 @Override 038 public void configure(Configuration configuration) throws ConfigurationException 039 { 040 super.configure(configuration); 041 042 Configuration labelConf = configuration.getChild("label"); 043 _label = I18nizableText.getI18nizableTextValue(labelConf, "plugin." + _pluginName, labelConf.getValue(_id)); 044 045 Configuration descConf = configuration.getChild("description"); 046 _description = I18nizableText.getI18nizableTextValue(descConf, "plugin." + _pluginName, descConf.getValue("")); 047 048 _iconGlyph = configuration.getChild("icon-glyph").getValue(); 049 050 _priority = configuration.getChild("priority").getValueAsInteger(50); 051 052 _matchFn = configuration.getChild("matchFn").getValue(null); 053 _applyFn = configuration.getChild("applyFn").getValue(null); 054 } 055 056 public int getPriority() 057 { 058 return _priority; 059 } 060 061 public I18nizableText getLabel() 062 { 063 return _label; 064 } 065 066 public I18nizableText getDescription() 067 { 068 return _description; 069 } 070 071 public String getIconGlyph() 072 { 073 return _iconGlyph; 074 } 075 076 public String getMatchJSFunction() 077 { 078 return _matchFn; 079 } 080 081 public String getApplyJSFunction() 082 { 083 return _applyFn; 084 } 085}