| :) Fortunately, I have this mac account, which seems to work better than that failing gmail account (igor, did you know you can run gmail from many platforms?). I'll use this for a while then.
Eelco
On Jun 15, 2006, at 11:19 AM, Igor Vaynberg wrote: once again, playing messanger boy for eelco cause hes got email issues. thats right boys and girls you heard me right - e m a i l issues. this day and age! did i mention he is a macfanboy? maybe that has something to do with it...
here is his reply:
Why not use findParent(Form.class)? Or pointer.findParent(Form.class)?
A method like onParentAssigned would only partially solve the problem, as that gives no guarantees to the parents of the parents. It'll get even messier probably. Furthermore, we don't need it in 2.0 anymore, as in 2.0 the hierarchy is known at construction time.
Eelco
-Igor
On 6/14/06, smallufo <[EMAIL PROTECTED]> wrote: > I thought this way has some flaw , because it decoupled myDatePicker and > myDatePickerValidator , > Other programmer may form.add(myDatePicker); and forget to > form.add(myDatePickerValidator); You can hide adding that validator in your component too. Of course, the idea is that you hide everything that has to do with that component in that component. Encapsulation, baby!
Hi , the below is the method that I thought , I think it can combine form.add(myDatePicker) and form.add(myDatePickerValidator)
public class MyDatePicker extends Panel
{ private boolean validatorAdded = false; ....................... .... skipped....... ......................
@Override protected void onBeforeRender() { super.onBeforeRender(); if (!validatorAdded) { MarkupContainer pointer = this; while (pointer.getParent() != null) { MarkupContainer markupContainer = pointer.getParent (); if (markupContainer instanceof Form) { Form form = (Form) markupContainer; form.add(new MyDatePickerValidator(this)); validatorAdded=true; break; } pointer = pointer.getParent(); } //while } //if } //onBeforeRender() } //class
By this way , other programmers just need form.add(myDatePicker) , doesn't need to know it needs other validators. I think it is a little tricky (and dumb) , but I cannot find other ways to solve this.
Any better idea ?
BTW , I suggest the following method :
Compoment.onParentAssigned(Compoment parent); If there is this method , I can easily solve this problem , needn't to do the tricky onBeforeRender()...
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
_______________________________________________ Wicket-user mailing list |
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user