pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Class loading question
Date Sat, 05 Feb 2011 03:23:54 GMT
Roger,

Greg is probably best placed to answer your organizational/best practice
questions.

Have you experimented with explicitly supplying the Resources to
BXMLSerializer?
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/beans/BXMLSerializer.html#setResources(org.apache.pivot.util.Resources)

Would you be able to provide a simple example app to demonstrate the binding
issue? Something that correctly loads & binds to classes from a.b.c, but not
a.b.c.d.

Can you get binding to work in this scenario if you call bind() yourself?
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/beans/BXMLSerializer.html#bind(java.lang.Object,
java.lang.Class)

Chris


On 5 February 2011 06:52, Roger L. Whitcomb <Roger.Whitcomb@ingres.com>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!
>
>
>
> *Roger Whitcomb*
>
> Architect, Engineering
>
> *Ingres Corporation*
>
> roger.whitcomb@ingres.com
>
>
>
> *PHONE* +1 650.587.5596
>
> *FAX* +1 650.587.5550
>
>
>
> *www.ingres.com* <http://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.
>
>
>

Mime
View raw message