Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 13210 invoked from network); 7 Feb 2011 17:58:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Feb 2011 17:58:24 -0000 Received: (qmail 62139 invoked by uid 500); 7 Feb 2011 17:58:24 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 60775 invoked by uid 500); 7 Feb 2011 17:58:22 -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 60755 invoked by uid 99); 7 Feb 2011 17:58:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 17:58:21 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Roger.Whitcomb@ingres.com designates 69.18.216.40 as permitted sender) Received: from [69.18.216.40] (HELO mail.ingres.com) (69.18.216.40) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 17:58:16 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CBC6F0.89F8F4B9" Subject: RE: Class loading question Date: Mon, 7 Feb 2011 12:57:51 -0500 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Class loading question Thread-Index: AcvGWvfoByJ1ELjNRJWsK/UjxVfDBAAKgZnQABlykeA= References: <224C99B8-DAA9-483E-B4E0-30F8C252F46A@verizon.net> From: "Roger L. Whitcomb" To: This is a multi-part message in MIME format. ------_=_NextPart_001_01CBC6F0.89F8F4B9 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Okay, I see what you mean: I *think* I can get it to work implementing "Bindable". I had originally made the object in the BXML file a "Dialog" which was never getting into my class. So, I'm trying to read a "GenericDialog" in the BXML file, which should work as you describe - I see the code in "readObject" that does the binding up the superclass chain. I'm having trouble, though, wrapping my mind around how to get the BXML code organized.... =20 But, I see a problem with just using "bind" (which is what I had in mind to begin with): in BXMLSerializer.bind(Object, Class) it calls "type.getDeclaredFields()" which specifically gets the fields of the object EXCLUDING inherited fields. In my case, the object is the subclass object, but the annotated field is declared in the superclass. Thus, the field never shows up in the list and is never set. =20 So, if I change this call to "type.getFields()" instead things start working. Unfortunately, this has the side-effect that non-public fields are no longer accessible. I'm thinking that the code in "bind" could be changed (maybe at the expense of some speed) to iterate through the fields in the namespace that have ids and then call either "type.getDeclaredField()" or if that fails "type.getField()" with the variable name and check the annotation. This would then make all fields, including all public superclass fields accessible.... =20 What do you think? =20 Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com| Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA | = +1 650-587-5596 | fax: +1 650-587-5550 From: Roger L. Whitcomb [mailto:Roger.Whitcomb@ingres.com]=20 Sent: Sunday, February 06, 2011 9:10 PM To: user@pivot.apache.org Subject: RE: Class loading question =20 When you say "implement Bindable", does that mean the "initialize" method should do the binding? Or will it happen just by virtue of declaring "implements Bindable" and providing a (possibly empty) "initialize" method? I tried the latter and the binding still isn't happening. =20 Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com| Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA | = +1 650-587-5596 | fax: +1 650-587-5550 From: Greg Brown [mailto:gk_brown@verizon.net]=20 Sent: Sunday, February 06, 2011 4:07 PM To: user@pivot.apache.org Subject: Re: Class loading question =20 Just checked - if you have your base GenericDialog class implement Bindable, the annotated values should be bound correctly. =20 On Feb 6, 2011, at 3:57 PM, Greg Brown wrote: =20 If I understand you correctly, you are trying to bind to variables declared in a base class - is that correct? I thought we had coded support for that. How are you performing the bind? Are you using the bind() method or the Bindable interface? =20 On Feb 6, 2011, at 3:12 PM, Roger L. Whitcomb wrote: =20 Okay, I see what you're saying. So, actually my problem is deeper than what I thought: What I'm actually having trouble with (apart from the superficial question of finding the resources, which I get now) is that I have a "GenericDialog" class with a bunch of variables, and then a subclass "DeleteDialog extends GenericDialog". In the GenericDialog constructor (called via "super(String)" from DeleteDialog constructor), I want to load a generic dialog template which has space for a subclass dialog part (which is named by the "String" parameter). The problem is that "this" in the GenericDialog constructor refers to the subclass variable (as it should), so none of the @BXML annotations within GenericDialog itself get filled in (because the only object I have is the subclass object). Even making the variables "protected" doesn't help. So, is there any way to gracefully handle this situation? Do you need to see some code to see what I'm trying to do?? Thanks. =20 Roger Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com| Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA | = +1 650-587-5596 | fax: +1 650-587-5550 From: Greg Brown [mailto:gk_brown@verizon.net]=20 Sent: Friday, February 04, 2011 11:34 PM To: user@pivot.apache.org Subject: Re: Class loading question =20 I wish I hadn't introduced that version of BXMLSerializer#readObject(). :-) It seems to cause more confusion than anything else. =20 Resources in Pivot behave the same as resource bundles in the JDK. If you use the readObject(URL, Resources) signature rather than readObject(Class, String) it will probably make more sense. Apologies for the confusion. =20 G =20 On Feb 4, 2011, at 3:52 PM, Roger L. Whitcomb wrote: Hi all, Let me see if I can even ask this question intelligently: - I've got a package hierarchy where my main program lives in package "a.b.c". In this directory I have Main.java, Main.json (with the resources) and some "g.bxml" files. - In this main program I have a helper function that loads an object from a "bxml" file and binds to whatever object you give it. It uses a.b.c.Main as the class and a.b.c.Main for the resources. - There is a "Sheet1.java" that loads "sheet1.bxml" (all residing in "a.b.c" package) and all works fine and the @BXML variables get set correctly. - Now I introduce a "a.b.c.d" package and want to load a "dialog.bxml" from this directory from "Dialog1.java" (a.b.c.d.Dialog class) using my same helper function (from a.b.c.Main). First off, using a name of "d/dialog.bxml" loads the file fine and I can see it on screen, BUT none of my @BXML variables inside "a.b.c.d.Dialog" get set, and I get no errors or exceptions. - Fine - I'm thinking it's just a package problem, so I copy the helper function into Dialog.java and try to use the same resources from "a.b.c.Main" and it starts giving me "Can't find resource for base name a.b.c.d.Dialog, locale en_US" messages. Okay, so I have to move the resources into there too, which means more initialization, etc., etc. =20 So, I guess my question is this: what is the best way to organize the markup files and resource file(s) in this package hierarchy? And what is the "right" way to use the class names to load resources and send to the BXMLSerializer so that my annotated variables get set correctly? Should I always pass the same class name to the serializer (and hence put the resources and bxml files in the same directory(ies)) as the Java classes? If I want to put stuff in a common places (or places) where should that be? =20 Am I making sense here or is more detail needed? Thanks much! =20 Roger Whitcomb Architect, Engineering Ingres Corporation roger.whitcomb@ingres.com =20 PHONE +1 650.587.5596 FAX +1 650.587.5550 =20 www.ingres.com =20 =20 This transmission is confidential and intended solely for the use of the recipient named above. It may contain confidential, proprietary, or legally privileged information. If you are not the intended recipient, you are hereby notified that any unauthorized review, use, disclosure or distribution is strictly prohibited. If you have received this transmission in error, please contact the sender by reply e-mail and delete the original transmission and all copies from your system. =20 =20 =20 =20 ------_=_NextPart_001_01CBC6F0.89F8F4B9 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Okay, I see what you mean:  I *think* I can get it to = work implementing “Bindable”.  I had originally made = the object in the BXML file a “Dialog” which was never = getting into my class.  So, I’m trying to read a = “GenericDialog” in the BXML file, which should work as you = describe – I see the code in “readObject” that does = the binding up the superclass chain.  I’m having trouble, = though, wrapping my mind around how to get the BXML code = organized….

 

