Darryl Burke wrote:Given that scenario, I can't see a way to create a single typesafe method. In the absence of a common superclass (other than Object) Generics becomes irrelevant.
Darryl Burke wrote:Do DBClass1 and DBClass2 extend a common supertype?
What does serverCall.findAll(ids) return?
Tim Holloway wrote:I'm afraid the sad truth is that HTML is too stupid to be able to do stuff like this. HTML isn't even as smart as the basic UI toolkit for most IDEs, and even HTML5 (which isn't an option here) isn't much better. Consider, for example, that there's no HTML ComboBox control.
A functional solution would probably have to be one of the following:
1. Use a Java applet. Normally I'd go with this, but considering all the security issues with client-side Java lately, it gives one pause.
2. Do it as a Flash plugin. Same issues as #1. Plus Flash. Yuck. Plus Apple mobile devices (among other platforms) refuse to support Flash.
3. Do it in JavaScript. You're a braver person than me. You probably won't be able to leverage tinyMCE, since what you really need is the ability to break the control text into segments, with each segment having the appropriate attributes. I think tinyMCE just lets HTML tags handle that, with results that you've already seen.
No easy solution, alas.
Greg Charles wrote:Well, I may have an answer. As Tim points out, the rich:editor does seems to maintain a hidden textarea for the contents of the edit window in the same way something like OpenOffice is maintaining an XML version of the document being edited. The user doesn't directly work with it though. The actual display of the document is done with an iframe, with its body tag set to contenteditable="true". I believe that is an HTML 5 tag, but it is pretty widely supported in today's browsers.
I tried it out in Firefox, and it seem to work OK for me. There is a known bug in IE8 that forces you to set contenteditable to true if you want the span to be uneditable (that is, exactly the opposite of what it should be), but I couldn't find any reported issues with Firefox. Boris maybe you could post a small example of your rich:editor?