X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjssun%2Fawt%2Fimage%2FInputStreamImageSource.js;fp=site%2Fswingjs%2Fj2s%2Fjssun%2Fawt%2Fimage%2FInputStreamImageSource.js;h=4f9f1cbb97f5aac6c06a84f834a6de12fffa5784;hp=b0533328e03f15f2fdc58ec058012f63e154f5c1;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/jssun/awt/image/InputStreamImageSource.js b/site/swingjs/j2s/jssun/awt/image/InputStreamImageSource.js index b053332..4f9f1cb 100644 --- a/site/swingjs/j2s/jssun/awt/image/InputStreamImageSource.js +++ b/site/swingjs/j2s/jssun/awt/image/InputStreamImageSource.js @@ -1,213 +1,213 @@ -Clazz.declarePackage ("jssun.awt.image"); -Clazz.load (["java.awt.image.ImageProducer", "jssun.awt.image.ImageFetchable"], "jssun.awt.image.InputStreamImageSource", ["java.lang.SecurityException", "$.Thread", "jssun.awt.image.ImageConsumerQueue", "$.ImageFetcher"], function () { -c$ = Clazz.decorateAsClass (function () { -this.consumers = null; -this.decoder = null; -this.decoders = null; -this.awaitingFetch = false; -Clazz.instantialize (this, arguments); -}, jssun.awt.image, "InputStreamImageSource", null, [java.awt.image.ImageProducer, jssun.awt.image.ImageFetchable]); -Clazz.defineMethod (c$, "countConsumers", -function (cq) { -var i = 0; -while (cq != null) { -i++; -cq = cq.next; -} -return i; -}, "jssun.awt.image.ImageConsumerQueue"); -Clazz.defineMethod (c$, "countConsumers", -function () { -var id = this.decoders; -var i = this.countConsumers (this.consumers); -while (id != null) { -i += this.countConsumers (id.queue); -id = id.next; -} -return i; -}); -Clazz.defineMethod (c$, "addConsumer", -function (ic) { -this.addConsumer (ic, false); -}, "java.awt.image.ImageConsumer"); -Clazz.defineMethod (c$, "printQueue", -function (cq, prefix) { -while (cq != null) { -System.out.println (prefix + cq); -cq = cq.next; -} -}, "jssun.awt.image.ImageConsumerQueue,~S"); -Clazz.defineMethod (c$, "printQueues", -function (title) { -System.out.println (title + "[ -----------"); -this.printQueue (this.consumers, " "); -for (var id = this.decoders; id != null; id = id.next) { -System.out.println (" " + id); -this.printQueue (id.queue, " "); -} -System.out.println ("----------- ]" + title); -}, "~S"); -Clazz.defineMethod (c$, "addConsumer", -function (ic, produce) { -for (var id = this.decoders; id != null; id = id.next) { -if (id.isConsumer (ic)) { -return; -}} -var cq = this.consumers; -while (cq != null && cq.consumer !== ic) { -cq = cq.next; -} -if (cq == null) { -cq = new jssun.awt.image.ImageConsumerQueue (this, ic); -cq.next = this.consumers; -this.consumers = cq; -} else { -if (!cq.secure) { -var context = null; -var security = System.getSecurityManager (); -if (security != null) { -context = security.getSecurityContext (); -}if (cq.securityContext == null) { -cq.securityContext = context; -} else if (!cq.securityContext.equals (context)) { -this.errorConsumer (cq, false); -throw new SecurityException ("Applets are trading image data!"); -}}cq.interested = true; -}if (produce && this.decoder == null) { -this.startProduction (); -}}, "java.awt.image.ImageConsumer,~B"); -Clazz.overrideMethod (c$, "isConsumer", -function (ic) { -for (var id = this.decoders; id != null; id = id.next) { -if (id.isConsumer (ic)) { -return true; -}} -return jssun.awt.image.ImageConsumerQueue.isConsumer (this.consumers, ic); -}, "java.awt.image.ImageConsumer"); -Clazz.defineMethod (c$, "errorAllConsumers", - function (cq, needReload) { -while (cq != null) { -if (cq.interested) { -this.errorConsumer (cq, needReload); -}cq = cq.next; -} -}, "jssun.awt.image.ImageConsumerQueue,~B"); -Clazz.defineMethod (c$, "errorConsumer", - function (cq, needReload) { -cq.consumer.imageComplete (1); -this.removeConsumer (cq.consumer); -}, "jssun.awt.image.ImageConsumerQueue,~B"); -Clazz.overrideMethod (c$, "removeConsumer", -function (ic) { -for (var id = this.decoders; id != null; id = id.next) { -id.removeConsumer (ic); -} -this.consumers = jssun.awt.image.ImageConsumerQueue.removeConsumer (this.consumers, ic, false); -}, "java.awt.image.ImageConsumer"); -Clazz.defineMethod (c$, "startProduction", -function (ic) { -this.addConsumer (ic, true); -}, "java.awt.image.ImageConsumer"); -Clazz.defineMethod (c$, "startProduction", - function () { -if (!this.awaitingFetch) { -jssun.awt.image.ImageFetcher.add (this); -this.awaitingFetch = true; -}}); -Clazz.overrideMethod (c$, "requestTopDownLeftRightResend", -function (ic) { -}, "java.awt.image.ImageConsumer"); -Clazz.defineMethod (c$, "decoderForType", -function (is, content_type) { -return null; -}, "java.io.InputStream,~S"); -Clazz.defineMethod (c$, "getDecoder", -function (is) { -return null; -}, "java.io.InputStream"); -Clazz.overrideMethod (c$, "doFetch", -function () { -{ -if (this.consumers == null) { -this.awaitingFetch = false; -return; -}}var imgd = this.getDecoder (); -if (imgd == null) { -this.badDecoder (); -} else { -this.setDecoder (imgd); -try { -imgd.produceImage (); -} catch (e$$) { -if (Clazz.exceptionOf (e$$, java.io.IOException)) { -var e = e$$; -{ -e.printStackTrace (); -} -} else if (Clazz.exceptionOf (e$$, jssun.awt.image.ImageFormatException)) { -var e = e$$; -{ -e.printStackTrace (); -} -} else { -throw e$$; -} -} finally { -this.removeDecoder (imgd); -if (Thread.currentThread ().isInterrupted () || !Thread.currentThread ().isAlive ()) { -this.errorAllConsumers (imgd.queue, true); -} else { -this.errorAllConsumers (imgd.queue, false); -}} -}}); -Clazz.defineMethod (c$, "badDecoder", - function () { -var cq; -{ -cq = this.consumers; -this.consumers = null; -this.awaitingFetch = false; -}this.errorAllConsumers (cq, false); -}); -Clazz.defineMethod (c$, "setDecoder", - function (mydecoder) { -var cq; -{ -mydecoder.next = this.decoders; -this.decoders = mydecoder; -this.decoder = mydecoder; -cq = this.consumers; -mydecoder.queue = cq; -this.consumers = null; -this.awaitingFetch = false; -}}, "jssun.awt.image.ImageDecoder"); -Clazz.defineMethod (c$, "removeDecoder", - function (mydecoder) { -this.doneDecoding (mydecoder); -var idprev = null; -for (var id = this.decoders; id != null; id = id.next) { -if (id === mydecoder) { -if (idprev == null) { -this.decoders = id.next; -} else { -idprev.next = id.next; -}break; -}idprev = id; -} -}, "jssun.awt.image.ImageDecoder"); -Clazz.defineMethod (c$, "doneDecoding", -function (mydecoder) { -if (this.decoder === mydecoder) { -this.decoder = null; -if (this.consumers != null) { -this.startProduction (); -}}}, "jssun.awt.image.ImageDecoder"); -Clazz.defineMethod (c$, "latchConsumers", -function (id) { -this.doneDecoding (id); -}, "jssun.awt.image.ImageDecoder"); -Clazz.defineMethod (c$, "flush", -function () { -this.decoder = null; -}); -}); +Clazz.declarePackage ("jssun.awt.image"); +Clazz.load (["java.awt.image.ImageProducer", "jssun.awt.image.ImageFetchable"], "jssun.awt.image.InputStreamImageSource", ["java.lang.SecurityException", "$.Thread", "jssun.awt.image.ImageConsumerQueue", "$.ImageFetcher"], function () { +c$ = Clazz.decorateAsClass (function () { +this.consumers = null; +this.decoder = null; +this.decoders = null; +this.awaitingFetch = false; +Clazz.instantialize (this, arguments); +}, jssun.awt.image, "InputStreamImageSource", null, [java.awt.image.ImageProducer, jssun.awt.image.ImageFetchable]); +Clazz.defineMethod (c$, "countConsumers", +function (cq) { +var i = 0; +while (cq != null) { +i++; +cq = cq.next; +} +return i; +}, "jssun.awt.image.ImageConsumerQueue"); +Clazz.defineMethod (c$, "countConsumers", +function () { +var id = this.decoders; +var i = this.countConsumers (this.consumers); +while (id != null) { +i += this.countConsumers (id.queue); +id = id.next; +} +return i; +}); +Clazz.defineMethod (c$, "addConsumer", +function (ic) { +this.addConsumer (ic, false); +}, "java.awt.image.ImageConsumer"); +Clazz.defineMethod (c$, "printQueue", +function (cq, prefix) { +while (cq != null) { +System.out.println (prefix + cq); +cq = cq.next; +} +}, "jssun.awt.image.ImageConsumerQueue,~S"); +Clazz.defineMethod (c$, "printQueues", +function (title) { +System.out.println (title + "[ -----------"); +this.printQueue (this.consumers, " "); +for (var id = this.decoders; id != null; id = id.next) { +System.out.println (" " + id); +this.printQueue (id.queue, " "); +} +System.out.println ("----------- ]" + title); +}, "~S"); +Clazz.defineMethod (c$, "addConsumer", +function (ic, produce) { +for (var id = this.decoders; id != null; id = id.next) { +if (id.isConsumer (ic)) { +return; +}} +var cq = this.consumers; +while (cq != null && cq.consumer !== ic) { +cq = cq.next; +} +if (cq == null) { +cq = new jssun.awt.image.ImageConsumerQueue (this, ic); +cq.next = this.consumers; +this.consumers = cq; +} else { +if (!cq.secure) { +var context = null; +var security = System.getSecurityManager (); +if (security != null) { +context = security.getSecurityContext (); +}if (cq.securityContext == null) { +cq.securityContext = context; +} else if (!cq.securityContext.equals (context)) { +this.errorConsumer (cq, false); +throw new SecurityException ("Applets are trading image data!"); +}}cq.interested = true; +}if (produce && this.decoder == null) { +this.startProduction (); +}}, "java.awt.image.ImageConsumer,~B"); +Clazz.overrideMethod (c$, "isConsumer", +function (ic) { +for (var id = this.decoders; id != null; id = id.next) { +if (id.isConsumer (ic)) { +return true; +}} +return jssun.awt.image.ImageConsumerQueue.isConsumer (this.consumers, ic); +}, "java.awt.image.ImageConsumer"); +Clazz.defineMethod (c$, "errorAllConsumers", + function (cq, needReload) { +while (cq != null) { +if (cq.interested) { +this.errorConsumer (cq, needReload); +}cq = cq.next; +} +}, "jssun.awt.image.ImageConsumerQueue,~B"); +Clazz.defineMethod (c$, "errorConsumer", + function (cq, needReload) { +cq.consumer.imageComplete (1); +this.removeConsumer (cq.consumer); +}, "jssun.awt.image.ImageConsumerQueue,~B"); +Clazz.overrideMethod (c$, "removeConsumer", +function (ic) { +for (var id = this.decoders; id != null; id = id.next) { +id.removeConsumer (ic); +} +this.consumers = jssun.awt.image.ImageConsumerQueue.removeConsumer (this.consumers, ic, false); +}, "java.awt.image.ImageConsumer"); +Clazz.defineMethod (c$, "startProduction", +function (ic) { +this.addConsumer (ic, true); +}, "java.awt.image.ImageConsumer"); +Clazz.defineMethod (c$, "startProduction", + function () { +if (!this.awaitingFetch) { +jssun.awt.image.ImageFetcher.add (this); +this.awaitingFetch = true; +}}); +Clazz.overrideMethod (c$, "requestTopDownLeftRightResend", +function (ic) { +}, "java.awt.image.ImageConsumer"); +Clazz.defineMethod (c$, "decoderForType", +function (is, content_type) { +return null; +}, "java.io.InputStream,~S"); +Clazz.defineMethod (c$, "getDecoder", +function (is) { +return null; +}, "java.io.InputStream"); +Clazz.overrideMethod (c$, "doFetch", +function () { +{ +if (this.consumers == null) { +this.awaitingFetch = false; +return; +}}var imgd = this.getDecoder (); +if (imgd == null) { +this.badDecoder (); +} else { +this.setDecoder (imgd); +try { +imgd.produceImage (); +} catch (e$$) { +if (Clazz.exceptionOf (e$$, java.io.IOException)) { +var e = e$$; +{ +e.printStackTrace (); +} +} else if (Clazz.exceptionOf (e$$, jssun.awt.image.ImageFormatException)) { +var e = e$$; +{ +e.printStackTrace (); +} +} else { +throw e$$; +} +} finally { +this.removeDecoder (imgd); +if (Thread.currentThread ().isInterrupted () || !Thread.currentThread ().isAlive ()) { +this.errorAllConsumers (imgd.queue, true); +} else { +this.errorAllConsumers (imgd.queue, false); +}} +}}); +Clazz.defineMethod (c$, "badDecoder", + function () { +var cq; +{ +cq = this.consumers; +this.consumers = null; +this.awaitingFetch = false; +}this.errorAllConsumers (cq, false); +}); +Clazz.defineMethod (c$, "setDecoder", + function (mydecoder) { +var cq; +{ +mydecoder.next = this.decoders; +this.decoders = mydecoder; +this.decoder = mydecoder; +cq = this.consumers; +mydecoder.queue = cq; +this.consumers = null; +this.awaitingFetch = false; +}}, "jssun.awt.image.ImageDecoder"); +Clazz.defineMethod (c$, "removeDecoder", + function (mydecoder) { +this.doneDecoding (mydecoder); +var idprev = null; +for (var id = this.decoders; id != null; id = id.next) { +if (id === mydecoder) { +if (idprev == null) { +this.decoders = id.next; +} else { +idprev.next = id.next; +}break; +}idprev = id; +} +}, "jssun.awt.image.ImageDecoder"); +Clazz.defineMethod (c$, "doneDecoding", +function (mydecoder) { +if (this.decoder === mydecoder) { +this.decoder = null; +if (this.consumers != null) { +this.startProduction (); +}}}, "jssun.awt.image.ImageDecoder"); +Clazz.defineMethod (c$, "latchConsumers", +function (id) { +this.doneDecoding (id); +}, "jssun.awt.image.ImageDecoder"); +Clazz.defineMethod (c$, "flush", +function () { +this.decoder = null; +}); +});