001    package net.sourceforge.mp3dings.filter;
002    
003    /* Mp3dings - manage mp3 meta-information
004     * Copyright (C) 2003 Moritz Ringler
005     * $Id: FilterSetCustomizer.java 43 2007-10-20 17:39:59Z ringler $
006     *
007     * This program is free software; you can redistribute it and/or
008     * modify it under the terms of the GNU General Public License
009     * as published by the Free Software Foundation; either version 2
010     * of the License, or (at your option) any later version.
011     *
012     * This program is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015     * GNU General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * along with this program; if not, write to the Free Software
019     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020     */
021    
022    import java.awt.Component;
023    import java.util.prefs.BackingStoreException;
024    import javax.swing.tree.DefaultMutableTreeNode;
025    import javax.swing.tree.MutableTreeNode;
026    import net.sourceforge.mp3dings.Globals;
027    import net.sourceforge.mp3dings.preferences.PrefModule;
028    import net.sourceforge.mp3dings.utils.BeanSetCustomizer;
029    
030    /**
031     * A GUI component that manages a set of filter beans.
032     * @see FilterBean
033     * @author Moritz Ringler
034     * @version $Revision: 43 $ ($Date: 2007-10-20 19:39:59 +0200 (Sa, 20 Okt 2007) $)
035     */
036    public class FilterSetCustomizer extends BeanSetCustomizer implements PrefModule{
037        private MutableTreeNode myTreeNode = new DefaultMutableTreeNode(this);
038    
039        public FilterSetCustomizer() throws BackingStoreException{
040            super(Globals.getString("PREF_TREE_FILTER"));
041            registerType(FilterBean.class);
042            registerType(StringSelector.class);
043            registerType(StringReplacer.class);
044            registerType(SubstringFilter.class);
045            registerType(NumericFilter.class);
046            registerType(BeanShellFilter.class);
047            load(net.sourceforge.mp3dings.filter.FilterBean.class);
048            setSavePath(Globals.getDir("FILTERS"));
049        }
050    
051        public boolean isSavable(){
052            return super.isSavable();
053        }
054    
055        public void showInvalidPanel(){
056            showFirstInvalidBean();
057        }
058    
059        public String toString(){
060            return getName();
061        }
062    
063        public MutableTreeNode getTreeNode(){
064            return myTreeNode;
065        }
066    
067        public Component getComponent(){
068            return this;
069        }
070    }