11:00 AM
Today’s problem arises from my attempt to explanation Generation III nuclear reactors. The explanation is long and complicated, and there’s really no way to shorten it without reducing it to something like “Generation III reactors are better than Generation II reactors.” Moreover, the explanation would work best with multiple illustrations, not the single drawing I put on the page. What I’d like is something that allows the player to bring up different pages that explain different technologies, one chunk at a time.
No prob! Just use hyperlinks — right? Well, yes, I could do something like that, but it raises some new problems. In the first place, my hyperlinks would not jump to new URLs, they would simply select new page descriptions. That I can probably handle. But the real killer is this: my dataset is stored in an XML document. The HTML would be embedded inside other XML elements. Right now, I don’t know how to incorporate HTML into XML. Do I use some sort of complex element that includes HTML as one of its attributes? I suppose so, but this would take a lot of research to figure out. Besides, I’m not sure that simply embedding HTML inside my document would get what I want — and it might well give me behavior that I don’t want.
Another way is to fake the hyperlinks. In other words, I build my own little rendering engine that recognizes some special escape characters that I define, and uses those escape characters to mimic hyperlink behavior inside my program. The problem here is that Java controls the drawing of the text and I have to go through its own system, figuring out how to handle AttributeSets (or maybe it’s Styles). Either way, this is going to be painful. I suppose that I’m just going to have to plow into this mess and experiment, see if I can get anything working.
2:00 PM
Well, I managed to figure out how to get an HTML document inside my TextPane and displayed as HTML. It even has the links underlined and in blue. Now I have to set up all the other stuff to make this happen. It looks as if this will require a big ugly change to my data structures. Currently I have all the explanatory text cuddled up inside the XML file. All very neat and tidy. But in order to display the text in HTML, I have to have it in an HTML document, not an XML document. Thus, I’ll need a separate folder with lots of HTML files, one for each and every page — a much messier arrangement. I’ll see if I can’t clean up this problem, but it looks like trouble.
7:00 PM
It’s time to wrap up this diary entry. I’ll still be working; I have a lot to do. I have the basic system operational, but it really is going to require a lot of big changes in my software. Busy times ahead.