Return-Path: X-Original-To: apmail-wicket-users-archive@minotaur.apache.org Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B6EF1EA84 for ; Mon, 7 Jan 2013 09:36:44 +0000 (UTC) Received: (qmail 94338 invoked by uid 500); 7 Jan 2013 09:36:42 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 94136 invoked by uid 500); 7 Jan 2013 09:36:42 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 94080 invoked by uid 99); 7 Jan 2013 09:36:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 09:36:40 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of pflanzenmoerder@gmail.com designates 209.85.212.48 as permitted sender) Received: from [209.85.212.48] (HELO mail-vb0-f48.google.com) (209.85.212.48) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 09:36:34 +0000 Received: by mail-vb0-f48.google.com with SMTP id fc21so18843145vbb.21 for ; Mon, 07 Jan 2013 01:36:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7tU/I0wIsWL4Gb3BA/MyS27QwC//nCl3NQvRBlmD648=; b=dsbb5t/hP02YRW0yk+ewmnV0LJa4hAUfCWDj3IvZZFxTpPeABYNQt5JViIIh7BogRi 5X9LqD20QYPDKeO/5ufZpSlotSTTB6XjtKL5nhS9s6h9uOJFGryXjGiNZmpuv/3a/r5S pr/JaR2UBuW1rj1zw6aQCUHXgZNQoj5JT5lT7ksbigzv9pTwdg3nPz/8eY/SEhboaJeW bNUkjyXvU0/jr5HyTYTruBhPXj12N6cSiyorWGWPP7kSfTHk2qtvhvP0TW5dQIYqGqBW H/nnRH8JqeLDDL/aPb8G+h6dJrkVRtyBhqSEekYzOqDUxmQ2MIicCM8zGcrf4csD4v9G R6lA== MIME-Version: 1.0 Received: by 10.220.106.133 with SMTP id x5mr2790068vco.61.1357551374090; Mon, 07 Jan 2013 01:36:14 -0800 (PST) Received: by 10.58.238.195 with HTTP; Mon, 7 Jan 2013 01:36:13 -0800 (PST) In-Reply-To: References: <6B7A95C1-D977-40FD-A5EB-95F404C74019@thebedells.org> Date: Mon, 7 Jan 2013 10:36:13 +0100 Message-ID: Subject: Re: Constructors take vararg of Component? (Enhancement RFC) From: Jochen Mader To: users@wicket.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Why aren't you using fluent interfaces? The API ist built around that and allows for a much cleaner structure inside your constructors. Just watch out for those Auto-Formaters ;) new Form("frmRsvp", cpm) .add(new StatusPanel("pnlRsvp")) .add(new ConfirmPanel("pnlConfirm")) .add(new RsvpRulesPanel("pnlRsvpRules")); On Mon, Jan 7, 2013 at 9:17 AM, Martin Grigorov wrote: > Hi, > > The component constructor doesn't call #add() at the moment (and I think > this wont change soon without a better reason). > So even if adding the varargs this wont help. > > But you can create your own components which do this: > > public class MyForm extends Form { > public MyForm(String id, IModel model, Component... children) { > super(id, model); > > ad(children); > } > } > > > On Sun, Jan 6, 2013 at 9:24 PM, Zac Bedell wrote: > >> Greetings all, >> >> I was wondering what Wicket users & devs might thing of a possible API >> change for a future version (maybe Wicket 7?) of including a varargs array >> of Component as the final parameter of all of the various MarkupContainer >> subclasses? I find myself doing things like these a lot: >> >> pnlNoRsvp = new WebMarkupContainer("pnlNoRsvp"); >> pnlRsvp = new StatusPanel("pnlRsvp"); >> pnlConfirm = new ConfirmPanel("pnlConfirm"); >> pnlRsvpRules = new RsvpRulesPanel("pnlRsvpRules"); >> >> RsvpPage.this.add( >> new Label("event.title"), >> new CssFeedbackPanel("feedback"), >> new Form("frmRsvp", cpm) { >> { >> add(pnlNoRsvp, pnlRsvp, pnlConfirm); >> } >> }, >> pnlRsvpRules >> ); >> >> -- or -- >> >> Form frmRsvp = new Form("frmRsvp", cpm); >> frmRsvp.add(pnlNoRsvp, pnlRsvp, pnlConfirm); >> >> RsvpPage.this.add( >> new Label("event.title"), >> new CssFeedbackPanel("feedback"), >> frmRsvp, >> pnlRsvpRules >> ); >> >> -- >> >> If Form and the various other Wicket MarkupContainer's had constructors >> with Component... as their final parameter, it would be possible to do >> something like: >> >> RsvpPage.this.add( >> new Label("event.title"), >> new CssFeedbackPanel("feedback"), >> new Form("frmRsvp", cpm, pnlNoRsvp, pnlRsvp, pnlConfirm), >> pnlRsvpRules >> ); >> >> -- >> >> Granted, this would balloon the number of constructors throughout the >> framework just to save a bit of typing. Curious what others might think... >> >> Best regards, >> Zac Bedell >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org >> For additional commands, e-mail: users-help@wicket.apache.org >> >> > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org