Posted by xuanyun on January 28, 2009 at 6:36 AM PST
We can embed Java objects into Synth XML file, the embeded objects can be referred as properties.
As we know, Synth look and feel can be customized with an XML file which satisfies
XML format. After we go through the document, we can conclude that the type
of property in the XML can be one of the following:
Actually the idref is the most important one, since it is
a type that represent a reference of object, which may be the instance of any
specific class. In fact we can use idref only to specify any property, but in
order to simplify the XML data, other types are also provided.
The string type is not supported in JRE5, it is shipped with
JRE6. So please be careful, if you want to develop a look and feel that can
work under JRE5, youâ€™d better not to use the string property
type, you can use the idref type instead. BTW, I do think the
Synth look and feel in JRE5 is too buggy, we worked a lot to make EaSynth
look and feel to work properly under JRE5. So I really suggest to develop
Synth based look and feel that can run under JRE6+ only, that will save a lot
The idref is a reference of existing object, its value should
be the id assigned to the object. There are several kinds of objects which can
be defined in the XML(they all have id attribute):
To embed the first 7 kinds of objects into the XML, you should follow the Synth
File Format document, but for the beansPersistance entity,
the document did not describe it clearly. Actually the beansPersistance
entity is very important, it can embed any object into the XML. Of
course it is not a Base64 solution ;-), it is using the XML serialize instead.
You can use the java.beans.XMLEncoder class to generate the
XML snippet to represent the object. As example, you can view the "easynth.xml"
file in EaSynth
look and feel, you can see something like these: