this is somewhat possible. in 1.5 we have added features that are
somewhat enabling to this such as oninitializecallback and early
markup availability.

we can make all adds() be flat and at runtime parse the hierarchy from
markup, since it is defined there. if we keep a transient
represenation of the hierarchy on the java side we can still properly
handle things that need it, eg isVisibleInHierarchy().

what bothers me about this is that it wont work for everything. for
example, it wont work for repeaters:

<tr wicket:id="contacts"><td><span wicket:id="name"/></td><td><span

add(new listview("contacts",...) {
  onpopulateitem(item) {
     // this code *has* to add to the item and not to the panel
because unique ids are not possible

i wonder how many other cases like this will creep up, and at the end
will it be made easier when you have to think: in this case i can just
call add, but in this case i need to maintain the hierarchy somehow.

also right now it is easy to extract methods that do the same thing:

private void populate(WebMarkupContainer parent) {
 parent.add(new Label("foo",...));
 parent add(new Link("bar", parent.getModel()) {...};

such helpers will no longer be possible because we have forced the
panel to have unique wicket ids

these are just the two that come up off the top of my head.

in the end we have to figure out if the added simplicity is worth the
headache it brings for more complex usecases. what has always
attracted me to wicket is its consistency. once you learn how to add
components you can use the same method for all usecases and it works.
it seems like this would take away from that.


On Thu, Nov 4, 2010 at 1:13 PM, Martin Makundi
<> wrote:
> I propose "Free Wicket" from component-hierarchy hell
> We have discussd before that Wicket has unnecessary binding to
> wicket:id and component hierarchy
> [].
> I think I found a simple solution: "wicket:id" should be allowed to be
> on any level within given Panel-type element. User has freedom to
> position components and change html layout.
> What you think?
> Old wicket applications can be automatically refectored to have unique
> ids. Currently the wicket hardcoded component hierarchy slows down
> development and is totally unnecessary.
> **
> Martin
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to