Hi,

you may override Form.onRender() or Form.onComponenTagBody(). First do
your check and set components invisible/visible and than call the
super implementation.
I had another case where the container was a form and not a panel so I could try that, but this didn't work out because of "wicket.WicketRuntimeException: Cannot modify component hierarchy during render phase" (state change) Overwriting isVisible works fine although. And as it are buttons in this case, they have a inner class for onSubmit handling so or so.

Idea (=may be stupid, I don't know): Maybe an abstract method which gets called - after all event handlers have been handled (so the model can't be changed any more)
- and before rendering starts
could make it easier to implement such behaviours. When having a lot of set/isVisible behaviour, I would like

public void onToBeNamed() {
    component1.setVisible(bla.getXXX().equals("test"));
    component2.setVisible(bla.getYYY().equals("123"));
    component3.setVisible(bla.getZZZ().equals("abc"));
}

more than:

component1 = new Component() {
                @Override
                public boolean isVisible() {
                    return bla.getXXX().equals("test");
               }
}

component2 = new Component() {
                @Override
                public boolean isVisible() {
                    return bla.getYYY().equals("123");
               }
}

component3 = new Component() {
                @Override
                public boolean isVisible() {
                    return bla.getZZZ().equals("abc");
               }
}

Regards,
Ralf


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to