annotate src/org/tn5250j/interfaces/ConfigureFactory.java @ 90:3f587bd647a5

convert ctrl keys to virtual keys; use proper android home directory
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jun 2014 12:34:05 -0700
parents e067ee54f638
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
1 /*
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
2 * @(#)ConfigureFactory.java
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
3 * @author Kenneth J. Pouncey
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
4 * Modified by LDC Luc
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
5 *
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
6 * Copyright: Copyright (c) 2001, 2002, 2003
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
7 *
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2, or (at your option)
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
11 * any later version.
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
12 *
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
16 * GNU General Public License for more details.
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
17 *
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
19 * along with this software; see the file COPYING. If not, write to
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
20 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
21 * Boston, MA 02111-1307 USA
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
22 *
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
23 */
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
24 package org.tn5250j.interfaces;
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
25
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
26 import org.tn5250j.GlobalConfigure;
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
27 import java.util.Properties;
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
28
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
29 /**
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
30 * An interface defining objects that can create Configure
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
31 * instances.
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
32 */
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
33 public abstract class ConfigureFactory {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
34
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
35 static final public String SESSIONS = "sessions";
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
36 static final public String MACROS = "macros";
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
37 static final public String KEYMAP = "keymap";
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
38 private static ConfigureFactory factory;
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
39
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
40 /**
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
41 * @return An instance of the Configure.
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
42 */
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
43 public static ConfigureFactory getInstance()
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
44 {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
45 ConfigureFactory.setFactory();
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
46 return factory;
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
47 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
48
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
49 private static final void setFactory()
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
50 {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
51 if (factory == null)
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
52 {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
53 try
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
54 {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
55 String className = System.getProperty(ConfigureFactory.class.getName());
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
56 if (className != null)
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
57 {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
58 Class<?> classObject = Class.forName(className);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
59 Object object = classObject.newInstance();
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
60 if (object instanceof ConfigureFactory)
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
61 {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
62 ConfigureFactory.factory = (ConfigureFactory) object;
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
63 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
64 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
65 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
66 catch (Exception ex)
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
67 {
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
68 ;
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
69 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
70 if (ConfigureFactory.factory == null)
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
71 { //take the default
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
72 // ConfigureFactory.factory = new GlobalConfigureFactory();
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
73 ConfigureFactory.factory = new GlobalConfigure();
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
74 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
75 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
76 }
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
77
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
78 abstract public void reloadSettings();
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
79 abstract public void saveSettings();
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
80 abstract public String getProperty(String regKey);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
81 abstract public String getProperty(String regKey, String defaultValue);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
82 abstract public void setProperties(String regKey, Properties regProps);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
83
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
84 abstract public void setProperties(String regKey, String fileName, String header);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
85 abstract public void setProperties(String regKey, String fileName, String header,
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
86 boolean createFile);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
87 abstract public Properties getProperties(String regKey);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
88 abstract public Properties getProperties(String regKey,String fileName);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
89 abstract public Properties getProperties(String regKey,String fileName,
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
90 boolean createFile, String header);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
91 abstract public Properties getProperties(String regKey,String fileName,
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
92 boolean createFile, String header,
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
93 boolean reloadIfLoaded);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
94 abstract public void saveSettings(String regKey);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
95 abstract public void saveSettings(String regKey, String header);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
96 abstract public void saveSettings(String regKey, String fileName, String header);
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
97
e067ee54f638 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
98 }