KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcckit > util > AppletBasedConfigData


1 /*
2  * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
3  *
4  * This library is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details
13  * (http://www.gnu.org/copyleft/lesser.html).
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package jcckit.util;
20
21 import java.applet.Applet JavaDoc;
22
23 /**
24  * Implementation of {@link FlatConfigData} based on
25  * <tt>java.applet.Applet</tt>.
26  *
27  * @author Franz-Josef Elmer
28  */

29 public class AppletBasedConfigData extends FlatConfigData {
30   private final Applet JavaDoc _applet;
31
32   /**
33    * Creates an instance based on the specified applet.
34    * The path is undefined.
35    */

36   public AppletBasedConfigData(Applet JavaDoc applet) {
37     this(applet, null);
38   }
39
40   /** Creates an instance based on the specified properties and path. */
41   private AppletBasedConfigData(Applet JavaDoc applet, String JavaDoc path) {
42     super(path);
43     _applet = applet;
44   }
45
46   protected String JavaDoc getValue(String JavaDoc fullKey) {
47     return _applet.getParameter(fullKey);
48   }
49
50   protected ConfigData createConfigData(String JavaDoc path) {
51     return new AppletBasedConfigData(_applet, path);
52   }
53 }
54
Popular Tags