[Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
I want to create a MarkupContainer component which sets the model of contained components. but MarkupContainer.add is final, so i can't override it. why? what else can i do? Thanx, Ittay -- === Ittay Dror Chief architect, openQRM TL, RD, Qlusters Inc. [EMAIL

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Juergen Donnerstag
You want to do what? add() is used to add Wicket Components to the component hierarchy. It is NOT used to set or add a model. Child components can be access by get(childId). Juergen On 5/8/06, Ittay Dror [EMAIL PROTECTED] wrote: I want to create a MarkupContainer component which sets the model

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Martijn Dashorst
Ittay,It seems like you need to create a Panel instead So a much cleaner design, and more reusable component would be:public class MyDatePicker extends Panel { public MyDatePicker(String id, IModel model) { super(id); add(new DatePicker(datepicker, model)); add(new TextField(textfield, model));

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
i want to set the model of the child. i thought of doing that by: child.setModel(myModel); super.add(child); what is wrong with that? how else can i do it? here's the long story of what i'm trying to acheive: i have a web page with two text fields, for date and time (for the

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
that is not my problem. my problem is that i have two components (text fields) - one for date, one for time, whose combined value is my model value. i can, of course, create a custom model, and onSubmit get its values, combine them, and put in the form's model. but this is awkward, and not

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Eelco Hillenius
a method like add is deliberately protected by final to ensure it will work like it is supposed to, no matter what component hierarchy you're in. So, before opening up such a method, we would like to be absolutely sure there are no alternatives for it. In your case there are a couple of things

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Johan Compagner
* We might consider adding event methods, like onAdd(Component) andonReplace(Component) that are called right after a component is added/ replaced. A special not on this is that the add method will dissapearanyway the next major release as we have the constructor change then.Replace will still

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Igor Vaynberg
why not this?WebMarkupContainer composite=new WebMarkupContainer(id, new CompoundPropertyModel(new ValueMap()));composite.add(new TextField(date));composite.add(new TextField(time)); this does what you want right?composite's model is a map whose date key contains the value of the date textfield,

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
Igor Vaynberg wrote: why not this? WebMarkupContainer composite=new WebMarkupContainer(id, new CompoundPropertyModel(new ValueMap())); composite.add(new TextField(date)); composite.add(new TextField(time)); this does what you want right? composite's model is a map whose date key contains

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Igor Vaynberg
in that case i think you should do what martijn said because that is proper encapsulation. how else can you reuse that combination elsewhere?IModel model=new Model(new Date());WebMarkupContainer composite=new WebMarkupContainer(composite, model)); composite.add(new TextFIeld(date,

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
Igor Vaynberg wrote: and this is also what martijn showed you. notice that in his example both components are sharing the same model instance and thus share the same Date object. the problem here is that the datepicker is not aware of the time portion of the date so it probably always

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
yep, exactly what i'm trying to do. the datepicker and timepicker should not use the form's model (which won't neccessaraly accept them, in my case, i use CompoundPropertyModel, and it doesn't have the corresponding methods). so, i need to set in them a Model instance. i can do that in

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Igor Vaynberg
On 5/8/06, Ittay Dror [EMAIL PROTECTED] wrote: Igor Vaynberg wrote: but you can make it generic pretty easily: class AggreatingAtomicFormComponent extends FormComponent { updateModel() { visitChildren(new FormComponent.IVisitor() { ... updatemodel(); });the sub components will try to use their

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
and how do i validate the resulting value? in updateModel, if i find the combined value is not right, there's not much i can do. also, there's a convert() method in Component, what if i want it to be employed also? ittay Igor Vaynberg wrote: On 5/8/06, *Ittay Dror* [EMAIL PROTECTED]

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Igor Vaynberg
and how do i validate the resulting value? in updateModel, if i find the combined value is not right, there's not much i can do. you mean the sum of correct pieces is not always correct itself?!? you can create a validator that performs the same aggregation and checks that i suppose. also, there's

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
Igor Vaynberg wrote: and how do i validate the resulting value? in updateModel, if i find the combined value is not right, there's not much i can do. you mean the sum of correct pieces is not always correct itself?!? you can create a validator that performs the same aggregation

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
Ittay Dror wrote: Igor Vaynberg wrote: and how do i validate the resulting value? in updateModel, if i find the combined value is not right, there's not much i can do. you mean the sum of correct pieces is not always correct itself?!? you can create a validator that performs the

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Igor Vaynberg
it is now :)just added a public non final getInputAsArray()figured if we have a public non final getInput() the array version should be also.-IgorOn 5/8/06, Ittay Dror [EMAIL PROTECTED] wrote: Ittay Dror wrote: Ittay Dror wrote: Igor Vaynberg wrote: and how do i validate the resulting value? in

Re: [Wicket-user] why is MarkupContainer.add final?

2006-05-08 Thread Ittay Dror
Igor Vaynberg wrote: it is now :) just added a public non final getInputAsArray() then you can implement getInput() similar to getInputAsArray()[0] (checking for nulls) figured if we have a public non final getInput() the array version should be also. -Igor On 5/8/06, *Ittay