But, I see a problem with just using “bind” (which is = what I had in mind to begin with):  in BXMLSerializer.bind(Object, = Class) it calls “type.getDeclaredFields()” which = specifically gets the fields of the object EXCLUDING inherited = fields.  In my case, the object is the subclass object, but the = annotated field is declared in the superclass.  Thus, the field = never shows up in the list and is never set.

 

So, if I change this call to “type.getFields()” instead = things start working.  Unfortunately, this has the side-effect that = non-public fields are no longer accessible.  I’m thinking = that the code in “bind” could be changed (maybe at the = expense of some speed) to iterate through the fields in the namespace = that have ids and then call either “type.getDeclaredField()” = or if that fails “type.getField()” with the variable name = and check the annotation.  This would then make all fields, = including all public superclass fields = accessible….

 

What do you think?

 

Rog= er Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com| = Ingres | = 500 Arguello Street | = Suite 200 | Redwood City | CA | 94063 | USA &nb= sp;| +1 650-587-5596 | fax: +1 650-587-5550

From:= = Roger L. Whitcomb [mailto:Roger.Whitcomb@ingres.com]
Sent: = Sunday, February 06, 2011 9:10 PM
To: = user@pivot.apache.org
Subject: RE: Class loading = question

 

When you say “implement Bindable”, does that mean the = “initialize” method should do the binding?  Or will it = happen just by virtue of declaring “implements Bindable” and = providing a (possibly empty) “initialize” method?  I = tried the latter and the binding still isn’t = happening.

 

Rog= er Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com| = Ingres | = 500 Arguello Street | = Suite 200 | Redwood City | CA | 94063 | USA &nb= sp;| +1 650-587-5596 | fax: +1 650-587-5550

From:= = Greg Brown [mailto:gk_brown@verizon.net]
Sent: Sunday, = February 06, 2011 4:07 PM
To: = user@pivot.apache.org
Subject: Re: Class loading = question

 

Just checked = - if you have your base GenericDialog class implement Bindable, the = annotated values should be bound correctly.

 

