Hello Wolf,

I really would like to help the documentation of swixml.

Allthough I currently have not much spare time (as I'm sure everyone of us has'nt) I do what I'm able to.

On the following topics I consider myself having some knowledge:
- init classes
- localization
- GridBagLayout usage/gui design

What do you think we should write the documentation in? I suppose, HTML is the most convenient way to write things like this: platform independent, usable in javadoc, website and the like.

Do you consider having a cvs repository for the participants?

cu,

Frank

Wolf Paulus wrote:
Now, with Swixml's syntax approaching V1.0 finalization, I'm looking for
some help writing a user's guide.

Swixml's Java-Doc and Tag-Doc were sufficient, getting some "early-adopters"
started. However, making this a useful tool for a broader group of
Java-Developers requires a good user's guide.

Considering the swixml.org web-stats and my email inbox, I'd say, we have
around 50 really active an knowledgeable Swixml adopters out there (the
number of downloads is about 5 times higher). Some of those definitely have
reached a level of experience that would make them a great resource for a
project like Swixml. If you feel the need to share your experience and teach
some Swixml beginners - please join me in writing the user guide. Let me
know what issue / tag you want to tackle (but don't start before I have
confirmed your choice - otherwise we all work on the same tag).

This document will contain detailed larger sections about topics like
- Localization
- Custom Tags
- PLAFs
- init classes
etc.
and every Swixml Tag is going to be covered.
Sample Java-Code, XML descriptors, and screen shots accompany very section.

The level of detail I would like to make available matches that in this
email, I recently sent to an Swixml user:

Usually, the class represented by a Tag gets instantiated using the
default constructor. For instance, <formattedtextfield/> would cause the
instantiation of a JFormattedTextField class.
To program this one would probably write a statement link this:
        JFormattedTextField ftf = new JFormattedTextField();

The initclass attribute was introduced to allow instantiation using an
argument-ed constructor, where the initclass describes the argument type.

For instance, if this constructor should be used:
    JFormattedTextField(Format format)
then the Tag in the XML descriptor needs to look like this:
    <formattedtextfield initclass="java.text.Format"/>

Before the instantiation of the JFormattedTextField, Swixml would
instantiate the argument by loading and instantiating the initclass.
Since all attribute values in a Swixml XML-descriptor are Strings, the
Java code one would write to accomplish this at compile-time could look
like this:

    JFormattedTextField ftf = new JFormattedTextField(  Class.forName(
initclass.toString() ).newInstance() );

Unfortunately, since java.text.Format is abstract, the example wouldn't
work. A real-world example would probably use the format class'
sub-class DecimalFormat and also specify the format like this:
    <formattedtextfield id="tf_TicketTime" columns="5"
initclass="java.text.DecimalFormat(#0.00)"/>

Here a DecimalFormat class is instantiated using this constructor:
    public DecimalFormat(String pattern)
which also presents the most complex use of the initclass attribute.
This object eventually used to instantiate a JFormattedTextField.
Comparable Java code looks like this:

    Format fmt = new DecimalFormat("#0.00");
    JFormattedTextField ftf = new JFormattedTextField( fmt )
    ftf.setColumns(5);
    cmpMap.put( "tf_TicketTime", ftf );


If the initclass is provided with a parameter, then the initclass type
constructor is determined like this:
    Constructor ctor = initClass.getConstructor( new
Class[]{String.class} );
In other words there has to be a constructor available for the
initclass, accepting a String argument.
If the initclass  is provided without a parameter, Swixml looks for a
getInstance method first:
    Method factoryMethod = initClass.getMethod( Parser.GETINSTANCE, null );
If that fails, the class' newInstance() method is used, which required a
default constructor.


Summary of the initclass rules:
The initclass is the type of the instance that is passed into the tag
class' constructor.
The initclass attribute should contain a full qualified class name.
If the initclass implementation needs to provide a default constructor
or a constructor with just a String argument. Alternatively, a
getInstance() method (with no argument) may be implemented, returning a
initclass instance.
In the XML-Descriptor, then initclass may only be with an argument, if
the initclass type provides the String argument-ed constructor.



--
Wolf Paulus
C a r l s b a d   C u b e s
mailto:[EMAIL PROTECTED]

CONFIDENTIALITY NOTICE:
This message is intended only for the use of the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, please contact the sender by reply
email and destroy all copies of the original message.


_______________________________________________
Forum mailing list
[email protected]
http://mars.lunarpages.com/mailman/listinfo/forum_carlsbadcubes.com





Reply via email to