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 it kind of bugs me that they always need to be created in the context of the consumer's markup (that is, knowing the markup identifier at the consuming end). Maybe I just haven't fully understood the Wicket "paradigm" yet...
Still, you did not really answer my original question (although you may have done so, implicitly... :-). Just to make things absolutely clear: can a Panel only be assigned an identifier at the time its constructor is called? /Peter igor.vaynberg wrote: > > 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 MyPanel("dummyID", ...); >> } >> ... >> ... >> Panel myPanel = createPanel(); >> myPanel.setId("newID"); >> >> I would like to have a component that acts as a Panel factory (the >> createPanel method above), without requiring the factory to now about the >> markup context of the calling code. Hence, the factory method would >> create >> it with a dummy id that is replaced by the consumer to adapt it to its >> markup context. >> >> Is something along these lines possible in Wicket? Or is there perhaps >> another ("wicket way") for achieving tasks like these. >> >> regards, Peter >> >> -- >> View this message in context: >> http://www.nabble.com/Can-a-Panel%27s-id-be-re-assigned-after-construction--tp17739309p17739309.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Can-a-Panel%27s-id-be-re-assigned-after-construction--tp17739309p17739811.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]