X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2FUIDefaults.js;fp=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2FUIDefaults.js;h=3ea6d1be5462cbdcf745cf0488b44b8418a7053c;hp=40b2db3008207715c82e93d436d9120e1cd9b9d2;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/javax/swing/UIDefaults.js b/site/swingjs/j2s/javax/swing/UIDefaults.js index 40b2db3..3ea6d1b 100644 --- a/site/swingjs/j2s/javax/swing/UIDefaults.js +++ b/site/swingjs/j2s/javax/swing/UIDefaults.js @@ -1,281 +1,281 @@ -Clazz.declarePackage ("javax.swing"); -Clazz.load (["java.util.Hashtable", "java.util.Locale"], "javax.swing.UIDefaults", ["java.lang.Boolean", "$.Error", "java.util.HashMap", "$.Vector", "java.awt.Color", "$.Dimension", "$.Font", "$.Insets", "javax.swing.Icon", "$.SwingUtilities", "javax.swing.border.Border", "javax.swing.event.SwingPropertyChangeSupport", "swingjs.JSToolkit"], function () { -c$ = Clazz.decorateAsClass (function () { -this.changeSupport = null; -this.resourceBundles = null; -this.defaultLocale = null; -this.resourceCache = null; -Clazz.instantialize (this, arguments); -}, javax.swing, "UIDefaults", java.util.Hashtable); -Clazz.prepareFields (c$, function () { -this.defaultLocale = java.util.Locale.getDefault (); -}); -Clazz.makeConstructor (c$, -function () { -this.construct (700, .75); -}); -Clazz.makeConstructor (c$, -function (initialCapacity, loadFactor) { -Clazz.superConstructor (this, javax.swing.UIDefaults, [initialCapacity, loadFactor]); -this.resourceCache = new java.util.HashMap (); -}, "~N,~N"); -Clazz.makeConstructor (c$, -function (keyValueList) { -Clazz.superConstructor (this, javax.swing.UIDefaults, [Clazz.doubleToInt (keyValueList.length / 2)]); -for (var i = 0; i < keyValueList.length; i += 2) { -Clazz.superCall (this, javax.swing.UIDefaults, "put", [keyValueList[i], keyValueList[i + 1]]); -} -}, "~A"); -Clazz.defineMethod (c$, "get", -function (key) { -var value = this.getFromHashtable (key); -return (value != null) ? value : this.getFromResourceBundle (key, null); -}, "~O"); -Clazz.defineMethod (c$, "getFromHashtable", - function (key) { -var value = Clazz.superCall (this, javax.swing.UIDefaults, "get", [key]); -if (value == null && (Clazz.instanceOf (key, String))) { -var skey = key; -if (skey.endsWith (".font") || skey.endsWith (".background") || skey.endsWith (".foreground")) value = Clazz.superCall (this, javax.swing.UIDefaults, "get", ["*" + skey.substring (skey.lastIndexOf ("."))]); -}if ((value !== javax.swing.UIDefaults.PENDING) && !(Clazz.instanceOf (value, javax.swing.UIDefaults.ActiveValue)) && !(Clazz.instanceOf (value, javax.swing.UIDefaults.LazyValue))) { -return value; -}if (!(Clazz.instanceOf (value, javax.swing.UIDefaults.ActiveValue))) { -return value; -}if (Clazz.instanceOf (value, javax.swing.UIDefaults.LazyValue)) { -try { -value = (value).createValue (this); -} finally { -if (value == null) { -Clazz.superCall (this, javax.swing.UIDefaults, "remove", [key]); -} else { -Clazz.superCall (this, javax.swing.UIDefaults, "put", [key, value]); -}} -} else { -value = (value).createValue (this); -}return value; -}, "~O"); -Clazz.defineMethod (c$, "get", -function (key, l) { -var value = this.getFromHashtable (key); -return (value != null) ? value : this.getFromResourceBundle (key, l); -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getFromResourceBundle", - function (key, l) { -if (this.resourceBundles == null || this.resourceBundles.isEmpty () || !(Clazz.instanceOf (key, String))) { -return null; -}if (l == null) { -if (this.defaultLocale == null) return null; - else l = this.defaultLocale; -}{ -return this.getResourceCache (l).get (key); -}}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getResourceCache", - function (l) { -return null; -}, "java.util.Locale"); -Clazz.defineMethod (c$, "put", -function (key, value) { -var oldValue = (value == null) ? Clazz.superCall (this, javax.swing.UIDefaults, "remove", [key]) : Clazz.superCall (this, javax.swing.UIDefaults, "put", [key, value]); -if (Clazz.instanceOf (key, String)) { -this.firePropertyChange (key, oldValue, value); -}return oldValue; -}, "~O,~O"); -Clazz.defineMethod (c$, "putDefaults", -function (keyValueList) { -for (var i = 0, max = keyValueList.length; i < max; i += 2) { -var value = keyValueList[i + 1]; -if (value == null) { -Clazz.superCall (this, javax.swing.UIDefaults, "remove", [keyValueList[i]]); -} else { -Clazz.superCall (this, javax.swing.UIDefaults, "put", [keyValueList[i], value]); -}} -this.firePropertyChange ("UIDefaults", null, null); -}, "~A"); -Clazz.defineMethod (c$, "getFont", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, java.awt.Font)) ? value : null; -}, "~O"); -Clazz.defineMethod (c$, "getFont", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, java.awt.Font)) ? value : null; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getColor", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, java.awt.Color)) ? value : null; -}, "~O"); -Clazz.defineMethod (c$, "getColor", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, java.awt.Color)) ? value : null; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getIcon", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, javax.swing.Icon)) ? value : null; -}, "~O"); -Clazz.defineMethod (c$, "getIcon", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, javax.swing.Icon)) ? value : null; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getBorder", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, javax.swing.border.Border)) ? value : null; -}, "~O"); -Clazz.defineMethod (c$, "getBorder", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, javax.swing.border.Border)) ? value : null; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getString", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, String)) ? value : null; -}, "~O"); -Clazz.defineMethod (c$, "getString", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, String)) ? value : null; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getInt", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, Integer)) ? (value).intValue () : 0; -}, "~O"); -Clazz.defineMethod (c$, "getInt", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, Integer)) ? (value).intValue () : 0; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getBoolean", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, Boolean)) ? (value).booleanValue () : false; -}, "~O"); -Clazz.defineMethod (c$, "getBoolean", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, Boolean)) ? (value).booleanValue () : false; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getInsets", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, java.awt.Insets)) ? value : null; -}, "~O"); -Clazz.defineMethod (c$, "getInsets", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, java.awt.Insets)) ? value : null; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getDimension", -function (key) { -var value = this.get (key); -return (Clazz.instanceOf (value, java.awt.Dimension)) ? value : null; -}, "~O"); -Clazz.defineMethod (c$, "getDimension", -function (key, l) { -var value = this.get (key, l); -return (Clazz.instanceOf (value, java.awt.Dimension)) ? value : null; -}, "~O,java.util.Locale"); -Clazz.defineMethod (c$, "getUIClass", -function (uiClassID, uiClassLoader) { -try { -var className = this.get (uiClassID); -if (className != null) { -var cls = this.get (className); -if (cls == null) { -if (uiClassLoader == null) { -cls = javax.swing.SwingUtilities.loadSystemClass (className); -} else { -cls = uiClassLoader.loadClass (className); -}if (cls != null) { -this.put (className, cls); -}}return cls; -}} catch (e$$) { -if (Clazz.exceptionOf (e$$, ClassNotFoundException)) { -var e = e$$; -{ -return null; -} -} else if (Clazz.exceptionOf (e$$, ClassCastException)) { -var e = e$$; -{ -return null; -} -} else { -throw e$$; -} -} -return null; -}, "~S,ClassLoader"); -Clazz.defineMethod (c$, "getUIClass", -function (uiClassID) { -return this.getUIClass (uiClassID, null); -}, "~S"); -Clazz.defineMethod (c$, "getUIError", -function (msg) { -System.err.println ("UIDefaults.getUI() failed: " + msg); -try { -throw new Error (); -} catch (e) { -e.printStackTrace (); -} -}, "~S"); -Clazz.defineMethod (c$, "getUI", -function (target) { -return swingjs.JSToolkit.getComponentUI (target); -}, "javax.swing.JComponent"); -Clazz.defineMethod (c$, "addPropertyChangeListener", -function (listener) { -if (this.changeSupport == null) { -this.changeSupport = new javax.swing.event.SwingPropertyChangeSupport (this); -}this.changeSupport.addPropertyChangeListener (listener); -}, "java.beans.PropertyChangeListener"); -Clazz.defineMethod (c$, "removePropertyChangeListener", -function (listener) { -if (this.changeSupport != null) { -this.changeSupport.removePropertyChangeListener (listener); -}}, "java.beans.PropertyChangeListener"); -Clazz.defineMethod (c$, "getPropertyChangeListeners", -function () { -if (this.changeSupport == null) { -return new Array (0); -}return this.changeSupport.getPropertyChangeListeners (); -}); -Clazz.defineMethod (c$, "firePropertyChange", -function (propertyName, oldValue, newValue) { -if (this.changeSupport != null) { -this.changeSupport.firePropertyChange (propertyName, oldValue, newValue); -}}, "~S,~O,~O"); -Clazz.defineMethod (c$, "addResourceBundle", -function (bundleName) { -if (bundleName == null) { -return; -}if (this.resourceBundles == null) { -this.resourceBundles = new java.util.Vector (5); -}if (!this.resourceBundles.contains (bundleName)) { -this.resourceBundles.add (bundleName); -this.resourceCache.clear (); -}}, "~S"); -Clazz.defineMethod (c$, "removeResourceBundle", -function (bundleName) { -if (this.resourceBundles != null) { -this.resourceBundles.remove (bundleName); -}this.resourceCache.clear (); -}, "~S"); -Clazz.defineMethod (c$, "setDefaultLocale", -function (l) { -this.defaultLocale = l; -}, "java.util.Locale"); -Clazz.defineMethod (c$, "getDefaultLocale", -function () { -return this.defaultLocale; -}); -Clazz.declareInterface (javax.swing.UIDefaults, "LazyValue"); -Clazz.declareInterface (javax.swing.UIDefaults, "ActiveValue"); -c$.PENDING = c$.prototype.PENDING = String.instantialize ("Pending"); -}); +Clazz.declarePackage ("javax.swing"); +Clazz.load (["java.util.Hashtable", "java.util.Locale"], "javax.swing.UIDefaults", ["java.lang.Boolean", "$.Error", "java.util.HashMap", "$.Vector", "java.awt.Color", "$.Dimension", "$.Font", "$.Insets", "javax.swing.Icon", "$.SwingUtilities", "javax.swing.border.Border", "javax.swing.event.SwingPropertyChangeSupport", "swingjs.JSToolkit"], function () { +c$ = Clazz.decorateAsClass (function () { +this.changeSupport = null; +this.resourceBundles = null; +this.defaultLocale = null; +this.resourceCache = null; +Clazz.instantialize (this, arguments); +}, javax.swing, "UIDefaults", java.util.Hashtable); +Clazz.prepareFields (c$, function () { +this.defaultLocale = java.util.Locale.getDefault (); +}); +Clazz.makeConstructor (c$, +function () { +this.construct (700, .75); +}); +Clazz.makeConstructor (c$, +function (initialCapacity, loadFactor) { +Clazz.superConstructor (this, javax.swing.UIDefaults, [initialCapacity, loadFactor]); +this.resourceCache = new java.util.HashMap (); +}, "~N,~N"); +Clazz.makeConstructor (c$, +function (keyValueList) { +Clazz.superConstructor (this, javax.swing.UIDefaults, [Clazz.doubleToInt (keyValueList.length / 2)]); +for (var i = 0; i < keyValueList.length; i += 2) { +Clazz.superCall (this, javax.swing.UIDefaults, "put", [keyValueList[i], keyValueList[i + 1]]); +} +}, "~A"); +Clazz.defineMethod (c$, "get", +function (key) { +var value = this.getFromHashtable (key); +return (value != null) ? value : this.getFromResourceBundle (key, null); +}, "~O"); +Clazz.defineMethod (c$, "getFromHashtable", + function (key) { +var value = Clazz.superCall (this, javax.swing.UIDefaults, "get", [key]); +if (value == null && (Clazz.instanceOf (key, String))) { +var skey = key; +if (skey.endsWith (".font") || skey.endsWith (".background") || skey.endsWith (".foreground")) value = Clazz.superCall (this, javax.swing.UIDefaults, "get", ["*" + skey.substring (skey.lastIndexOf ("."))]); +}if ((value !== javax.swing.UIDefaults.PENDING) && !(Clazz.instanceOf (value, javax.swing.UIDefaults.ActiveValue)) && !(Clazz.instanceOf (value, javax.swing.UIDefaults.LazyValue))) { +return value; +}if (!(Clazz.instanceOf (value, javax.swing.UIDefaults.ActiveValue))) { +return value; +}if (Clazz.instanceOf (value, javax.swing.UIDefaults.LazyValue)) { +try { +value = (value).createValue (this); +} finally { +if (value == null) { +Clazz.superCall (this, javax.swing.UIDefaults, "remove", [key]); +} else { +Clazz.superCall (this, javax.swing.UIDefaults, "put", [key, value]); +}} +} else { +value = (value).createValue (this); +}return value; +}, "~O"); +Clazz.defineMethod (c$, "get", +function (key, l) { +var value = this.getFromHashtable (key); +return (value != null) ? value : this.getFromResourceBundle (key, l); +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getFromResourceBundle", + function (key, l) { +if (this.resourceBundles == null || this.resourceBundles.isEmpty () || !(Clazz.instanceOf (key, String))) { +return null; +}if (l == null) { +if (this.defaultLocale == null) return null; + else l = this.defaultLocale; +}{ +return this.getResourceCache (l).get (key); +}}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getResourceCache", + function (l) { +return null; +}, "java.util.Locale"); +Clazz.defineMethod (c$, "put", +function (key, value) { +var oldValue = (value == null) ? Clazz.superCall (this, javax.swing.UIDefaults, "remove", [key]) : Clazz.superCall (this, javax.swing.UIDefaults, "put", [key, value]); +if (Clazz.instanceOf (key, String)) { +this.firePropertyChange (key, oldValue, value); +}return oldValue; +}, "~O,~O"); +Clazz.defineMethod (c$, "putDefaults", +function (keyValueList) { +for (var i = 0, max = keyValueList.length; i < max; i += 2) { +var value = keyValueList[i + 1]; +if (value == null) { +Clazz.superCall (this, javax.swing.UIDefaults, "remove", [keyValueList[i]]); +} else { +Clazz.superCall (this, javax.swing.UIDefaults, "put", [keyValueList[i], value]); +}} +this.firePropertyChange ("UIDefaults", null, null); +}, "~A"); +Clazz.defineMethod (c$, "getFont", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, java.awt.Font)) ? value : null; +}, "~O"); +Clazz.defineMethod (c$, "getFont", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, java.awt.Font)) ? value : null; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getColor", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, java.awt.Color)) ? value : null; +}, "~O"); +Clazz.defineMethod (c$, "getColor", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, java.awt.Color)) ? value : null; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getIcon", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, javax.swing.Icon)) ? value : null; +}, "~O"); +Clazz.defineMethod (c$, "getIcon", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, javax.swing.Icon)) ? value : null; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getBorder", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, javax.swing.border.Border)) ? value : null; +}, "~O"); +Clazz.defineMethod (c$, "getBorder", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, javax.swing.border.Border)) ? value : null; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getString", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, String)) ? value : null; +}, "~O"); +Clazz.defineMethod (c$, "getString", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, String)) ? value : null; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getInt", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, Integer)) ? (value).intValue () : 0; +}, "~O"); +Clazz.defineMethod (c$, "getInt", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, Integer)) ? (value).intValue () : 0; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getBoolean", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, Boolean)) ? (value).booleanValue () : false; +}, "~O"); +Clazz.defineMethod (c$, "getBoolean", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, Boolean)) ? (value).booleanValue () : false; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getInsets", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, java.awt.Insets)) ? value : null; +}, "~O"); +Clazz.defineMethod (c$, "getInsets", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, java.awt.Insets)) ? value : null; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getDimension", +function (key) { +var value = this.get (key); +return (Clazz.instanceOf (value, java.awt.Dimension)) ? value : null; +}, "~O"); +Clazz.defineMethod (c$, "getDimension", +function (key, l) { +var value = this.get (key, l); +return (Clazz.instanceOf (value, java.awt.Dimension)) ? value : null; +}, "~O,java.util.Locale"); +Clazz.defineMethod (c$, "getUIClass", +function (uiClassID, uiClassLoader) { +try { +var className = this.get (uiClassID); +if (className != null) { +var cls = this.get (className); +if (cls == null) { +if (uiClassLoader == null) { +cls = javax.swing.SwingUtilities.loadSystemClass (className); +} else { +cls = uiClassLoader.loadClass (className); +}if (cls != null) { +this.put (className, cls); +}}return cls; +}} catch (e$$) { +if (Clazz.exceptionOf (e$$, ClassNotFoundException)) { +var e = e$$; +{ +return null; +} +} else if (Clazz.exceptionOf (e$$, ClassCastException)) { +var e = e$$; +{ +return null; +} +} else { +throw e$$; +} +} +return null; +}, "~S,ClassLoader"); +Clazz.defineMethod (c$, "getUIClass", +function (uiClassID) { +return this.getUIClass (uiClassID, null); +}, "~S"); +Clazz.defineMethod (c$, "getUIError", +function (msg) { +System.err.println ("UIDefaults.getUI() failed: " + msg); +try { +throw new Error (); +} catch (e) { +e.printStackTrace (); +} +}, "~S"); +Clazz.defineMethod (c$, "getUI", +function (target) { +return swingjs.JSToolkit.getComponentUI (target); +}, "javax.swing.JComponent"); +Clazz.defineMethod (c$, "addPropertyChangeListener", +function (listener) { +if (this.changeSupport == null) { +this.changeSupport = new javax.swing.event.SwingPropertyChangeSupport (this); +}this.changeSupport.addPropertyChangeListener (listener); +}, "java.beans.PropertyChangeListener"); +Clazz.defineMethod (c$, "removePropertyChangeListener", +function (listener) { +if (this.changeSupport != null) { +this.changeSupport.removePropertyChangeListener (listener); +}}, "java.beans.PropertyChangeListener"); +Clazz.defineMethod (c$, "getPropertyChangeListeners", +function () { +if (this.changeSupport == null) { +return new Array (0); +}return this.changeSupport.getPropertyChangeListeners (); +}); +Clazz.defineMethod (c$, "firePropertyChange", +function (propertyName, oldValue, newValue) { +if (this.changeSupport != null) { +this.changeSupport.firePropertyChange (propertyName, oldValue, newValue); +}}, "~S,~O,~O"); +Clazz.defineMethod (c$, "addResourceBundle", +function (bundleName) { +if (bundleName == null) { +return; +}if (this.resourceBundles == null) { +this.resourceBundles = new java.util.Vector (5); +}if (!this.resourceBundles.contains (bundleName)) { +this.resourceBundles.add (bundleName); +this.resourceCache.clear (); +}}, "~S"); +Clazz.defineMethod (c$, "removeResourceBundle", +function (bundleName) { +if (this.resourceBundles != null) { +this.resourceBundles.remove (bundleName); +}this.resourceCache.clear (); +}, "~S"); +Clazz.defineMethod (c$, "setDefaultLocale", +function (l) { +this.defaultLocale = l; +}, "java.util.Locale"); +Clazz.defineMethod (c$, "getDefaultLocale", +function () { +return this.defaultLocale; +}); +Clazz.declareInterface (javax.swing.UIDefaults, "LazyValue"); +Clazz.declareInterface (javax.swing.UIDefaults, "ActiveValue"); +c$.PENDING = c$.prototype.PENDING = String.instantialize ("Pending"); +});