I want to integrate itemrenderers in a TextArea. The purpose is to visualize keywords with their own easy interface while the user still can treat the whole thing as normal text to select the font, fontsize, etc.
E.g. this could be the htmltext of the TextArea:
<TEXTFORMAT LEADING="2">
<P ALIGN="RIGHT">
<FONT FACE="Century Gothic" SIZE="24" COLOR="#999999">
The temperature is {TEMP|DEGREES}°.
</FONT>
</P>
</TEXTFORMAT>
In this example the part {TEMP|DEGREES} should be replaced with an ItemRenderer which shows a dropdown list with possible keywords (Temperature, Time, …) and a second dropdown with parameters depending on the selected keyword (for Temperature that would be Degrees, Fahrenheit).
Any ideas or suggestions on how to handle this?
Thanks a lot,
Frank
Yeah, definitely not possible without majorly hacking TextArea, which in the end wouldn’t really be a TextArea anymore.
I have done something similar to this however. It was simple enough, just create a simple yet robust data structure (like say an array that contains custom models that has some sort of agnostic data property and a ‘type’ so you know what to do with it), iterate through then add it to a container (like HBox). Depending on the type of data, you’ll need some sort of algorithm that knows what to do with it (which ‘item renderer’ to create).
This is definitely possible as I’ve create a way to have dynamic complex forms based on data alone, but it’s not the simplest thing to do. You need to test it quite a bit and think about the data structure and how to abstract it quite a bit. I would share the code with you, but the IP isn’t mine.