Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 77896 invoked from network); 7 May 2010 07:23:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 May 2010 07:23:59 -0000 Received: (qmail 9840 invoked by uid 500); 7 May 2010 07:23:59 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 9717 invoked by uid 500); 7 May 2010 07:23:58 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 9709 invoked by uid 99); 7 May 2010 07:23:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 May 2010 07:23:58 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [80.67.31.36] (HELO smtprelay02.ispgateway.de) (80.67.31.36) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 May 2010 07:23:50 +0000 Received: from [80.67.16.114] (helo=localhost) by smtprelay02.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1OAHuD-0007ka-D7 for user@pivot.apache.org; Fri, 07 May 2010 09:23:29 +0200 Received: from 195.243.208.50 ([195.243.208.50]) by www.premium-webmail.de (Horde Framework) with HTTP; Fri, 07 May 2010 09:23:29 +0200 Message-ID: <20100507092329.13532v1k8xha1bsw@www.premium-webmail.de> Date: Fri, 07 May 2010 09:23:29 +0200 From: Dirk =?iso-8859-1?b?TfZiaXVz?= To: user@pivot.apache.org Subject: Re: How to retrieve wtkx:id? References: <1272896411.38744246@192.168.2.227> <37153974-5726-4E1F-92A1-FE750F463F3D@mac.com> <1272924986.466518659@192.168.2.231> <5AA9D947-A184-4406-B5C9-8EAEE8073069@mac.com> <1272926293.33839270@192.168.2.231> In-Reply-To: <1272926293.33839270@192.168.2.231> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.2) X-Originating-IP: 195.243.208.50 X-Df-Sender: 110773 X-Virus-Checked: Checked by ClamAV on apache.org On second thought, I admit Patrick has a point here. I'm not happy with my own code example because there's too much boilerplate code. The injected button members are not really needed. Albeit, simply adding an "id" property to Component (analogous to Swing's "name" property) is not a good solution either, because the WTKXSerializer (soon to be named BeanSerializer) is more general and unaware of Component -- it would be awkward to insert something like: if (bean instanceof Component) ((Component)bean).setId(...); Instead I propose a new class annotation: @Id public class Component { private String id; // getter and setter... } You can also set the name of the id property: @Id("name") public class MyBean { private String name; // getter and setter... } If WTKXSerializer sees the @Id annotation on a bean, it calls its setter, assuming its type is String. I think that would be general enough. @Id could also be named @WtkxId or @BxId. What do you think? Pivot 2.0?!? Regards, Dirk Patrick Shea wrote: > Unfortunately I don't come from an html background. I'm just trying > to reuse the same listener for more than one component but I can't > because I can't separate which is which! > > This is where the id comes into play... > > I don't think that any xml attribute should be hidden from the java > model, they should always be exposed. > > At the very least the namedObjects map should be exposed and not be > private in the serializer. > > Patrick > > > > -----Original Message----- > From: "Greg Brown" > Sent: Monday, May 3, 2010 6:24pm > To: user@pivot.apache.org > Subject: Re: How to retrieve wtkx:id? > > I understand why you might expect it to work that way, especially if > you are coming from HTML, but it doesn't. Consider that Java member > variables are also accessible via reflection, but you still can't > get a variable name from a class instance. WTKX isn't a DOM - it's > just another way of instantiating classes. > > Hope that helps clarify things. > > Greg > > On May 3, 2010, at 6:16 PM, Patrick Shea wrote: > >> Well, they are declared in xml as id's and used in code in get(...) >> so they are quite public. >> >> I was able to go around this by reflection but it's ugly and they >> should really be exposed at the component level I think. >> >> Patrick >> >> -----Original Message----- >> From: "Greg Brown" >> Sent: Monday, May 3, 2010 6:07pm >> To: user@pivot.apache.org >> Subject: Re: How to retrieve wtkx:id? >> >> No. WTKX IDs don't work like HTML IDs - they are more like variable >> names. Just as there is no way to retrieve a variable name from an >> object instantiated in Java, there is no way to retrieve an ID from >> an object declared in WTKX. >> >> On May 3, 2010, at 10:20 AM, Patrick Shea wrote: >> >>> Is there a way to get the wtkx:id of a given component? >>> >>> Thanks >>> Patrick >>> >> >> >> > > > > -- Dirk M�bius SCOOP GmbH Am Kielshof 29 D-51105 K�ln Fon +49 221 801916-0 Fax +49 221 801916-17 Mobil +49 170 7363035 www.scoop-gmbh.de Sitz der Gesellschaft: K�ln Handelsregister: K�ln Handelsregisternummer: HRB 36623 Gesch�ftsf�hrer: Dr. Oleg Balovnev Frank Heinen Dr. Wolfgang Reddig Roland Scheel