As well as you are over with studying dataflow diagram, let read through demonstrational process of new Form creation on base of business model classes:
Xermes server side
|
|
Imagine: You have simple interfaces Address and Country (and their implementations) like the ones below. There are also 2 predefined countries (instances of
Country ): "USA" and "Czech Republic".
You want to provide generic GUI forms to allow user to create/delete/modify instances of them.
|
public interface Address {
public String getCity();
public void setCity(String city);
public String getStreet();
public void setStreet(String street);
public Country getCountry();
public void setCountry(Country country);
public Zip getZip();
public void setZip(Zip zip);
}
|
public interface Country {
public String getFullName();
public void setFullName(String fullName);
public String getAbbreviation();
public void setAbbreviation(String abbreviation);
}
|
|
How to present them to application user?
Let's remember the standard approach before learning more about the Xermes way.
We have to provide GUI, especially set of forms. The most common way how to do it is some WYSIWYG (manual) editing, laying components out, adding handlers, interconnecting pieces of GUI to
functional complex.
In case of changes in business model it's neccessary to (manually) update incident forms, (manually) update tests concerning GUI, (manually) add relevant components for added fields,
(manually) remove components for removed fields.. (manually) Create forms for new classes, (manually) remove.. Pause on, please! Most of that work is routine, mhhhmm computerizable,
isn't it?
I allready know about systems able to generate (some of them "on the fly") forms from RDBMS schema. Xermes is intended to do the same thing, but the modern way: from the object schema -
from interfaces and classes and in independent, standard, XML-based format called XForms.
|
<xmlns="http://www.w3.org/2001/08/xforms">
<xform id="address">
<submitInfo action="..." method="post"/>
</xform>
<instance>.....</instance>
<model>........</model>
<bindings>.....</bindings></head><body>
</xform:input><xform:input xform="address" ref="city">
<xform:caption>City</xform:caption>
</xform:input><input xform="address" ref="street">
<caption>Street</caption>
<selectOne xform="address" ref="country" selection = "open" >
<caption>Country</caption>
<choices>
<item value="usa">
<caption>USA</caption>
</item>
<item value="cr">
<caption>Czech Republic</caption>
</item>
</choices>
</selectOne>
</input><input xform="address" ref="zip">
<caption>ZIP</caption>
</input><submit xform="payment">
<caption>Submit</caption>
</submit>
|
|
This piece of XML is there as an example skeleton of XForms XML generated from business model class.
Presented XForms document seems to be relatively simple, a bit unclear part may be the selectOne element responsible for altering country attrib of
Address . As you can see, there are some choices for selection. What's their origin? They were automatically listed by Xermes from existing Country instances. Such list
may be provided by class implementing Persistor interface (below).
|
public interface org.xermes.Persistor {
public Vector getAllInstances(Class ofClass);
}
|
Selection type "open" means that GUI has to provide means for supplying other value than one from predefined list. If user types value not presented in list (e.g. "Greece"), Xermes should
handle this situation by providing another form - new Country form.
If you have any questions concerning XForms syntax, please visit W3C's XForms tutorial and specification.
|
Xermes transport
|
|
XML XForms document is delivered to client part of Xermes. It's not important whether client resides on separate machine and form was delivered via HTTP or simply referenced inside one
JVM, but it's here and it's success.
|
Xermes client side
|
|
What to do now? Xermes Client will parse delivered form, perform some internal operations and... finally produce appropriate GUI.
|
Swing
|
XHTML & Forms
|
XHTML & XForms
|
WAP
|
As you allready know, GUI form is not only component layout, but also behavior. Xermes must associate handlers, generate events, pass data instances back to server, etc. ...must establish
channel and dynamically communicate.
|