Can a Panel's id be re-assigned after construction?

2008-06-09 Thread Peter Gardfjell
Hi, a quick question. Is it possible to assign a new id to a Panel after it has been constructed? Something similar to: public Panel createPanel() { return new MyPanel(dummyID, ...); } ... ... Panel myPanel = createPanel(); myPanel.setId(newID); I would like to have a component

Re: Can a Panel's id be re-assigned after construction?

2008-06-09 Thread Igor Vaynberg
pass the id into the createPanel method -igor On Mon, Jun 9, 2008 at 11:51 AM, Peter Gardfjell [EMAIL PROTECTED] wrote: Hi, a quick question. Is it possible to assign a new id to a Panel after it has been constructed? Something similar to: public Panel createPanel() { return new

Re: Can a Panel's id be re-assigned after construction?

2008-06-09 Thread Peter Gardfjell
Of course. In the toy example I attached, the obvious solution is to add an id parameter. However, in some cases, for instance when the factory methods contain longer parameter lists, the extra identifier parameter tends to clutter the API. I really like the encapsulation that Panels offer, but

Re: Can a Panel's id be re-assigned after construction?

2008-06-09 Thread Martijn Dashorst
On Mon, Jun 9, 2008 at 9:21 PM, Peter Gardfjell [EMAIL PROTECTED] wrote: Just to make things absolutely clear: can a Panel only be assigned an identifier at the time its constructor is called? Yes. Martijn -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache

Re: Can a Panel's id be re-assigned after construction?

2008-06-09 Thread Igor Vaynberg
it is possible. you can write a component that is only allowed to have one child with any id using an IComponentResolver. is that a good practice? if i were implementing your factory interface i would be confused as to what id i should use since the panel takes it as a constructor arg...so which