22
33import java .util .Hashtable ;
44import java .util .Locale ;
5+ import java .util .Map .Entry ;
56
67import swingjs .api .js .HTML5Applet ;
78
89@ SuppressWarnings ("rawtypes" )
910public class JSApp {
1011
1112 public JSApp () {
12- // Frame only; not applet
13+ // Frame entry point
1314 }
1415
1516 public JSApp (Hashtable <String , Object > params ) {
17+ // JApplet entry point
1618 setAppParams (params );
1719 }
18-
20+
21+ /**
22+ * Only called from setAppParams
23+ * @param name
24+ * @return
25+ */
1926 public String getParameter (String name ) {
20- String s = (String ) params .get (name );
21- System .out .println ("get parameter: " + name + " = " + s );
27+ String s = (String ) params .get (name .toLowerCase ());
2228 return (s == null ? null : "" + s ); // because it may not be a string in JavaScript if inherited from Info
2329 }
2430
25- protected Hashtable params ;
31+ protected Hashtable < String , Object > params ;
2632
2733 public String appletCodeBase ;
2834 public String appletIdiomaBase ;
@@ -52,6 +58,16 @@ public String getParameter(String name) {
5258 */
5359 protected void setAppParams (Hashtable <String , Object > params ) {
5460 this .params = params ;
61+ // Although we allow params to hold mixed-case keys,
62+ // we need to ensure that it has the lower-case version
63+ // It was an early design flaw, unfortunately.
64+ // At least for now, this is the solution.
65+ for (Entry <String , Object > e : params .entrySet ()) {
66+ String key = e .getKey ();
67+ String lckey = key .toLowerCase ();
68+ if (!key .equals (lckey ))
69+ params .put (lckey , e .getValue ());
70+ }
5571 String language = getParameter ("language" );
5672 if (language == null )
5773 language = JSUtil .J2S .getDefaultLanguage (false );
@@ -63,18 +79,18 @@ protected void setAppParams(Hashtable<String, Object> params) {
6379
6480 syncId = getParameter ("syncId" );
6581 fullName = htmlName + "__" + syncId + "__" ;
66- params .put ("fullName " , fullName );
67- Object o = params .get ("codePath " );
82+ params .put ("fullname " , fullName );
83+ Object o = params .get ("codepath " );
6884 if (o == null )
6985 o = "../java/" ;
7086 appletCodeBase = o .toString ();
7187 appletIdiomaBase = appletCodeBase .substring (0 ,
7288 appletCodeBase .lastIndexOf ("/" , appletCodeBase .length () - 2 ) + 1 )
7389 + "idioma" ;
74- o = params .get ("documentBase " );
90+ o = params .get ("documentbase " );
7591 appletDocumentBase = (o == null ? "" : o .toString ());
76- if (params .containsKey ("maximumSize " ))
77- Math .max (((Integer ) params .get ("maximumSize " )).intValue (), 100 );
92+ if (params .containsKey ("maximumsize " ))
93+ Math .max (((Integer ) params .get ("maximumsize " )).intValue (), 100 );
7894 async = (testAsync || params .containsKey ("async" ));
7995 HTML5Applet applet = JSUtil .J2S .findApplet (htmlName );
8096 String javaver = JSUtil .J2S .getJavaVersion ();
0 commit comments