On = Feb 6, 2011, at 3:57 PM, Greg Brown wrote:

 

If I understand you correctly, you are trying to bind = to variables declared in a base class - is that correct? I thought we = had coded support for that. How are you performing the bind? Are you = using the bind() method or the Bindable interface?

 

On = Feb 6, 2011, at 3:12 PM, Roger L. Whitcomb wrote:

 

Okay, I see what you’re saying.  So, actually my problem = is deeper than what I thought:

What I’m actually having trouble with (apart from the = superficial question of finding the resources, which I get now) is that = I have a “GenericDialog” class with a bunch of variables, = and then a subclass “DeleteDialog extends = GenericDialog”.  In the GenericDialog constructor (called via = “super(String)” from DeleteDialog constructor), I want to = load a generic dialog template which has space for a subclass dialog = part (which is named by the “String” parameter).  The = problem is that “this” in the GenericDialog constructor = refers to the subclass variable (as it should), so none of the @BXML = annotations within GenericDialog itself get filled in (because the only = object I have is the subclass object).  Even making the variables = “protected” doesn’t help.  So, is there any way = to gracefully handle this situation?  Do you need to see some code = to see what I’m trying to do??  = Thanks.

 

Rog= er Whitcomb | Architect, Engineering | Roger.Whitcomb@ingres.com| = Ingres | = 500 Arguello Street | = Suite 200 | Redwood City | CA | 94063 | USA &nb= sp;| +1 650-587-5596 | fax: +1 = 650-587-5550

From:=  Greg Brown = [mailto:gk_brown@verizon.net] 
Sent: Friday, February 04, 2011 = 11:34 PM
To: user@pivot.apache.org
Sub= ject: Re: Class = loading question

 

I = wish I hadn't introduced that version of BXMLSerializer#readObject(). =  :-)  It seems to cause more confusion than anything = else.

 

Resources in Pivot behave the same as resource bundles = in the JDK. If you use the readObject(URL, Resources) signature rather = than readObject(Class<?>, String) it will probably make more = sense. Apologies for the = confusion.

 

G

 

On Feb 4, 2011, at 3:52 PM, Roger L. Whitcomb = wrote:



Hi = all,

  = ;            =   Let me see if I can even ask this question = intelligently:

-        = ;  I’ve = got a package hierarchy where my main program lives in package = “a.b.c”.  In this directory I have Main.java, Main.json = (with the resources) and some “g.bxml” = files.

-        = ;  In this = main program I have a helper function that loads an object from a = “bxml” file and binds to whatever object you give it.  = It uses a.b.c.Main as the class and a.b.c.Main for the = resources.

-        = ;  There is a = “Sheet1.java” that loads “sheet1.bxml” (all = residing in “a.b.c” package) and all works fine and the = @BXML variables get set correctly.

-        = ;  Now I = introduce a “a.b.c.d” package and want to load a = “dialog.bxml” from this directory from = “Dialog1.java” (a.b.c.d.Dialog class) using my same helper = function (from a.b.c.Main).  First off, using a name of = “d/dialog.bxml” loads the file fine and I can see it on = screen, BUT none of my @BXML variables inside = “a.b.c.d.Dialog” get set, and I get no errors or = exceptions.

-        = ;  Fine = – I’m thinking it’s just a package problem, so I copy = the helper function into Dialog.java and try to use the same resources = from “a.b.c.Main” and it starts giving me “Can’t = find resource for base name a.b.c.d.Dialog, locale en_US” = messages.  Okay, so I have to move the resources into there too, = which means more initialization, etc., = etc.

 

So, I = guess my question is this:  what is the best way to organize the = markup files and resource file(s) in this package hierarchy?  And = what is the “right” way to use the class names to load = resources and send to the BXMLSerializer so that my annotated variables = get set correctly?  Should I always pass the same class name to the = serializer (and hence put the resources and bxml files in the same = directory(ies)) as the Java classes?  If I want to put stuff in a = common places (or places) where should that = be?

 

Am I = making sense here or is more detail needed?  Thanks = much!

 

R= oger Whitcomb

A= rchitect, Engineering

Ingres Corporation

<= a = href=3D"mailto:roger.whitcomb@ingres.com">roger.whitcomb@ingres.com

 

= PHONE&= nbsp;+= 1 650.587.5596

= FAX&= nbsp;+= 1 650.587.5550

 

&n= bsp;

Th= is transmission is confidential and intended solely for the use of the = recipient named above. It may contain confidential, proprietary, or = legally privileged information. If you are not the intended recipient, = you are hereby notified that any unauthorized review, use, disclosure or = distribution is strictly prohibited. If you have received this = transmission in error, please contact the sender by reply e-mail and = delete the original transmission and all copies from your = system.

 

 

 

 

------_=_NextPart_001_01CBC6F0.89F8F4B9--