Skip to content

Commit 272041b

Browse files
committed
HTML5Video interface; adds System.out.println("\0") clears output
1 parent 2808d4a commit 272041b

File tree

16 files changed

+863
-399
lines changed

16 files changed

+863
-399
lines changed
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200420001218
1+
20200421161724
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200420001218
1+
20200421161724
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/JSComponent.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,16 +582,25 @@ public void removeKeyListener(KeyListener l) {
582582
}
583583

584584

585-
protected Graphics 秘checkG() {
585+
/**
586+
* Check that a local graphic has the correct size of canvas, and if it does not,
587+
* replace it. Maybe could just flat out change its size.
588+
*
589+
* @return the JSGraphics coercion of the possibly new JSGraphics object as a "Graphics"
590+
*/
591+
protected JSGraphics2D 秘checkG() {
592+
// I know, it's an insane amount of cast coercion
586593
boolean isNew = ((Object) 秘g) == Boolean.TRUE;
587594
if (isNew || 秘g.getWidth() != width || 秘g.getHeight() != height) {
588595
if (!isNew)
589596
DOMNode.dispose(秘g.getCanvas());
590597
秘g = (JSGraphics2D) (Object) ((BufferedImage) createImage(width, height)).秘getImageGraphic();
591598
DOMNode c = 秘g.getCanvas();
592-
秘getUI().getDOMNode().prepend(c);
599+
DOMNode d = 秘getUI().getDOMNode();
600+
if (d != c)
601+
d.prepend(c);
593602
}
594-
return (Graphics) (Object) this.秘g;
603+
return this.秘g;
595604
}
596605

597606
/**

sources/net.sf.j2s.java.core/src/java/util/logging/Level.java

Lines changed: 78 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ public class Level implements java.io.Serializable {
7979
/**
8080
* @serial The resource bundle name to be used in localizing the level name.
8181
*/
82-
private final String resourceBundleName;
82+
//private final String resourceBundleName;
8383

8484
// localized level name
85-
private transient String localizedLevelName;
86-
private transient Locale cachedLocale;
85+
// SwingJS -- not worth the trouble or extra file loading
86+
// private transient String localizedLevelName;
87+
// private transient Locale cachedLocale;
8788

8889
/**
8990
* OFF is a special level that can be used to turn off logging.
@@ -215,9 +216,9 @@ private Level(String name, int value, String resourceBundleName, boolean visible
215216
}
216217
this.name = name;
217218
this.value = value;
218-
this.resourceBundleName = resourceBundleName;
219-
this.localizedLevelName = resourceBundleName == null ? name : null;
220-
this.cachedLocale = null;
219+
// this.resourceBundleName = resourceBundleName;
220+
// this.localizedLevelName = resourceBundleName == null ? name : null;
221+
// this.cachedLocale = null;
221222
if (visible) {
222223
KnownLevel.add(this);
223224
}
@@ -230,7 +231,7 @@ private Level(String name, int value, String resourceBundleName, boolean visible
230231
* @return localization resource bundle name
231232
*/
232233
public String getResourceBundleName() {
233-
return resourceBundleName;
234+
return null;//resourceBundleName;
234235
}
235236

236237
/**
@@ -261,72 +262,73 @@ final String getLevelName() {
261262
return this.name;
262263
}
263264

264-
private String computeLocalizedLevelName(Locale newLocale) {
265-
ResourceBundle rb = ResourceBundle.getBundle(resourceBundleName, newLocale);
266-
final String localizedName = rb.getString(name);
267-
268-
final boolean isDefaultBundle = defaultBundle.equals(resourceBundleName);
269-
if (!isDefaultBundle) return localizedName;
270-
271-
// This is a trick to determine whether the name has been translated
272-
// or not. If it has not been translated, we need to use Locale.ROOT
273-
// when calling toUpperCase().
274-
final Locale rbLocale = rb.getLocale();
275-
final Locale locale =
276-
Locale.ROOT.equals(rbLocale)
277-
|| name.equals(localizedName.toUpperCase(Locale.ROOT))
278-
? Locale.ROOT : rbLocale;
279-
280-
// ALL CAPS in a resource bundle's message indicates no translation
281-
// needed per Oracle translation guideline. To workaround this
282-
// in Oracle JDK implementation, convert the localized level name
283-
// to uppercase for compatibility reason.
284-
return Locale.ROOT.equals(locale) ? name : localizedName.toUpperCase(locale);
285-
}
265+
// private String computeLocalizedLevelName(Locale newLocale) {
266+
// ResourceBundle rb = ResourceBundle.getBundle(resourceBundleName, newLocale);
267+
// final String localizedName = rb.getString(name);
268+
//
269+
// final boolean isDefaultBundle = defaultBundle.equals(resourceBundleName);
270+
// if (!isDefaultBundle) return localizedName;
271+
//
272+
// // This is a trick to determine whether the name has been translated
273+
// // or not. If it has not been translated, we need to use Locale.ROOT
274+
// // when calling toUpperCase().
275+
// final Locale rbLocale = rb.getLocale();
276+
// final Locale locale =
277+
// Locale.ROOT.equals(rbLocale)
278+
// || name.equals(localizedName.toUpperCase(Locale.ROOT))
279+
// ? Locale.ROOT : rbLocale;
280+
//
281+
// // ALL CAPS in a resource bundle's message indicates no translation
282+
// // needed per Oracle translation guideline. To workaround this
283+
// // in Oracle JDK implementation, convert the localized level name
284+
// // to uppercase for compatibility reason.
285+
// return Locale.ROOT.equals(locale) ? name : localizedName.toUpperCase(locale);
286+
// }
286287

287288
// Avoid looking up the localizedLevelName twice if we already
288289
// have it.
289-
final String getCachedLocalizedLevelName() {
290-
291-
if (localizedLevelName != null) {
292-
if (cachedLocale != null) {
293-
if (cachedLocale.equals(Locale.getDefault())) {
294-
// OK: our cached value was looked up with the same
295-
// locale. We can use it.
296-
return localizedLevelName;
297-
}
298-
}
299-
}
300-
301-
if (resourceBundleName == null) {
302-
// No resource bundle: just use the name.
303-
return name;
304-
}
305-
306-
// We need to compute the localized name.
307-
// Either because it's the first time, or because our cached
308-
// value is for a different locale. Just return null.
309-
return null;
310-
}
290+
// final String getCachedLocalizedLevelName() {
291+
//
292+
// if (localizedLevelName != null) {
293+
// if (cachedLocale != null) {
294+
// if (cachedLocale.equals(Locale.getDefault())) {
295+
// // OK: our cached value was looked up with the same
296+
// // locale. We can use it.
297+
// return localizedLevelName;
298+
// }
299+
// }
300+
// }
301+
//
302+
// if (resourceBundleName == null) {
303+
// // No resource bundle: just use the name.
304+
// return name;
305+
// }
306+
//
307+
// // We need to compute the localized name.
308+
// // Either because it's the first time, or because our cached
309+
// // value is for a different locale. Just return null.
310+
// return null;
311+
// }
311312

312313
final synchronized String getLocalizedLevelName() {
313-
314-
// See if we have a cached localized name
315-
final String cachedLocalizedName = getCachedLocalizedLevelName();
316-
if (cachedLocalizedName != null) {
317-
return cachedLocalizedName;
318-
}
319-
320-
// No cached localized name or cache invalid.
321-
// Need to compute the localized name.
322-
final Locale newLocale = Locale.getDefault();
323-
try {
324-
localizedLevelName = computeLocalizedLevelName(newLocale);
325-
} catch (Exception ex) {
326-
localizedLevelName = name;
327-
}
328-
cachedLocale = newLocale;
329-
return localizedLevelName;
314+
// SwingJS
315+
return name;
316+
// // See if we have a cached localized name
317+
// final String cachedLocalizedName = getCachedLocalizedLevelName();
318+
// if (cachedLocalizedName != null) {
319+
// return cachedLocalizedName;
320+
// }
321+
//
322+
// // No cached localized name or cache invalid.
323+
// // Need to compute the localized name.
324+
// final Locale newLocale = Locale.getDefault();
325+
// try {
326+
// localizedLevelName = computeLocalizedLevelName(newLocale);
327+
// } catch (Exception ex) {
328+
// localizedLevelName = name;
329+
// }
330+
// cachedLocale = newLocale;
331+
// return localizedLevelName;
330332
}
331333

332334
// Returns a mirrored Level object that matches the given name as
@@ -410,7 +412,7 @@ private Object readResolve() {
410412

411413
// Woops. Whoever sent us this object knows
412414
// about a new log level. Add it to our list.
413-
Level level = new Level(this.name, this.value, this.resourceBundleName);
415+
Level level = new Level(this.name, this.value, null);//this.resourceBundleName);
414416
return level;
415417
}
416418

@@ -536,7 +538,7 @@ static final class KnownLevel {
536538
this.mirroredLevel = l;
537539
} else {
538540
// this mirrored level object is hidden
539-
this.mirroredLevel = new Level(l.name, l.value, l.resourceBundleName, false);
541+
this.mirroredLevel = new Level(l.name, l.value, null, false);//l.resourceBundleName, false);
540542
}
541543
}
542544

@@ -599,10 +601,12 @@ static synchronized KnownLevel matches(Level l) {
599601
if (list != null) {
600602
for (KnownLevel level : list) {
601603
Level other = level.mirroredLevel;
602-
if (l.value == other.value &&
603-
(l.resourceBundleName == other.resourceBundleName ||
604-
(l.resourceBundleName != null &&
605-
l.resourceBundleName.equals(other.resourceBundleName)))) {
604+
if (l.value == other.value
605+
// &&
606+
// (l.resourceBundleName == other.resourceBundleName ||
607+
// (l.resourceBundleName != null &&
608+
// l.resourceBundleName.equals(other.resourceBundleName)))
609+
) {
606610
return level;
607611
}
608612
}

sources/net.sf.j2s.java.core/src/java/util/logging/LogRecord.java

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
import sun.misc.SharedSecrets;
3434

3535
/**
36+
*
37+
* SwingJS - disabled resourceBundle
38+
*
3639
* LogRecord objects are used to pass logging requests between
3740
* the logging framework and individual log Handlers.
3841
* <p>
@@ -139,7 +142,7 @@ public class LogRecord implements java.io.Serializable {
139142

140143
private transient boolean needToInferCaller;
141144
private transient Object parameters[];
142-
private transient ResourceBundle resourceBundle;
145+
// private transient ResourceBundle resourceBundle;
143146

144147
/**
145148
* Returns the default value for a new LogRecord's threadID.
@@ -214,7 +217,7 @@ public void setLoggerName(String name) {
214217
* @return the localization resource bundle
215218
*/
216219
public ResourceBundle getResourceBundle() {
217-
return resourceBundle;
220+
return null;//resourceBundle;
218221
}
219222

220223
/**
@@ -223,7 +226,7 @@ public ResourceBundle getResourceBundle() {
223226
* @param bundle localization bundle (may be null)
224227
*/
225228
public void setResourceBundle(ResourceBundle bundle) {
226-
resourceBundle = bundle;
229+
//resourceBundle = bundle;
227230
}
228231

229232
/**
@@ -510,23 +513,23 @@ private void readObject(ObjectInputStream in)
510513
parameters[i] = in.readObject();
511514
}
512515
}
513-
// If necessary, try to regenerate the resource bundle.
514-
if (resourceBundleName != null) {
515-
try {
516-
// use system class loader to ensure the ResourceBundle
517-
// instance is a different instance than null loader uses
518-
final ResourceBundle bundle =
519-
ResourceBundle.getBundle(resourceBundleName,
520-
Locale.getDefault(),
521-
ClassLoader.getSystemClassLoader());
522-
resourceBundle = bundle;
523-
} catch (MissingResourceException ex) {
524-
// This is not a good place to throw an exception,
525-
// so we simply leave the resourceBundle null.
526-
resourceBundle = null;
527-
}
528-
}
529-
516+
// // If necessary, try to regenerate the resource bundle.
517+
// if (resourceBundleName != null) {
518+
// try {
519+
// // use system class loader to ensure the ResourceBundle
520+
// // instance is a different instance than null loader uses
521+
// final ResourceBundle bundle =
522+
// ResourceBundle.getBundle(resourceBundleName,
523+
// Locale.getDefault(),
524+
// ClassLoader.getSystemClassLoader());
525+
// resourceBundle = bundle;
526+
// } catch (MissingResourceException ex) {
527+
// // This is not a good place to throw an exception,
528+
// // so we simply leave the resourceBundle null.
529+
// resourceBundle = null;
530+
// }
531+
// }
532+
//
530533
needToInferCaller = false;
531534
}
532535

0 commit comments

Comments
 (0)