[jsword-devel] EditSite and BeanPanel

DM Smith dmsmith555 at yahoo.com
Mon Aug 22 14:36:51 MST 2005


We use a BeanPanel to represent the editable fields of the various 
Installers, which at this point is just the HTTP installer.
The fields come out in a random order. They should be in an order that 
is appropriate for the Installer.

I would like some input before I make changes.

Any thoughts on how to change the code. I see a couple of possibilities:
1) Create an interface BeanOrdering with a single method "String[] 
ordering()" that the installers will implement.
    The BeanPanel would call this to figure out which order to display 
the fields in.
2) Don't use BeanPanel but create an interface class SiteEditor which 
would have an implementation per installer.
    A SiteEditorFactory would be able to create an appropriate 
SiteEditor from the installer type (e.g. sword-http, sword-ftp).

There are advantages and disadvantages to both.
Advantages of 1)
Fairly simple to implement in "client" classes.
Disadvantages of 1)
Ordering the fields in BeanPanel is not trivial, but only needs to be 
figured out once.
Not obvious how the code works.
The class is not really all that general purpose. (The setters and 
getters must use either String or Integer, no other work.)
I found it hard to debug when trying to figure out why a setter that 
didn't take a string didn't work and that I needed to add support for 
another data type.

Advantages of 2)
Code is similar to other patterns in JSword.
The code is pretty obvious.
Disadvantages of 2)
Lot more code.
Need to write a SiteEditor for each Installer.

I am inclined to do 2).




More information about the jsword-devel mailing list