source: 3thparty/jmessenger/src/nu/fw/jeti/applet/PreferencesHandler.java @ 3952

Revision 3952, 2.5 KB checked in by alexandrecorreia, 13 years ago (diff)

Ticket #1710 - Adicao do codigo fonte java do componente jmessenger(jabberit_messenger)

  • Property svn:executable set to *
Line 
1/*
2 *      Jeti, a Java Jabber client, Copyright (C) 2003 E.S. de Boer 
3 *
4 *  This program is free software; you can redistribute it and/or modify
5 *  it under the terms of the GNU General Public License as published by
6 *  the Free Software Foundation; either version 2 of the License, or
7 *  (at your option) any later version.
8 *
9 *  This program is distributed in the hope that it will be useful,
10 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 *      GNU General Public License for more details.
13 *
14 *  You should have received a copy of the GNU General Public License
15 *  along with this program; if not, write to the Free Software
16 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 *
18 *      For questions, comments etc,
19 *      use the website at http://jeti.jabberstudio.org
20 *  or mail me at eric@jeti.tk
21 *
22 *      Created on 14-aug-2003
23 */
24
25package nu.fw.jeti.applet;
26
27import java.util.HashMap;
28import java.util.Iterator;
29import java.util.List;
30import java.util.Map;
31
32import nu.fw.jeti.jabber.elements.Extension;
33import nu.fw.jeti.jabber.handlers.ExtensionHandler;
34import nu.fw.jeti.util.Preferences;
35
36import org.xml.sax.Attributes;
37
38/**
39 * @author E.S. de Boer
40 * @version 1.0
41 */
42
43public class PreferencesHandler extends ExtensionHandler
44{
45       
46        private Map preferences;
47        //private List plugins;
48        //private String xmlVersion;
49
50        public void startHandling(Attributes attributes)
51        {
52                preferences = new HashMap();
53                //xmlVersion = attributes.getValue("xmlVersion");
54        }
55
56        public void startElement(String qName,Attributes attrs)
57        {
58                if(qName.equals("plugin"))
59                {
60                        String type = attrs.getValue("type");
61                        String name = attrs.getValue("name");
62                        Boolean enabled = Boolean.valueOf(attrs.getValue("enabled"));
63                        List plugables=Preferences.getPlugable(type);
64                        boolean found = false;
65                        for(Iterator i=plugables.iterator();i.hasNext();)
66                        {
67                                Object[] o =(Object[])i.next();
68                                if(o[0].equals(name))
69                                {
70                                        o[1] =enabled;
71                                        found = true;
72                                }
73                        }
74                        if(!found)
75                        {
76                                Object[] temp = new Object[6];
77                                temp[0] = name;
78                                temp[1] = enabled;
79                                plugables.add(temp);
80                        }
81                }
82                else if(qName.equals("preference"))
83                {
84                        String key = attrs.getValue("key");
85                        String value = attrs.getValue("value");
86                        preferences.put(key,value);
87                }
88        }
89
90        public Extension build()
91        {
92                return new JetiPrivatePreferencesExtension(new Preferences(preferences));
93        }
94       
95}
96/*
97 * Overrides for emacs
98 * Local variables:
99 * tab-width: 4
100 * End:
101 */
Note: See TracBrowser for help on using the repository browser.