It may make sense to look for bean properties first. I'd suggest filing a JIRA 
ticket.

On Oct 31, 2011, at 10:52 AM, Piotr Kołaczkowski wrote:

> Hmm, looks like it is not supported:
> 
> from BXMLSerializer code, lines 1505-1511:
> 
> if ((fieldModifiers & Modifier.PUBLIC) == 0) {
>                    try {
>                        field.setAccessible(true);
>                    } catch (SecurityException exception) {
>                        throw new BindException(fieldName + " is not 
> accessible.");
>                    }
>                }
> 
> It just sets the field directly and ignores the existence of the setter.
> Have you considered calling public setter by default (found according to the 
> JavaBean naming convention), and only if the setter doesn't exist, trying to 
> set the field directly?
> Should be pretty straightforward to implement. That would enable using the 
> @BXML annotation in unsigned applets. Theoretically I could make the field 
> public, and it would work now, but I write that in Scala and it doesn't 
> support public fields - I can only provide a private field with a public 
> getter and public setter.
> 
> Regards,
> Piotr
> 
> W dniu 2011-10-31 15:09, Greg Brown pisze:
>> Sounds like a bug.
>> 
>> On Oct 31, 2011, at 9:41 AM, Piotr Kołaczkowski wrote:
>> 
>>> Thanks, that works.
>>> BTW: Why @BXML doesn't work in unsigned applets, although there is a public 
>>> setter present?
>>> 
>>> 
>>> W dniu 2011-10-31 14:00, Greg Brown pisze:
>>>> 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
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>> 
>> 
> 
> 
> 

Reply via email to