pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gk_br...@verizon.net>
Subject Re: Class loading question
Date Mon, 07 Feb 2011 00:06:30 GMT
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
>> 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.
>> 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
>> From: Greg Brown [mailto:gk_brown@verizon.net] 
>> Sent: Friday, February 04, 2011 11:34 PM
>> To: user@pivot.apache.org
>> Subject: 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.,
>> 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!
>> Roger Whitcomb
>> Architect, Engineering
>> Ingres Corporation
>> roger.whitcomb@ingres.com
>> PHONE +1 650.587.5596
>> FAX +1 650.587.5550
>> www.ingres.com
>> 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.

View raw message