You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Thomas Leclaire <ze...@gmail.com> on 2010/10/12 12:44:28 UTC

Bind and include bxml

Hello,

I use the binding system to get easily objects from my bxml files :

@BXML private TableView tbLb;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {

        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window)bxmlSerializer.readObject(Main.class, "main.bxml");
        bxmlSerializer.bind(this, Main.class);
....

If tbLb is defined in main.bxml, no problem.

But if I use tag "include" to partition my Pivot App. :
<bxml:include bxml:id="LignesBudgetaires" src="Second.bxml"/>

Objects in Second.bxml are not binded.
Is it correct? And if yes, is there a system to have all objects binded?

Thanks for your help

Re: Bind and include bxml

Posted by Mark Miller <ma...@gmail.com>.
Take it from me - this almost forced modularization is a good thing ;) The
resulting code tends to be very intuitively modularized.

- Mark

On Tue, Oct 12, 2010 at 10:05 AM, Greg Brown <gk...@mac.com> wrote:

> Correct. BXML includes are a way to modularize your UI, and the Bindable
> root object is how you implement the "code behind" the markup. BXML binding
> (whether via bind() or Bindable) simply maps values from the BXML document's
> namespace to the code-behind class.
>
>
> On Oct 12, 2010, at 9:54 AM, Thomas Leclaire wrote:
>
> Ok, I saw such example, but there's no "recursive" system ?
>
> We have to create a java class for each bxml file included in root file in
> order to manage with binding ?
>
>
>
> 2010/10/12 Greg Brown <gk...@mac.com>
>
>> Have the root element of your include implement the Bindable interface and
>> BXMLSerializer will automatically bind() to it. Here is a simple example:
>>
>>
>> http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/JavaWindow.java
>>
>> http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/java_window.bxml
>>
>> On Oct 12, 2010, at 6:44 AM, Thomas Leclaire wrote:
>>
>> > Hello,
>> >
>> > I use the binding system to get easily objects from my bxml files :
>> >
>> > @BXML private TableView tbLb;
>> >
>> >     @Override
>> >     public void startup(Display display, Map<String, String> properties)
>> >         throws Exception {
>> >
>> >         BXMLSerializer bxmlSerializer = new BXMLSerializer();
>> >         window = (Window)bxmlSerializer.readObject(Main.class,
>> "main.bxml");
>> >         bxmlSerializer.bind(this, Main.class);
>> > ....
>> >
>> > If tbLb is defined in main.bxml, no problem.
>> >
>> > But if I use tag "include" to partition my Pivot App. :
>> > <bxml:include bxml:id="LignesBudgetaires" src="Second.bxml"/>
>> >
>> > Objects in Second.bxml are not binded.
>> > Is it correct? And if yes, is there a system to have all objects binded?
>> >
>> > Thanks for your help
>> >
>>
>>
>
>


-- 
- Mark

http://www.lucidimagination.com

Re: Bind and include bxml

Posted by Greg Brown <gk...@mac.com>.
Correct. BXML includes are a way to modularize your UI, and the Bindable root object is how you implement the "code behind" the markup. BXML binding (whether via bind() or Bindable) simply maps values from the BXML document's namespace to the code-behind class.


On Oct 12, 2010, at 9:54 AM, Thomas Leclaire wrote:

> Ok, I saw such example, but there's no "recursive" system ?
> 
> We have to create a java class for each bxml file included in root file in order to manage with binding ?
> 
> 
> 
> 2010/10/12 Greg Brown <gk...@mac.com>
> Have the root element of your include implement the Bindable interface and BXMLSerializer will automatically bind() to it. Here is a simple example:
> 
> http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/JavaWindow.java
> http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/java_window.bxml
> 
> On Oct 12, 2010, at 6:44 AM, Thomas Leclaire wrote:
> 
> > Hello,
> >
> > I use the binding system to get easily objects from my bxml files :
> >
> > @BXML private TableView tbLb;
> >
> >     @Override
> >     public void startup(Display display, Map<String, String> properties)
> >         throws Exception {
> >
> >         BXMLSerializer bxmlSerializer = new BXMLSerializer();
> >         window = (Window)bxmlSerializer.readObject(Main.class, "main.bxml");
> >         bxmlSerializer.bind(this, Main.class);
> > ....
> >
> > If tbLb is defined in main.bxml, no problem.
> >
> > But if I use tag "include" to partition my Pivot App. :
> > <bxml:include bxml:id="LignesBudgetaires" src="Second.bxml"/>
> >
> > Objects in Second.bxml are not binded.
> > Is it correct? And if yes, is there a system to have all objects binded?
> >
> > Thanks for your help
> >
> 
> 


Re: Bind and include bxml

Posted by Thomas Leclaire <ze...@gmail.com>.
Ok, I saw such example, but there's no "recursive" system ?

We have to create a java class for each bxml file included in root file in
order to manage with binding ?



2010/10/12 Greg Brown <gk...@mac.com>

> Have the root element of your include implement the Bindable interface and
> BXMLSerializer will automatically bind() to it. Here is a simple example:
>
>
> http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/JavaWindow.java
>
> http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/java_window.bxml
>
> On Oct 12, 2010, at 6:44 AM, Thomas Leclaire wrote:
>
> > Hello,
> >
> > I use the binding system to get easily objects from my bxml files :
> >
> > @BXML private TableView tbLb;
> >
> >     @Override
> >     public void startup(Display display, Map<String, String> properties)
> >         throws Exception {
> >
> >         BXMLSerializer bxmlSerializer = new BXMLSerializer();
> >         window = (Window)bxmlSerializer.readObject(Main.class,
> "main.bxml");
> >         bxmlSerializer.bind(this, Main.class);
> > ....
> >
> > If tbLb is defined in main.bxml, no problem.
> >
> > But if I use tag "include" to partition my Pivot App. :
> > <bxml:include bxml:id="LignesBudgetaires" src="Second.bxml"/>
> >
> > Objects in Second.bxml are not binded.
> > Is it correct? And if yes, is there a system to have all objects binded?
> >
> > Thanks for your help
> >
>
>

Re: Bind and include bxml

Posted by Greg Brown <gk...@mac.com>.
Have the root element of your include implement the Bindable interface and BXMLSerializer will automatically bind() to it. Here is a simple example:

http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/JavaWindow.java
http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/java_window.bxml

On Oct 12, 2010, at 6:44 AM, Thomas Leclaire wrote:

> Hello, 
> 
> I use the binding system to get easily objects from my bxml files : 
> 
> @BXML private TableView tbLb;
> 
>     @Override
>     public void startup(Display display, Map<String, String> properties)
>         throws Exception {
> 
>         BXMLSerializer bxmlSerializer = new BXMLSerializer();
>         window = (Window)bxmlSerializer.readObject(Main.class, "main.bxml");
>         bxmlSerializer.bind(this, Main.class);
> ....
> 
> If tbLb is defined in main.bxml, no problem.
> 
> But if I use tag "include" to partition my Pivot App. : 
> <bxml:include bxml:id="LignesBudgetaires" src="Second.bxml"/>
> 
> Objects in Second.bxml are not binded. 
> Is it correct? And if yes, is there a system to have all objects binded?
> 
> Thanks for your help
>