Forwarded to developers List ... Do you think could be useful this feature for release 2.1 (without having to implement Bindable etc) ?
Sandro ---------- Forwarded message ---------- From: Greg Brown <[email protected]> Date: 2011/10/31 Subject: Re: SV: Passing parameters to BXML include tag. To: [email protected] Try implementing Bindable in your root element and overriding initialize(). On Oct 31, 2011, at 8:46 AM, Piotr Kołaczkowski wrote: > Thanks, I tried that but the load method is not called. However, the > constructor of the component is called, and the setter of the property is > also called. > What can be a reason that the load method is not called? > > Regards, > Piotr > > W dniu 2011-10-30 21:11, anton dos santos pisze: >> If your custom component is implemented by a BXML file and a java class you >> can do following: >> >> in the calling BXML: >> >> <bxml:include bxml:id="id1" src="../MyComp.bxml" customTitle="Hello1"/> >> <bxml:include bxml:id="id2" src="../MyComp.bxml" customTitle="Hello2"/> >> >> in MyComp.java, declare a variable with the same name as the parameter and >> use it in load() to initialize the component >> >> @BXML >> public String customTitle; >> >> @Override >> public void load(Object context) { >> border.setHeading( customTitle); >> } >> >> On 30/10/2011 19:46, Piotr Kołaczkowski wrote: >>> W dniu 2011-10-30 18:56, Edvin Syse pisze: >>>>> Is there a way to use BXML files as templates? I'd like to include two >>>>> almost >>>>> identical component sets in the main window, differing with component ids >>>>> and probably a single label text. >>>> It would be fairly trivial to modify the XML before you give it to the >>>> BXMLSerializer, so this wouldn't require any special framework support as >>>> far as I can see. >>>> >>>> -- Edvin >>> >>> Ok, and how to do that from another BXML file? >>> The BXML <include> tag references just a plain text resource. Is there a >>> way to intercept loading of the included file and modify it on the fly? >>> >>> BTW: Regardless of how trivial this is to implement, not having this >>> feature in the framework means adding quite a lot of accidental complexity >>> to the project configuration. >>> Imagine almost every team rolling their own templating engine, slightly >>> different from each other. I think this is not a top priority, but a really >>> nice to have feature. >>> >>> Regards, >>> Piotr >>> >>> >>> >> >> > >
