Skip to main content

RemoteTextDocument usage?

2 replies [Last post]
jaydfwtx
Offline
Joined: 2006-05-30
Points: 0

I am getting a compiler exception when I try to specify a function for the onCompletion attribute. Are there any working samples for how to use this class, or is it broken at the moment? This is with today's build (7/23) using the Netbeans plugin.

If my function signature is "protected function xyz()", then the compiler complains that the function cannot be applied to (Object), which makes sense given the API. However, if the signature is changed to "protected function xyz(value:java.lang.Object)", then I get the following:

An exception has occurred in the OpenJavafx compiler (1.0-internal). Please file a bug at the Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues) after checking for duplicates. Include the following diagnostic in your report and, if possible, the source code which triggered this problem. Thank you.
java.lang.ClassCastException: com.sun.tools.javafx.tree.JFXInstanciate
at com.sun.tools.javafx.comp.JavafxAttr.checkId(JavafxAttr.java:3317)
at com.sun.tools.javafx.comp.JavafxAttr.visitIdent(JavafxAttr.java:635)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
michael_heinrichs
Offline
Joined: 2007-11-15
Points: 0

First of all, please take the time and file an issue for this in JIRA: http://openjfx.java.sun.com/jira. Include your code and the complete exception. Compiler exceptions are taken very seriously and this would help to get rid of another one. If it's possible simplify your source-code as much as possible, this would help the developer a lot.

Now to your question: how do you specify a function for onCompletion? It is not an attribute. Do you extend it? RemoteTextDocument should not be extended but simply used as it is. To react on completion, use the public attributes done or onDone, which are defined in AbstractAsyncOperation.

jaydfwtx
Offline
Joined: 2006-05-30
Points: 0

Thanks Michael. I submitted the issue this morning.

Since there's no examples of this out there that I could find, I'm pasting one here that seems to work for me. Comments/critiques welcome.

Please note that the following does not work using the nightly NB plugin, at least with this URL. You'll get a NegativeArraySizeException, which appears to be happening because the NB plugin is based on the technology preview branch, and not the trunk, where there is a fix for unknown content length.

[code]
import javafx.async.*;

var remoteTextDocument:RemoteTextDocument = RemoteTextDocument {
url: "http://api.flickr.com/services/feeds/photos_public.gne";
}

var doc:String = bind remoteTextDocument.document on replace {
if (remoteTextDocument.done)
java.lang.System.out.println("doc = {doc}");
}
[/code]