Did you take a look at the code I put in wicket-example's HEAD, the
wizard example? There is some bean editing stuff in there that does
things on a whole different way than you propose. Maybe it is a good
idea to check this out, and see what you do and don't like, and have a
discussion on that.
Eelco
Jonathan Carlson wrote:
I cleaned up some of the code wrapping that made it hard to read. One
benefit of this approach is that if you are using a modern IDE, it will
tell you which options you can use for each type of form component.
Just start typing set and press Ctrl-space (or whatever)
--------------------
I have started of a couple of RAD (rapid app development) panels that
I'm hoping to commit to wicket-stuff, but I thought I'd check to see if
there was interest in co-developing this (in which case I would try to
commit it sooner than later). In any case, I thought it would be good
to get feedback on the approach I'm using.
My goal is for a Wicket developer to be able to quickly pound out bean
editing and bean listing panels very quickly without having to mess with
HTML (unless they really need to do some custom stuff, in which case it
should still be possible to use this).
To create a bean editing panel, one just needs to subclass my
DynEditPanel like the below pseudo-code (my actual, mostly-working
example is on a different computer). Please note that I would much
prefer all the setup() method logic to be in the constructor but it
doesn't work because a superclass constructor cannot call a method in a
subclass (maybe someone can help me find a better solution).
(All HTML is inherited from DynEditPanel so no HTML coding is required
here)
public class EditPanel extend DynEditPanel
{
public EditPanel(String id)
{
super(id);
}
protected void setup()
{
setModel(new Model(employee));
addTextField("name")
.setTitle("Full Name")
.setMaxLength(40)
.setSize(20)
.setRequired(true);
addTextField("manager")
.setTitle("Boss")
.setMaxLength(40)
.setSize(20)
.setRequired(true);
addTextArea("notes")
.setTitle("Notes")
.setColumns(40)
.setRows(5)
.setReadOnly(true);
List deptartments = /* find departments here */;
addDropDown("department", departments)
.setTitle("Dept")
.setRequired(true);
addDateField("hireDate")
.setFormat("YYYY-MM-DD")
.setRequired(true);
}
protected void onSubmit()
{
// do save logic here
}
}
I don't like this, but the class that constructs this instance has to
call completeSetup() on the DynEditPanel which calls the setup() method
here. I can discuss why if there is more interest, but I'd love to
avoid this. I feel like I'm bumping up against some major limitations
of setting up a component in the constructor. Maybe I need to
investigate using static methods for constructing instead.
I'm also hoping to modify my existing DynListPanel component to use a
similar structure, avoiding the need for any HTML by the developer. I
haven't thought this one through very well yet, but that would allow
things like:
/** Constructor */
public DynListPanelSubclass()
{
supportDelete(true); // override onDelete(bean)
supportEdit(true); // override onEdit(bean)
setPageSize(10);
addLabel("name")
.setTitle("Full Name")
.setSortable(true)
.setFilterable(true);
addLabel("department")
.setTitle("Dept")
.setFilterChoices(departments)
.setSortable(true);
}
Any ideas or suggestions? If the right balance of flexibility and
RADness is made, I think these could be very powerful components.
Jonathan
______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
Katun Corporation -- www.katun.com
_____________________________________________________________________
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user