Yep… in the process of writing the XML layout parser and thus far it is going well, however, I could use a bit of help.
First, let me show what the layout XML file would consist of and then I’ll plow through some of the basics of the parser. After that, I’ll ask the questions I need assistance with.
XML Layout sample:
[java]
<root>
<screen>
<component type=“Window” id=“someFancyWindowID” position=“5%,5%” dimensions=“90%,90%”>
<method name=“setWindowTitle” param0=“This is a test” />
<component type=“Button” id=“aButtonID” position=“50,50” dimensions=“15%,8%” >
<method name=“setText” param0=“Click Me!” />
</component>
<component type=“Button” id=“aButtonID2” position=“50,100” dimensions=“100,25” >
<<method name=“setText” param0=“Click Him!” />
</component>
</component>
</screen>
</root>
[/java]
There will be a bit more involved, but let me explain what I have thus far.
Naming convention will mirror the classes and class methods to make full use of reflection for building components.
The component tag:
type = the type of control (or class name of control)
The rest of the attributes are the parameters from the common constructor, all being optional aside from position.
Attribute list is: uid, position, dimensions, resizeBorders, defaultImg
Within each component tag are a list of method tags for setting parameters past construction.
The method tag will use the following format:
name="actualMethodName"
and then a series of param0-param#ofParams
Once again, using reflection to build the invoke call.
Posting this and moving on with what I have (I don't want to have to f around with the < > crap again.